Hi, All
I’ve added vertex shader to bend perspective. But after adding this shader all my point and spot lights stops working, there is no light on materials where I apply my vertex shader. Works only directional light. What the issue it can be? Thanks for help! Here is my vertex shader code.
uniform float bendX;
uniform float bendY;
uniform float cameraZ;
uniform mat4 matrix_view;
mat4 getModelMatrix() {
#ifdef DYNAMICBATCH
return getBoneMatrix(vertex_boneIndices);
#elif defined(SKIN)
return matrix_model * getSkinMatrix(vertex_boneIndices, vertex_boneWeights);
#elif defined(INSTANCING)
return mat4(instance_line1, instance_line2, instance_line3, instance_line4);
#else
return matrix_model;
#endif
}
vec4 getPosition() {
dModelMatrix = getModelMatrix();
vec3 localPos = vertex_position;
vec4 posW = dModelMatrix * vec4(localPos, 1.0);
float depth = posW.z - cameraZ;
depth *= depth;
posW.y += depth * bendY;
posW.x += depth * bendX;
vec4 mvPosition = matrix_view * vec4(posW.xyz, 1.0);
gl_Position = matrix_viewProjection * mvPosition;
dPositionW = gl_Position.xyz;
vec4 screenPos = matrix_viewProjection * posW;
return screenPos;
}
vec3 getWorldPosition() {
return dPositionW;
}
Thanks,
Maksym