Some tweaks
parent
07b002ee3c
commit
6dc51f6b2c
|
@ -85,12 +85,12 @@ float fresnel_dielectric(vec3 Incoming, vec3 Normal, float eta)
|
|||
void main (void)
|
||||
{
|
||||
|
||||
vec2 fragCoord = fragPos.xy;
|
||||
vec2 fragCoord = fragPos.xz;
|
||||
fragCoord = clamp(fragCoord,0.002,0.998);
|
||||
vec3 sunPos = vec3(0.0);
|
||||
sunPos.x=sin((timeOfDay-0.5)*3.14159);
|
||||
float timer = timeOfDay*1600;
|
||||
//cameraPos = eyePosition;
|
||||
cameraPos = eyePosition;
|
||||
|
||||
//normal map
|
||||
vec2 nCoord = vec2(0.0); //normal coords
|
||||
|
@ -166,7 +166,7 @@ vec2 fragCoord = fragPos.xy;
|
|||
|
||||
//fresnel term
|
||||
float ior = 1.333;
|
||||
//ior = (cameraPos.y>0.0)?(1.333/1.0):(1.0/1.333); //air to water; water to air
|
||||
ior = (cameraPos.y>0.0)?(1.333/1.0):(1.0/1.333); //air to water; water to air
|
||||
float eta = max(ior, 0.00001);
|
||||
float fresnel = fresnel_dielectric(-vVec,nVec,eta);
|
||||
|
||||
|
|
|
@ -27,12 +27,9 @@ float rand(vec2 co)
|
|||
void main(void)
|
||||
{
|
||||
gl_Position = mWorldViewProj * gl_Vertex;
|
||||
if (enableWaterWave == 1)
|
||||
if (enableWaterWave == 1.0)
|
||||
{
|
||||
int wavelength = 20;
|
||||
float waveheight = 0.4;
|
||||
int wavespeed = 50;
|
||||
int height_randomness = 1;
|
||||
float height_randomness = 1.0;
|
||||
vec4 pos2 = gl_Vertex;
|
||||
pos2.y -= 3.0;
|
||||
pos2.y -= sin (pos2.z/waterWaveLength + timeOfDay * waterWaveSpeed * waterWaveLength) * waterWaveHeight
|
||||
|
@ -54,7 +51,7 @@ void main(void)
|
|||
worldPos = vec3(mTransWorld * gl_Vertex);
|
||||
fragPos = ftransform();
|
||||
viewPos = pos - gl_ModelViewMatrixInverse[3].xyz;
|
||||
cameraPos = eyePosition;
|
||||
//cameraPos = eyePosition;
|
||||
|
||||
vec4 color;
|
||||
//color = vec4(1.0, 1.0, 1.0, 1.0);
|
||||
|
|
|
@ -27,13 +27,13 @@ void main (void)
|
|||
float height;
|
||||
vec2 tsEye = -tsEyeVec.xy;
|
||||
|
||||
if ((parallaxMappingMode==1) && (use_normalmap>0)) {
|
||||
if ((parallaxMappingMode == 1.0) && (use_normalmap > 0.0)) {
|
||||
float map_height = texture2D(normalTexture, uv).a;
|
||||
float height = parallaxMappingScale * map_height - parallaxMappingBias;
|
||||
uv = uv + height * tsEye * normal.z;
|
||||
}
|
||||
|
||||
if ((parallaxMappingMode==2) && (use_normalmap>0)) {
|
||||
if ((parallaxMappingMode == 2.0) && (use_normalmap > 0.0)) {
|
||||
const float numSteps = 40.0;
|
||||
float height = 1.0;
|
||||
float step = 1.0 / numSteps;
|
||||
|
@ -50,7 +50,7 @@ void main (void)
|
|||
}
|
||||
}
|
||||
|
||||
if ((enable_bumpmapping==1) && (use_normalmap>0)) {
|
||||
if ((enable_bumpmapping == 1.0) && (use_normalmap > 0.0)) {
|
||||
vec3 base = texture2D(baseTexture, uv).rgb;
|
||||
vec3 bump = normalize(texture2D(normalTexture, uv).xyz * 2.0 - 1.0);
|
||||
vec3 R = reflect(-eyeVec, bump);
|
||||
|
@ -58,7 +58,7 @@ void main (void)
|
|||
float diffuse = max(dot(lVec, bump), 0.0);
|
||||
color = diffuse * base;
|
||||
float specular = pow(clamp(dot(R, lVec), 0.0, 1.0),1.0);
|
||||
color += vec3(0.2 * specular * diffuse);
|
||||
color += vec3(0.1 * specular * diffuse);
|
||||
} else {
|
||||
color = texture2D(baseTexture, uv).rgb;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue