cpu projection inverse
This commit is contained in:
+2
-2
@@ -46,9 +46,9 @@ public class SSAOShader extends AbstractShaderRenderer
|
||||
MC_RENDER.getTargetFrameBufferViewportWidth() / (float) MC_RENDER.getTargetFrameBufferViewportHeight(),
|
||||
RenderUtil.getNearClipPlaneDistanceInBlocks(partialTicks),
|
||||
(float) ((RenderUtil.getFarClipPlaneDistanceInBlocks() + LodUtil.REGION_WIDTH) * Math.sqrt(2)));
|
||||
|
||||
|
||||
|
||||
this.shader.setUniform(this.shader.getUniformLocation("gProj"), perspective);
|
||||
this.shader.setUniform(this.shader.getUniformLocation("gProjInv"), perspective.invert());
|
||||
this.shader.setUniform(this.shader.getUniformLocation("gSampleRad"), 3.0f);
|
||||
this.shader.setUniform(this.shader.getUniformLocation("gFactor"), 0.8f);
|
||||
this.shader.setUniform(this.shader.getUniformLocation("gPower"), 1.0f);
|
||||
|
||||
@@ -9,6 +9,7 @@ uniform float gSampleRad;
|
||||
uniform float gFactor;
|
||||
uniform float gPower;
|
||||
uniform mat4 gProj;
|
||||
uniform mat4 gProjInv;
|
||||
|
||||
const int MAX_KERNEL_SIZE = 32;
|
||||
const float INV_MAX_KERNEL_SIZE_F = 1.0 / float(MAX_KERNEL_SIZE);
|
||||
@@ -20,8 +21,7 @@ vec3 calcViewPosition(vec2 coords) {
|
||||
vec4 ndc = vec4(coords.xy, fragmentDepth, 1.0);
|
||||
ndc.xyz = ndc.xyz * 2.0 - 1.0;
|
||||
|
||||
// TODO: This inverse() call should be moved CPU side
|
||||
vec4 vs_pos = inverse(gProj) * ndc;
|
||||
vec4 vs_pos = gProjInv * ndc;
|
||||
return vs_pos.xyz / vs_pos.w;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user