mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2024-11-22 22:05:38 +00:00
Calculating the length of the vertex results in quite broken values for fogging when the vertices are traversing the view frustum. The hardware also wouldn't have been doing a square root per vertex for fogging. Simply using the z values is enough. Todo check clamping of values for the near/far planes.
This commit is contained in:
parent
2786d95795
commit
a3e2fb7906
|
@ -43,7 +43,7 @@ void main(void)
|
||||||
{
|
{
|
||||||
fsViewVertex = vec3(gl_ModelViewMatrix * inVertex);
|
fsViewVertex = vec3(gl_ModelViewMatrix * inVertex);
|
||||||
fsViewNormal = (mat3(gl_ModelViewMatrix) * inNormal) / modelScale;
|
fsViewNormal = (mat3(gl_ModelViewMatrix) * inNormal) / modelScale;
|
||||||
float z = length(fsViewVertex);
|
float z = -fsViewVertex.z;
|
||||||
fsFogFactor = fogIntensity * clamp(fogStart + z * fogDensity, 0.0, 1.0);
|
fsFogFactor = fogIntensity * clamp(fogStart + z * fogDensity, 0.0, 1.0);
|
||||||
|
|
||||||
fsDiscard = CalcBackFace(fsViewVertex);
|
fsDiscard = CalcBackFace(fsViewVertex);
|
||||||
|
|
Loading…
Reference in a new issue