bonjour, et donc après avoir lu le titre, et avoir vérifier la position de la lumière (ponctuelle), je me dis que c'est soit un problème de normale, soit un problème de shader, donc voici les 2 parties
calcule de la normale grâce au calcul de ma matrice model :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 quat.rotateY(entity._private.quaternion,entity._private.quaternion,degToRad(entity.options.rotation[1])); quat.rotateX(entity._private.quaternion,entity._private.quaternion,degToRad(entity.options.rotation[0])); quat.rotateZ(entity._private.quaternion,entity._private.quaternion,degToRad(entity.options.rotation[2])); mat4.fromRotationTranslation(entity.options.world, entity._private.quaternion , entity.options.translation); mat4.scale(entity.options.world, entity.options.world, entity.options.scale); mat3.fromQuat(entity.options.normalworld,entity._private.quaternion); mat3.invert(entity.options.normalworld, entity.options.normalworld); mat3.transpose(entity.options.normalworld, entity.options.normalworld);
le shader :
- vertex shader
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 attribute vec3 NORMAL; uniform mat3 Normal; varying vec3 vNormal; void main(void) { .... vNormal = normalize(Normal * NORMAL); ... }
vous voyez un soucis ou pas?? je pourrais afficher les normales mais ça me semble fastidieux à faire
Partager