[osg-users] Mip Maps

Robert Osfield robert.osfield at gmail.com
Thu Jan 19 00:13:18 PST 2017


Hi David,

There shouldn't be any need to call allocateMipmapLevels() as for most
usage cases the OSG will do what is required, all you need to do is
set up the Texture::setMagFilter(osg::Texture::MIN_FILTER,
NEAREST_MIPMAP_LINEAR).  Calling allocateMipmalLevels() doesn't for a
texture to use mipmapping if the filter level isn't set, and is just a
hint to rebuild the mipmaps, so not required if you are just assigning
a load static osg::Image to the texture.

Robert.

On 19 January 2017 at 00:22, David Heitbrink <david-heitbrink at uiowa.edu> wrote:
> I having an issue with rendering models with mip maps, when I render my scene I get some strange aliasing on text in the texture.
>
> I am mostly using DDS files, some texture have mip maps, some do not. If they do not have a mip map defined I am setting:
>
> texture->allocateMipmapLevels();
>
>
> So to test this I added some test code to my shaders to manualy cycle through the mip map levels (FrameNum is a uniform that is incremented every frame):
>
> Code:
>
> vec4 texel = texture2D(TextureId,TexCoord[0]);
> int txtLvl = textureQueryLevels(TextureId);
> int lvl ;
> if (txtLvl > 1){
>     lvl = (FrameNum/10) % txtLvl;
>     texel = textureLod(TextureId,TexCoord[0],float(lvl));
>     if (lvl == 0 ) texel.r+=0.5;
> }
>
>
>
>
> In most of my scene I am getting the red flashing every couple of seconds or so. But the texture does not blur out. In a handful of cases I have some textures that do blur out, but most do not.
>
> Does any one have any ideas on what could be causing this issue?
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=69997#69997
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



More information about the osg-users mailing list