Hi Kenzo.

I think you are misinterpreting the last argument to the textureLod, which is an offset IIRC.

I use the following to sample the last level (which is 1 px and gives you exactly the average):

exp(texture2DLod(LuminanceSampler, vec2(0.5,0.5), 1000.0));

cheers
Sebastian









Hi,

I've managed to generate my mipmap via the hardware. But I'm guessing I don't 
have the good mipmap as the result of my tone mapping is unstable. The screen 
is brighter in a jerky manner for some position of the camera.

As below, how to create my mipmap:

Code:

osg::ref_ptr<osg::Texture2D> tex2D = 
dynamic_cast<osg::Texture2D*>(logAveragedLumTexture.get());
tex2D->setNumMipmapLevels(9);
tex2D->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR);
tex2D->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR_MIPMAP_LINEAR);




Then I'm retrieving the values of the smallest mipmap (2x2), by accessing to 
the LOD level 9 as my texture is 512 by 512 as the beginning:

Code:

// get last mipmap level as 2x2 texture
vec4 lastMipmapLevel;
lastMipmapLevel.x = textureLod(logAveragedLumTexture, vec2(0.25, 0.25), 9.0).r;
lastMipmapLevel.y = textureLod(logAveragedLumTexture, vec2(0.75, 0.25), 9.0).r;
lastMipmapLevel.z = textureLod(logAveragedLumTexture, vec2(0.25, 0.75), 9.0).r;
lastMipmapLevel.w = textureLod(logAveragedLumTexture, vec2(0.75, 0.75), 9.0).r;




I'm not sure about the way to access to my mipmap. I've tried other texture 
coordinates but the results is still unstable.

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





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

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

Reply via email to