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!
Move textures along normals?,
Members - Reputation: 2446
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.