FBO question

导读:
  







 FBO question





  











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







 User Rating: 1000   |  Rate This User Report this Post to a Moderator | Link















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)








 User Rating: 1121   |  Rate This User Report this Post to a Moderator | Link















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!!







 User Rating: 1000   |  Rate This User Report this Post to a Moderator | Link
















Quote:



Original post by w0nd

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. :(



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)








 User Rating: 1121   |  Rate This User Report this Post to a Moderator | Link















ah... ok. i understand now :D

thanks for the help deathkrush! now i know where to start.

thanks again!






 User Rating: 1000   |  Rate This User 


本文转自
http://www.gamedev.net/community/forums/topic.asp?topic_id=462653

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值