refined shaders

- grid is now visible
- grid-points are different colored
- tesselated triangles wont get "gridded".
This commit is contained in:
Nicole Dresselhaus 2014-05-11 10:52:45 +02:00
parent a57cada945
commit 8dea8d1ed9
No known key found for this signature in database
GPG Key ID: BC16D887851A1A80
2 changed files with 15 additions and 1 deletions

View File

@ -106,6 +106,7 @@ smooth in vec3 tePosition;
smooth in float fogDist; smooth in float fogDist;
smooth in float gmix; smooth in float gmix;
in vec4 teColor; in vec4 teColor;
in vec3 tePatchDistance;
out vec4 fgColor; out vec4 fgColor;
@ -116,6 +117,10 @@ void main(void)
{ {
//fog color //fog color
vec4 fogColor = vec4(0.6,0.7,0.8,1.0); vec4 fogColor = vec4(0.6,0.7,0.8,1.0);
//grid color
vec4 grid = vec4(0.0,0.0,0.0,1.0);
//point color
vec4 point = vec4(1.0,0.9,0.1,1.0);
//heliospheric lighting //heliospheric lighting
vec4 light = vec4(1.0,1.0,1.0,1.0); vec4 light = vec4(1.0,1.0,1.0,1.0);
@ -154,4 +159,11 @@ void main(void)
fgColor = Color * mix(dark, light, a); fgColor = Color * mix(dark, light, a);
fgColor = mix(fgColor,fogColor,fog(fogDist)); fgColor = mix(fgColor,fogColor,fog(fogDist));
}
//mix onto tri-borders
float mixer = clamp(exp(1.0-50.0*min(tePatchDistance.x,min(tePatchDistance.y,tePatchDistance.z))),0,1);
fgColor = mix(fgColor, grid, mixer);
mixer = clamp(exp(1.0-50.0*min(tePatchDistance.x+tePatchDistance.y,min(tePatchDistance.x+tePatchDistance.z,tePatchDistance.y+tePatchDistance.z))),0,1);
fgColor = mix(fgColor, point, mixer);
}

View File

@ -106,6 +106,7 @@ smooth out vec3 tePosition;
smooth out vec3 teNormal; smooth out vec3 teNormal;
smooth out float fogDist; smooth out float fogDist;
smooth out float gmix; //mixture of gravel smooth out float gmix; //mixture of gravel
out vec3 tePatchDistance;
//out vec3 tePatchDistance; //out vec3 tePatchDistance;
//constant projection matrix //constant projection matrix
uniform mat4 ProjectionMatrix; uniform mat4 ProjectionMatrix;
@ -126,6 +127,7 @@ void main()
vec3 p1 = gl_TessCoord.y * tcPosition[1]; vec3 p1 = gl_TessCoord.y * tcPosition[1];
vec3 p2 = gl_TessCoord.z * tcPosition[2]; vec3 p2 = gl_TessCoord.z * tcPosition[2];
tePosition = p0 + p1 + p2; tePosition = p0 + p1 + p2;
tePatchDistance = gl_TessCoord;
//sin(a,b) = length(cross(a,b)) //sin(a,b) = length(cross(a,b))
float i0 = (1-gl_TessCoord.x)*gl_TessCoord.x * length(cross(tcNormal[0],tessNormal)); float i0 = (1-gl_TessCoord.x)*gl_TessCoord.x * length(cross(tcNormal[0],tessNormal));