FBO question
来源:互联网 发布:ios2k16库里捏脸数据 编辑:程序博客网 时间:2024/05/20 06:57
导读:
FBO question |
w0nd Member since: 3/31/2006 From: seoul, Korea, Republic of | ||||
hello everyone. a question regarding FBOs. just started playing around with it. i'm using fbo and drawing to two different textures using GLSL. multiple rendering target was it called?(gl_FragColor[0] and [1] method). everything works fine up to here. but now i want to do some processing on second texture and then blend them together, but.. how? i don't know where to begin. do i just create a quad shaped polygon and draw the textures and blend two textures on the quad? so entire game i'll be looking at this quad and fbo is changing texture constantly? is that how it works? it did sort of work this way but i'm not sure this is the correct way of doing it. and seems really slow too. argh rendering to texture i understand, but i don't know how to display it on to screen. really would appreciate help on this :( thank you | ||||
|
deathkrush Member since: 4/28/2006 From: Agoura Hills, CA, United States | ||||
Full screen quad is the way to go. You can display a render texture to the screen by binding this texture and drawing a full screen quad into the framebuffer. If it seems slow, there are a few methods to speed it up. First is to move blending from the pixel shader to the ROP. How are you doing blending, in the shader or by using fixed-function blending (glBlendFunc)? Moving operations to the ROP might help because it distributes work across different units (ROP works in parallel with the shader unit). Second is to use alpha testing whenever possible, for example if for certain areas post processing doesn't change the pixel color. Third is to minimize the number of passes. Say, your post processing works like this: draw to texture A draw to texture B blend A and B into texture C draw C into framebuffer (to display) You can improve it by eliminating extra passes: draw to texture A draw to texture B blend A and B into framebuffer or how about: draw to texture A draw to framebuffer and blend whatever you draw into texture B with texture A deathkrush PS3/Xbox360 Graphics Programmer, THQ. Completed Projects: Stuntman Ignition (PS3) | ||||
|
w0nd Member since: 3/31/2006 From: seoul, Korea, Republic of | ||||
oh thank you for replying! :D ok. so.. what i'm doing is sort of correct. using the quad to draw the textures. hmm... ROP.. sounds.. interesting. never used it before. i'm going to have to check it out. i think i'm currently using the second method from the three. blending A and B to quad in fragment shader, instead of creating texture C. could you explain how "draw to framebuffer and blend whatever you draw into texture B with texture A" works please? i couldn't understand that part. :( thank you!! | ||||
|
deathkrush Member since: 4/28/2006 From: Agoura Hills, CA, United States | ||||
Quote: I dunno what I was thinking on that one :-) But the basic idea is to get rid of redundant passes and to combine them into a single draw call. So, if it makes sense, "draw to texture B + blend A and B into framebuffer" can be combined into a single draw call by drawing into framebuffer directly and skipping "draw to texture B step". BTW, ROP stands for Raster OPerations unit. deathkrush PS3/Xbox360 Graphics Programmer, THQ. Completed Projects: Stuntman Ignition (PS3) | ||||
|
w0nd Member since: 3/31/2006 From: seoul, Korea, Republic of | |||
ah... ok. i understand now :D thanks for the help deathkrush! now i know where to start. thanks again! | |||
|
本文转自
http://www.gamedev.net/community/forums/topic.asp?topic_id=462653
- FBO question
- fbo
- FBO
- FBO
- fbo
- FBO
- fbo
- FBO
- FBO
- FBO
- FBO
- fbo
- FBO
- question
- question
- question
- question
- question
- 10 种可以节省时间的 Eclipse Europa 技术
- 最好的日历控件(ASP.NET),附源码,超酷,兼容IE、FIREFOX浏览器
- 现在重点研究ARM+linux了!
- programming blend function
- 在ibatis中Iterate属性用法
- FBO question
- 开始学习SDK
- 讲解sdk学习过程中碰到的windows.h(转)
- (转) C里函数指针用法小结
- 在Windows XP下配置Tomcat
- 类似QQ的导航条
- 转来的一个经典
- 大学生的烦恼
- 2008年的一次小纪念