Same texture in more texture units

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
kubatp
Gnome
Posts: 368
Joined: Tue Jan 06, 2009 1:12 pm
x 43

Same texture in more texture units

Post by kubatp »

Hi,
I have been searching for more information about using same texture in more texture units in one material. I am interested in filtering and mipmaps only. I need to use a texture in my shader with filtering and mipmap on one place and without filtering and mipmap on another place (I need precise value). The only thing I found is:
The ’numMipMaps’ option allows you to specify the number of mipmaps to generate for this texture. Note that if you use the same texture in many material scripts, the number of mipmaps generated will conform to the number specified in the first texture_unit used to load the texture - so be consistent with your usage.
in here
http://www.ogre3d.org/docs/manual/manual_17.html
My question is - is it somehow possible to control (in shader) which mipmap is used? What about filtering? Is it also per texture or texture unit?

I should point out that I am still using ogre 1.7.4 (MOGRE wrapper).

Thank you.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: Same texture in more texture units

Post by dark_sylinc »

Yes and no.

OpenGL puts most of these settings in the texture, Direct3D puts these settings in the texture unit. So, in GL you won't be able to achieve what you want unless you duplicate the texture, D3D will just work.

Only much later OpenGL added the ability to put them in texture units (via the extension GL_ARB_sampler_objects), which Ogre 1.x does not use (Ogre 2.1 does use it, in fact requires this extension).
kubatp wrote:My question is - is it somehow possible to control (in shader) which mipmap is used?
Without a shader (fixed function pipeline), you can use mipmap_bias.
When using shaders, you should use tex2DLod (HLSL/Cg) and texture2DLod (GLSL) and specify the mipmap explicitly.
kubatp
Gnome
Posts: 368
Joined: Tue Jan 06, 2009 1:12 pm
x 43

Re: Same texture in more texture units

Post by kubatp »

Perfect, this is exactly what I needed to know.
Thank you very much Dark Sylinc!
Post Reply