Skip to content
Snippets Groups Projects
Commit ac46317d authored by Alexander Rose's avatar Alexander Rose
Browse files

fix lighting for orthographic projection close to camera

parent 2b492a5a
No related branches found
No related tags found
No related merge requests found
...@@ -269,6 +269,9 @@ function updateClip(camera: Camera) { ...@@ -269,6 +269,9 @@ function updateClip(camera: Camera) {
// set at least to 5 to avoid slow sphere impostor rendering // set at least to 5 to avoid slow sphere impostor rendering
near = Math.max(5, near) near = Math.max(5, near)
far = Math.max(5, far) far = Math.max(5, far)
} else {
near = Math.max(0, near)
far = Math.max(0, far)
} }
camera.near = near; camera.near = near;
......
...@@ -36,7 +36,7 @@ geometry.normal = normal; ...@@ -36,7 +36,7 @@ geometry.normal = normal;
geometry.viewDir = normalize(vViewPosition); geometry.viewDir = normalize(vViewPosition);
IncidentLight directLight; IncidentLight directLight;
directLight.direction = geometry.viewDir; directLight.direction = vec3(0.0, 0.0, -1.0);
directLight.color = vec3(uLightIntensity); directLight.color = vec3(uLightIntensity);
RE_Direct_Physical(directLight, geometry, physicalMaterial, reflectedLight); RE_Direct_Physical(directLight, geometry, physicalMaterial, reflectedLight);
......
...@@ -124,8 +124,8 @@ void main(void){ ...@@ -124,8 +124,8 @@ void main(void){
#elif defined(dColorType_depth) #elif defined(dColorType_depth)
gl_FragColor = material; gl_FragColor = material;
#else #else
vec3 normal = cameraNormal; vec3 normal = -cameraNormal;
vec3 vViewPosition = -cameraPos; vec3 vViewPosition = cameraPos;
#include apply_light_color #include apply_light_color
if (interior) { if (interior) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment