Skip to main content
GameDev.net gamedev.net
🔒 Locked

Can this be done in one rendering pass?

Started by Omnipotent Dec 23, 2004 at 10:25 PM 3 replies 1k views
Original Post
Omnipotent
Omnipotent
Hi All, The effect I am trying to achieve is a dirty window. Basically I have a quad with a texture on it and then I have another texture which is just an 8bit(alpha) texture describing where the smears are on the window. Now I don't want to just use the alpha texture as my alpha lookup (that creates smears on the texture). Right now I can achieve the look by rendering just the alpha first with the alpha texture as my lookup which dims all my objects outside the window and then render my transparent window texture. Any ideas on how to achieve this in one pass without making the smears show up on the window texture? Thanks, Omnipotent
soconne
soconne
Are you using OpenGL or DirectX ?

If you are using OpenGL, you want to use register combiners. Basically a bunch of calls to glTexEnvi
Author Freeworld3Dhttp://www.freeworld3d.org
jdi
jdi
From a mathematical point of view, what operations are you doing for each render pass?

It's hard for me to say whether or not you can do it in one pass if I don't know exactly what you're trying to do, but it sounds like in the first pass you are doing framebuffer *= src_alpha and in the second pass you are doing framebuffer = framebuffer + src * src_alpha. If you're using vanilla OpenGL, it's easy to reduce this to one pass. Probably doable in DirectX, but I'm not an expert there.

Anyway, if that isn't exactly what you want to do, please clarify what is.

j
Omnipotent
Omnipotent
That is the correct math that I am trying to achieve. I just can't seem to figure out how to make this work in one pass when you want the src alpha value to remain constant and then the destination alpha to be variable.

Thanks for the help
jdi
jdi
Well, if you're doing framebuffer *= src_alpha in the first pass and framebuffer = framebuffer + src * src_alpha in the second pass, it's the same as framebuffer = framebuffer * src_alpha + src * src_alpha in one pass. If you're using OpenGL, just combine your alpha texture with your original texture and set a framebuffer blending mode of SRC_ALPHA, SRC_ALPHA. In DX, it would be a similar idea, but again, I don't know the exact way to do that.

j

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.