PDA

View Full Version : shader with and without texture



_arts_
08-07-2011, 08:38 AM
Actually for disabling textures in my fragment shader, I add this line before calculations:



if (tex_color.xyz == vec3 (.0,.0,.0))
tex_color = vec4 (1.,1.,1.,1.);


But, of course, this is very bad and this produces the normal lighting wherever the texture fragments are all black.

I could have a lot of geometry where some of them have textures and some others don't. And I would like not to sort them regarding they have texture or not. And in another side, switching shaders too often might not be a good idea.

How do you manage textures in your shaders ? If you sort your geometry regarding texture, why, since it can break the depth sort, and other sorts. What do you suggest me to do ?

Thanks in advance.

BionicBytes
08-07-2011, 02:02 PM
You could try binding a 1 * 1 pixel White texture by default unless your objects bind their own texture. That way you can use a single shaded without the fudge you are currently employing.

_arts_
08-09-2011, 02:22 AM
This looks interresting. I'll have a look at this.

Thanks.