PDA

View Full Version : 'Blending' - using the accumulation buffer



Tresher
08-12-2002, 05:00 AM
I have put this question to the beginner section, but no answer was given, hence i try it here.

Ok, i have a background and one big morphing surface in front of it. Now i want that the background shines a little bit througth that object.But i dont want that the object itself is somewhat blended (means that the polys further away are seen through the polys nearer to the eye).
My idea was that maybe this could be a job for the accumulation buffer...render background -> put in buffer ,render 3d object (in opaque) mode and add it to the acc. buffer and then transfering the result to the back_color_buffer -> swap
Is this idea that i haven`t tried yet a good one, is there a better way or can you give me a good proposal how to combine the either pics in order to get the desired effect i mentioned before?

JML
08-12-2002, 05:09 AM
Haven't done this myself yet, but this should be feasible:

If you have the background in a texture, you could multitexture the object with it (blend the background as the second texture while generating the correct texture coordinates (EYE_LINEAR))

HTH

Jean-Marc

AdrianD
08-12-2002, 07:37 AM
there is no HW accumulation buffer support.
you must accumulate by yourself (render-to-texture & render screensized-polys mapped with this texture)

Tresher
08-12-2002, 08:00 AM
i am surprised that there is no hardware support for the acc. buffer. How do you know ?
Do it by myself will slow it too much down (i think) -> i need it in an animation.
Multitexturing is a good idea,but i have OpenGL 1.1 from Micros. i dont think that it supports MT (though, i have never checked it).

Overmind
08-12-2002, 10:50 AM
If you use the accumulation buffer of OpenGL, the driver will do it in software on consumer cards. Thats much to slow for an animation.

Doing it yourself doesn't mean you should read back the image and process it. You could render to texture and accumulate the image by rendering a textured quad and blending it.

Multitexturing is available with the MS OpenGL DLL if your driver supports OpenGL 1.2. You just have to load the 1.2 functions as if they were extensions (wglGetProcAddress("gl...").

Greetings
Overmind

abrodersen
08-13-2002, 01:21 AM
How about this:
1. draw the background.
2. Render the object into the z buffer (by disableing writes to the color buffer).
3. Reenable color buffer writes, enable blending, and draw the object once again (using glDepthTest(GL_LEQUAL)).

This should blend only the visible parts of your object with the background.

Anders