opengl: Decrease water detail with distance
This commit is contained in:
parent
02a026116d
commit
17fbaf5fce
1 changed files with 5 additions and 2 deletions
|
@ -6,10 +6,13 @@ uniform float waterReflection;
|
||||||
uniform float[4] waterNoise;
|
uniform float[4] waterNoise;
|
||||||
out vec4 final_color;
|
out vec4 final_color;
|
||||||
|
|
||||||
|
float getDetail(vec3 location) {
|
||||||
|
return max(min(pow(length(location - cameraLocation) * 0.002, 2.0), 0.01), 0.000001);
|
||||||
|
}
|
||||||
|
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
// TODO Increased detail near camera
|
vec3 normal = noiseNormal2d(waterNoise, unprojected.xz, getDetail(unprojected));
|
||||||
vec3 normal = noiseNormal2d(waterNoise, unprojected.xz, 0.00001);
|
|
||||||
|
|
||||||
final_color = applyLighting(unprojected, normal, waterMaterialColor, waterMaterialReflection, waterMaterialShininess, waterMaterialHardness);
|
final_color = applyLighting(unprojected, normal, waterMaterialColor, waterMaterialReflection, waterMaterialShininess, waterMaterialHardness);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue