HDR: Fix Earth appearing to be "rounder" than normal
We have to compensate for the fact that the sky-view LUT contains the view from the camera, but the skydome remains fixed on the ground.
This commit is contained in:
parent
af29642423
commit
a00f7ddfaf
1 changed files with 5 additions and 1 deletions
|
@ -11,6 +11,10 @@ uniform mat4 osg_ModelViewProjectionMatrix;
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
gl_Position = osg_ModelViewProjectionMatrix * pos;
|
gl_Position = osg_ModelViewProjectionMatrix * pos;
|
||||||
vRayDir = normalize(pos.xyz);
|
// Get the camera height (0 being the ground)
|
||||||
|
vec4 groundPoint = osg_ModelViewMatrix * vec4(0.0, 0.0, 0.0, 1.0);
|
||||||
|
float altitude = length(groundPoint);
|
||||||
|
// Compensate for the skydome being fixed on the ground
|
||||||
|
vRayDir = normalize(pos.xyz - vec3(0.0, 0.0, altitude));
|
||||||
vRayDirView = (osg_ModelViewMatrix * vec4(vRayDir, 0.0)).xyz;
|
vRayDirView = (osg_ModelViewMatrix * vec4(vRayDir, 0.0)).xyz;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue