Added: 4 years ago
From: Webking271
Views: 248
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (6)

Sign In or Sign Up now to post a comment!
  • sorry for the double post, did a mess :p

  • Hey man thanks for the help! What I ended up doing was isolating the camera matrix from the model view matrix and only multiplying it in during the gl_Position call to translate the vertex in the shader. I rewrote my light model code.

  • Right now I need to work on my object class a bit more so that I'm actually using the correct tangent and binormal vectors for my faces instead of my current tangent space vector hack. I've been reading more about coordinate system transforms and basis vectors which has helped a lot. I'll throw up some new videos once I make more progress with this. By the way, where did you get all of those textures and normal maps at for your demos? I need some more artwork for my demos! :D

  • Actually I just spent a lot of time on google searching for the color maps :p

    for the normal and displacement maps generation I've used Crazy Bump and ATI normal map generator, they're for free, check them out :)

  • I had a look at your code, try to calculate the light direction in this way:

    v.x = dot(gl_LightSource[0].position­, tangent); v.y = dot(gl_LightSource[0].position­, binormal); v.z = dot(gl_LightSource[0].position­, normal);

    since u're using gl_LightSource.pos u don't need to multiply for the modelview matrix since u are already gettin the light position in world coords

    hope it helps

  • probably you're setting the light position at each frame after the camera modelview transformation, I've had a look at your code, when u calculate the transformed light position components try to use this formula v.x = dot(gl_LightSource[0].position­, tangent);

    instead of the ones u used multiplying for the modelview matrix(since you're using gl_LightSource.position u're gettin the light pos already in world coords).

    Do the same for v.y and v.z of course.

    hope it helps

  • Dude you gotta transform the tangent and binormal the same way you usually transform the normal in the vertex shader. Otherwise, the transformation matrix of the object is not considered. I had the same problem.

  • By the way that's a super cool usage of normal maps haha.

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more