Re: [osg-users] Mip Maps

2017-01-19 Thread David Heitbrink
Thanks, this seems to mostly fix my issue. The texture filtering should have 
already been set for the model, but it looks like along the way,  things that 
were supposed to be NEAREST_MIPMAP_LINEAR were getting set to LINEAR.

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





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


Re: [osg-users] Mip Maps

2017-01-19 Thread Robert Osfield
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  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@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


[osg-users] Mip Maps

2017-01-18 Thread David Heitbrink
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@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org