Archive 17/01/2023.

How does glsl water become transparent

Lumak

If you look at the water glsl, the final fragcolor in PS() is:
gl_FragColor = vec4(GetFog(finalColor, GetFogFactor(vEyeVec.w)), 1.0);

where alpha = 1.0.

How is the water transparent?

1vanK

Water is not transparent. Shader mix two textures: rendered scene from main camera (refractColor) and rendered scene from reflection camera (reflectColor).

You can write for test

gl_FragColor = vec4(1.0);

Lumak

Below is a pic from urho3d wikia page. There is reflection, but you can also see through the water and see the terrain.

I did figure out how to make my ocean shader use alpha. The water shader is still a mystery how the transparency happens.

1vanK

[quote=“Lumak”]but you can also see through the water and see the terrain.
[/quote]

it is texture on water plane

Lumak

Thanks, didn’t see that. It makes sense now.