Jit.gl.mesh and jit.gl.material problem regarding normal mapping
Hello. I am trying to map a normal texture to jit.gl.mesh using jit.gl.material. I am able to properly map diffuse and specular, but when I try to import a normal map, the mesh just turns all black. Perhaps someone can help me with this issue. My patch is attached XD
In your patch I see you are also sending the normals from the gridshape, that might be cusing p[roblems since the gridhape is continously sending normal matrix while the material normal map seems to be loaded only once. Also what kind of normal matrix are you sending in the material?
Thanks for your reply!
I tried it without sending the normals from the gridshape to the mesh and it still was not working properly. I was sending a normal matrix which was generated from the application "Crazy Bump" Pretty sure it was just a 4 plane char matrix (I tried making it a float32 matrix and it still did not work). Also, everything works perfectly fine when I apply the the material directly to a gridshape.
I am not sure what you are trying to do but if the goal is to create a deformed surface using normals then I suggest looking into jit.gl.material's heightmap modes:
[@heightmap_mode vtf]: you can pass a height map and a normal map
[@heightmap_mode vtf_normals]: you only need a heightmap, no need for a normal map.
Heightmaps are single planes matrixes (or textures, if you use textures you need the @rectangle 0) that pass the elevation for each vertexes to the material.
You can look at the material's helpfile even though it is not great...