No textures: fixed-function vs shaders

Started by
5 comments, last by ET3D 16 years, 11 months ago
I have an older app I'm revising to use shaders in place of fixed-function. One trick I used in that app was to disable texturing by assigning a NULL pointer for textures. This caused all geometry to be rendered in greyscale, making the results of lighting and shadows easy to see. However, with shaders, if no texture is assigned to a shader, the color is defaulting to black instead of white. Is this a difference between fixed-func and shaders, or am I missing some config setting? If this is an inherent difference between fixed-func and shaders, I can assign an all-white texture when in this mode. Was hoping to avoid the extra code changes that would require.
Advertisement
I'm not sure the behaviour is defined. I've seen cards return black, white, or just terminate the shader right then and there, returning whatever happened to be in R0.

Things may have matured a bit in the years since I noticed that behaviour, and something standard might now exist, but I'm not aware of any standard behaviour.
IIRC, last time I tried this, NVIDIA used white and ATI used black. The best thing to do here is to create a couple procedural 1x1 textures and use those explicitly.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.

Over here is some more info on this, but it seems fairly consistent with what's mentioned above. In addition to the tip Promit provided, this seems solid advice:

Quote:The best advice is to avoid doing this. Write your Pixel Shaders or TextureStageState setups to do what you want to do, and no more. If that means you need a different shader/TSS for the "NULL texture" case, then do it. Usually that shader/TSS will run a lot faster than using a NULL texture, and it will be a lot more predictable. This is one of those odd little corners of the D3D spec that are very badly supported - best to avoid it.
Rim van Wersch [ MDXInfo ] [ XNAInfo ] [ YouTube ] - Do yourself a favor and bookmark this excellent free online D3D/shader book!
Are you calculating lighting in your shader?
Chris ByersMicrosoft DirectX MVP - 2005
Inconsistent results across vendors.

Okay, that's the big red warning for me. So much for judging behavior based on the NVidia cards in all of my systems.

Thanks for the info.
remigius' advice is good. If you need functionality, in this case no texturing, set up your texture stages or pixel shader accordingly.

This topic is closed to new replies.

Advertisement