Skip to content
Snippets Groups Projects
Commit 894ceabb authored by Alexander Gauggel's avatar Alexander Gauggel
Browse files

[#70] Lighting fix

parent 7077401d
No related branches found
No related tags found
1 merge request!57Resolve "Basic voxelization"
...@@ -16,7 +16,7 @@ layout( push_constant ) uniform constants{ ...@@ -16,7 +16,7 @@ layout( push_constant ) uniform constants{
void main() { void main() {
gl_Position = mvp * vec4(inPosition, 1.0); gl_Position = mvp * vec4(inPosition, 1.0);
passNormal = inNormal; passNormal = mat3(model) * inNormal; // assuming no weird stuff like shearing or non-uniform scaling
passUV = inUV; passUV = inUV;
passPos = (model * vec4(inPosition, 1)).xyz; passPos = (model * vec4(inPosition, 1)).xyz;
} }
\ No newline at end of file
...@@ -360,7 +360,7 @@ int main(int argc, const char** argv) { ...@@ -360,7 +360,7 @@ int main(int argc, const char** argv) {
vulkanCorrectionMatrix[3][2] = 0.5; vulkanCorrectionMatrix[3][2] = 0.5;
projectionLight = vulkanCorrectionMatrix * projectionLight; projectionLight = vulkanCorrectionMatrix * projectionLight;
const glm::mat4 viewLight = glm::lookAt(glm::vec3(0), -lightInfo.direction, glm::vec3(0, -1, 0)); const glm::mat4 viewLight = glm::lookAt(glm::vec3(0), lightInfo.direction, glm::vec3(0, -1, 0));
lightInfo.lightMatrix = projectionLight * viewLight; lightInfo.lightMatrix = projectionLight * viewLight;
lightBuffer.fill({ lightInfo }); lightBuffer.fill({ lightInfo });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment