Login | Register 
FEATURES
APPLICATIONS
DOWNLOADS
EDUCATION
BLOG
WIKI
FORUM
STORE

multiply the light diffuse contribution with texture (glsl)

Still a little green? Ask your beginner's questions here

multiply the light diffuse contribution with texture (glsl)

Postby barakooda » Wed Jul 11, 2018 10:31 am

I want to multiply the light diffuse contribution with texture
not sure how i`m go over the coordinates of that texture.
How would I define the uv ?

diffuseSum *= texture(speckle,uv);

Update:
Keith Lostracco
You need to pass your UV attributes from the vertex shader to the pixel shader. If you convert a Phong shader with a color map it will have the appropriate code.

Code: Select all
for (int i = 0; i < TD_NUM_LIGHTS; i++)
   {
      vec3 diffuseContrib = vec3(0);
      vec3 specularContrib = vec3(0);
      TDLighting(diffuseContrib,
         specularContrib,
         i,
         iVert.worldSpacePos.xyz,
         normal,
         uShadowStrength, uShadowColor,
         viewVec,
         uShininess);

      diffuseSum += diffuseContrib;
      
      if (i == 0) {

         diffuseSum *= texture(speckle,sUV.st);

      }

      specularSum += specularContrib;
   }
User avatar
barakooda
 
Posts: 531
Joined: Fri Nov 27, 2009 5:08 pm

Return to Beginners

Who is online

Users browsing this forum: Google [Bot] and 3 guests