Lava - maphew/SARndbox GitHub Wiki
The water effect is achieved by a GLSL fragment shader, whose source code is in SurfaceAddWaterColor.fs
in the SARndbox package’s shader directory, share/SARndbox-<version>/Shaders
.
To switch the water to appear as lava (this only affects appearance, not behavior), change the following lines in the source file:
Uncomment line 170:
float colorW=max(turb(vec3(fragCoord*0.05,waterAnimationTime*0.25)),0.0); // Turbulence noise
Comment out line 177:
// float colorW=pow(dot(wn,normalize(vec3(0.075,0.075,1.0))),100.0)*1.0-0.0;
Comment/uncomment lines 179 and 180:
// vec4 waterColor=vec4(colorW,colorW,1.0,1.0); // Water
vec4 waterColor=vec4(1.0-colorW,1.0-colorW*2.0,0.0,1.0); // Lava
Then save the source file. If the AR Sandbox is already running, the change will take effect immediately; otherwise, it will take effect when the SARndbox executable is started the next time.
To go back to water-colored water, reverse the steps above.
vec4 waterColor=vec4(0.0,0.0,1.0,1.0); // Blue
The first three components of the vector are red, green, and blue components, each from 0.0 (off) to 1.0 (full on). The fourth component is opacity, and should be left at 1.0. To get white:
vec4 waterColor=vec4(1.0,1.0,1.0,1.0); // White
Toxic waste would be:
vec4 waterColor=vec4(0.2,1.0,0.2,1.0); // Toxic waste
-- Oliver, http://lakeviz.org/forums/topic/ar-sandbox-mostly-complete-few-questions-left/#post-1440
Another option is to create two copies of the shader file, say SurfaceAddWaterColor-Water.fs and SurfaceAddWaterColor-Lava.fs, make the above changes in the second file, and then use a script on an icon or hotkey to copy either file onto the one that’s used by the Sandbox, such as
$ cp SurfaceAddWaterColor-Lava.fs SurfaceAddWaterColor.fs
to set “lava mode,” and
$ cp SurfaceAddWaterColor-Water.fs SurfaceAddWaterColor.fs
to set “water mode.”
F1 = Water
F2 = Lava
F3 = Snow
F4 = Sparkly Ice
F5 = Toxic Waste
F6 = Toggle topology
7 = Local flood (at cursor)
8 = Local dry (at cursor
9 = Flood all
0 = Dry all
Some color settings to try (edited for brevity, you can only use one at a time):
vec4 waterColor=vec4(0.2-colorW,1.0-colorW*0.2,1.0,1.0); // Ice
vec4 waterColor=vec4(1.0-colorW,1.0-colorW*0.2,1.0,1.0); // Sparkly Ice
vec4 waterColor=vec4(1.0-colorW,0.2-colorW*0.2,1.0,1.0); // Polluted Water
vec4 waterColor=vec4(0.2-colorW,1.0-colorW*2.0,0.2,1.0); // Toxic Death
-- INTPTT, http://lakeviz.org/forums/topic/ar-sandbox-mostly-complete-few-questions-left/#post-1461 http://www.interpretingtech.com/ARSandbox1/ARSB_Scripts.zip