Hi, I am trying to combine deferred lighting with skybox and water reflection. However the final scene is not lit:
And here are my G-Buffer textures:
As you can see, after the albedo texture was passed into Composition Pass’s fragment shader, it gets darker. I think the problem has something to do with normal. Because in my fragment shader, the code I used to calculate Sunlight diffuse is:
float3 lightDirection = normalize(light.position); float diffuseIntensity = saturate(dot(lightDirection, normalDirection)); diffuseColor += light.color * light.intensity * baseColor * diffuseIntensity;
diffuseIntensity variable depends on the normal direction, and my skybox does not really have a normal.
My render flow is as following:
// shadow pass renderShadowPass(renderEncoder: shadowEncoder) // reflection pass. renderGbufferPass(renderEncoder: reflectEncoder) scene.skybox?.render(renderEncoder: reflectEncoder) // g-buffer pass renderGbufferPass(renderEncoder: gBufferEncoder) scene.skybox?.render(renderEncoder: gBufferEncoder) scene.water.render(renderEncoder: gBufferEncoder) // composition pass ...
So is this the correct render flow? What am I doing wrong here?