Hi Harash, J.P.

J.P. Delport wrote:
> 
> I'm not sure your shader is doing a proper mean. For the GPU to do 
> mean/sum you need to do what is called a reduction. Search for reduction 
> on www.gpgpu.org. This is different from doing per pixel operations like 
> changing luminance e.g.
> 


The posted code seems to be similar to the luminance computation in the HDR 
example (quick overview over the code). Using mipmaps one can compute an 
average or arithmetic mean value, I am not aware if reduction is really needed 
here. Maybe reduction means exactly the same. To compute it I would do the way, 
you described here: using UnitInMipmapOut to crete a mipmap with the average 
value in the highest level.

What do you mean, that the values are not the same? In order to get the 
computed value out of the mipmap you have to access the last mipmap level in 
your shader. Take a look into brightpass/tonemap shader, where the last level 
with scene luminance is accessed. Also make sure that in the last level you 
access not on (0,0) position, but on (0.5,0.5), because otherwise you will get 
interpolated values. It is actually better to disable GL_LINEAR filtering for 
the textures used by the unit.

art

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=20803#20803





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to