Jump to content

  • Log In with Google      Sign In   
  • Create Account

Move textures along normals?


Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
2 replies to this topic

#1   Members   

131
Like
0Likes
Like

Posted 10 August 2014 - 07:01 PM

When a texture is mapped to geometry in Blender, under "Game Properties", you can select to map the texture to "UV Coordinates", or to "Reflection". Using "Reflection" moves the object's texture along the object's normals based on the rotation of the object/camera, making a texture appear to gleam and be metallic. I am trying to do this in OpenGL. Is there a simple glEnable to do this, or will I have to move the texture based on the object and camera rotation? Thanks!



#2   Members   

2450
Like
2Likes
Like

Posted 10 August 2014 - 08:54 PM

Are you using GLSL shaders? If so, then it depends on what kind of mapping you want. If you want to treat your texture as a simple hemisphere map, then simply map a suitable 2 component swizzle of your normal from [-1, 1] to [0, 1] and pass that to the texture lookup function instead of the uv coordinates that you would normally pass. Or, for a cube map, just pass the normal without modification to the texture function.

 

If you aren't using GLSL, you will probably want to look up the function glTexGen.



#3   Members   

131
Like
0Likes
Like

Posted 10 August 2014 - 09:54 PM

Exactly what I was looking for! Thanks!






Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.