Hey guys,
I'm following Ben Clowards HLSL DVDs and so far I'm at DVD2 at the Specular Lighting chapter.
Here's a question I've been thinking about for a while. In my experience so far when working with shaders (both CGFX in Mental Mill and HLSL with FX Composer) when you have a texture sampler and you don't load a texture it's value defaults to 0 (right?).
As it is now in the DVD I'm implementing Specularity with both a texture, a specular color value and a gloss value. These are all later on multiplied by each other in the end. If I do not load any texture at all this breaks the whole feature since it's value will be 0. So what if I want to give the user the possibility not to load a specular texture at all to have the same uniform amount and color all over the model?
Is there a way to check if a texture has been loaded? Couldn't I then with a simple if statement set this color to 1 if no texture is loaded?
Thanks.
Replies
Yeah I used that very same workaround when I was working with Mental Mill. Just thought maybe it could be handled more nicely
the ?: translates to 1 asm instruction