Hello Everyone,
I am having a difficult time coming up with a relationship between light, material, and a texture inside a shader.
I have a model that has the following properties.
1.) texture
2.) material
and a world light source.
If the light is on, inside the fragment shader, I do the following
vec3 light_frag = phongADS( material );
gl_FragColor = vec4( light_frag , 1 ) * texture( sampler , uv );
This simply calculates the light fragment based on the material with an ambient, diffuse and specular component and the multiplies this by the texture fragment
However, when the light is off, and I am only dealing with a material and a texture
what is the relationship between the two?
Does one just take for example the diffuse component of the material like so...
gl_FragColor = vec4( material.diffuse , 1 ) * texture( sampler , uv );
More generally, my question is this:
Given a model ( say an AABB ) with a material, a texture and a light source, what is the proper per fragment calculation ( if light is on or off ) that takes all three into account
Thanks,
Mike