Concentrated water mesh density

This commit is contained in:
yvt 2013-12-27 22:50:22 +09:00
parent 8ee555a700
commit 9dc90eaa8f
2 changed files with 7 additions and 2 deletions

View File

@ -48,10 +48,10 @@ float DisplaceWater(vec2 worldPos){
vec2 waveCoord2 = worldPos.xy * 0.02344 + vec2(.154, .7315);
vec4 wave = texture2DLod(waveTexture1, waveCoord.xy, 1.).xyzw;
vec4 wave = texture2DLod(waveTexture1, waveCoord.xy, 0.).xyzw;
float disp = mix(-0.1, 0.1, wave.w) * 1.;
vec4 wave2 = texture2DLod(waveTexture2, waveCoord.zw, 2.).xyzw;
vec4 wave2 = texture2DLod(waveTexture2, waveCoord.zw, 0.).xyzw;
disp += mix(-0.1, 0.1, wave2.w) * 0.5;
wave2 = texture2DLod(waveTexture3, waveCoord2.xy, 0.).xyzw;

View File

@ -638,6 +638,11 @@ namespace spades {
Vertex v;
v.x = (float)(x) * meshSizeInv;
v.y = (float)(y) * meshSizeInv;
// higher density near the camera
v.x *= v.x * v.x;
v.y *= v.y * v.y;
vertices.push_back(v);
}
}