Skip to content

Commit 05581b4

Browse files
authored
Add support for orthographic rendering (#157)
1 parent beb0e64 commit 05581b4

1 file changed

Lines changed: 18 additions & 8 deletions

File tree

src/shaders/splatVertex.glsl

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,24 @@ void main() {
131131
// Compute the Jacobian of the splat's projection at its center
132132
vec2 scaledRenderSize = renderSize * focalAdjustment;
133133
vec2 focal = 0.5 * scaledRenderSize * vec2(projectionMatrix[0][0], projectionMatrix[1][1]);
134-
float invZ = 1.0 / viewCenter.z;
135-
vec2 J1 = focal * invZ;
136-
vec2 J2 = -(J1 * viewCenter.xy) * invZ;
137-
mat3 J = mat3(
138-
J1.x, 0.0, J2.x,
139-
0.0, J1.y, J2.y,
140-
0.0, 0.0, 0.0
141-
);
134+
135+
mat3 J;
136+
if(isOrthographic) {
137+
J = mat3(
138+
focal.x, 0.0, 0.0,
139+
0.0, focal.y, 0.0,
140+
0.0, 0.0, 0.0
141+
);
142+
} else {
143+
float invZ = 1.0 / viewCenter.z;
144+
vec2 J1 = focal * invZ;
145+
vec2 J2 = -(J1 * viewCenter.xy) * invZ;
146+
J = mat3(
147+
J1.x, 0.0, J2.x,
148+
0.0, J1.y, J2.y,
149+
0.0, 0.0, 0.0
150+
);
151+
}
142152

143153
// Compute the 2D covariance by projecting the 3D covariance
144154
// and picking out the XY plane components.

0 commit comments

Comments
 (0)