Weird lighting when translating object Hello everyone, About a month ago I finished programming the lighting (or at least it is what I thought), because a few hours ago I realized that when I translate the object, the lighting breaks (not when rotating, because I multiply the normals by the transpose of the inverse of the modelMatrix), only if I move the object from the 0,0,0. I only have one light, a directional one. Here the rock is at 0,0,0. T Here the rock is at -10,0,0. I only moved it to the left, and as you can see looks like the normals are wrong, but I do not touch them, except when I multiply them by the transpose of the inverse of the modelMatrix (if I do not multply the normals by that matrix the lighting doesnt break but when the object rotates the light rotates with it). So, is there a way to have the normals well for translating and rotating? Now I can translate the object and the lighting doesnt brake, but if I rotate it the light rotates with it. Now I can rotate it but if I move it the lighting breaks. Thanks a lot!! https://ift.tt/eA8V8J
Hello everyone, About a month ago I finished programming the lighting (or at least it is what I thought), because a few hours ago I realized that when I translate the object, the lighting breaks (not when rotating, because I multiply the normals by the transpose of the inverse of the modelMatrix), only if I move the object from the 0,0,0. I only have one light, a directional one. Here the rock is at 0,0,0. T Here the rock is at -10,0,0. I only moved it to the left, and as you can see looks like the normals are wrong, but I do not touch them, except when I multiply them by the transpose of the inverse of the modelMatrix (if I do not multply the normals by that matrix the lighting doesnt break but when the object rotates the light rotates with it). So, is there a way to have the normals well for translating and rotating? Now I can translate the object and the lighting doesnt brake, but if I rotate it the light rotates with it. Now I can rotate it but if I move it the lighting breaks. Thanks a lot!!
from GameDev.net http://bit.ly/2GBvLw0
from GameDev.net http://bit.ly/2GBvLw0
ليست هناك تعليقات