PDA

View Full Version : allow texture*Lod in fragment shader AND stick to the specs ?



wizzo
07-11-2005, 04:33 AM
These threads

http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=11;t=000172
and
http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=11;t=000753

seem to lead to the conclusion that I can use texture*lod in a fragment shader. Although, Tom Nuydens is using nVidia hardware (with a less strict glsl compiler) and I am running on ATI; maybe I should stick closer to the specs and "switch on" extention as Mr Bill adviced ? I didn't really understood how to do it though, so if anyone could clarify this for me please.

Thanks in advance for any hint,
wizzo

kingjosh
07-11-2005, 07:25 AM
Wizzo, are you able to use the LOD bias? This is available in the fragment shader as the third texture parameter. If you're using ATI hardware, chances are that you'll want to stick to the specification as ATI does. I would think Mr Bill's advice would be good to follow for ATI hardware ;)
If you're developing on ATI hardware, I don't believe that texture*lod is implemented in their compiler on the fragment side either (correct me if I'm wrong) so you'll need an NV card to do this. Furthermore, I'm not sure that this extension is clearly defined so I'm not sure what you'd use for extension_name in your #extension.

wizzo
07-11-2005, 08:39 AM
Concerning the bias parameter, the specs says



For a fragment shader, if bias is present, it is added to the calculated level of
detail prior to performing the texture access operation.
The problem is that I donc know how to modify the lod at will using the bias parameter :(

If I write
texture2D(colorMap, texCoord, +2);
assuming that lambda is the lod determined by the fixed pipeline, I'll have the image determined by lambda + 2, is that correct ?

About the extention I didn't found anything on the extension registry, so I dont know what to do with them

wizzo

kingjosh
07-11-2005, 11:30 AM
If I write
texture2D(colorMap, texCoord, +2);
assuming that lambda is the lod determined by the fixed pipeline, I'll have the image determined by lambda + 2, is that correct ?Correct.

About the extention I didn't found anything on the extension registry, so I dont know what to do with themThe extension for texture*DLod that Tom is using with his texture bombing demo in the fragment shader is not documented, and can not be disabled either (please correct me if I'm wrong). If you use it, however, you will have a shader that fails to compile on hardware that conforms to the OpenGL Shading Language Specification. If possible, use existing functionality such as the LOD bias. I'm sure extensions will come out soon for GLSL that are documented.

wizzo
07-12-2005, 10:01 PM
I think I'll wait for the extention to come out, because the lod I want to apply has nothing to do with the camera-surface distance, so I don't really know how to bias it.
(maybe compute my own lod and do some FPlod - Mylod + theLodIwant, hoping I computed the same lod as fixed pipeline :rolleyes: )

thanks for your answers kingjosh
wizzo