Hello all,
i want to combine images (rendered frames) in this way:
suppose i have 2 images, the combined image = image1 / 2 + image2 / 2
So if u have a completely black and a completely while image, you’ll get a gray image
Now, i want to do this wit a very large number of images (eg 255).
PS: a 256 pass technique may seem rediculous to you, and you might suspect i’m a very stoopid noob, but this is not true, i’m attempting some kind of global illumination - radiosity technique. The eg 256 pass technique will be very slow (maybe 1 frame per sec) but if you compare this time (1 sec per frame) with the time a global illu solver will take to produce the image (minutes - hours), it’s a spectacular improvement.
Normal blending and framebuffer techniques wont work anymore i guess.
Suppose, if you want to render 256 images in an acc buffer with 8 bit precision, then bytes of each image are devided by 256 and acc’ed, making the resulting image black (because any byte / 256 with 8 bit precision = 0)
I’m not very acquianted with opengl acc buffers and blending stuff, but a simple program i wrote says my acc buffer has 16 bit precision, meaning i could combine 256 images withouth precision loss. For 1024 images, more precision will be lost.
I’ve made up a technique with temp buffers
it is as follows:
suppose you want to render 8 images together (these following lines can be skipped)
render 1 in buffer 1
render 2 in buffer 2
combine 1 and 2 in buffer 1
render 3 in buffer 2
render 4 in buffer 3
combine 2 and 3 in buffer 2
combine buffer 1 and buffer 2 in buffer 1
render 5 in buffer 2
render 6 in buffer 3
combine 5 and 6 in buffer 2
render 7 in buffer 3
render 8 in buffer 4
combine 7 and 8 in buffer 3
combine buffer 2 and buffer 3 in buffer 2
combine buffer 1 and buffer 2 in buffer 1
buffer 1 = final image
this technique only uses O(log2n) (with n = number of frames) buffers
so if i would like to combine 1024 images, 10 - 11 buffers would suffice, and this technique will work with eg 8 bit precision buffers
to actually combine 2 images, i could copy the buffer to a texture on a 2d plane the size of my viewport and use reg combiners or blending for example.
For the buffers i could use PBuffers (i work with geforce3)
What should i use ? I mean, is it possible to do in opengl with regulary blending and acc buffers and stuff, or should i use my way ?
greetz,
McBain