natural-mystic-shaders
natural-mystic-shaders copied to clipboard
Clouds don't hide stars behind them
Some stars should be visible when the clouds are thin, but not all of them should be.
Same here
I tried to fix this but I couldn't find a way. The game renders stars on top of the sky plane. This is understandable for a performance reason because otherwise it has to alpha-blend the entire sky on the background, which could cause lags on low-end devices for no good reason. But since we render clouds on the sky plane layer it means we can't just alpha-blend clouds on stars. Setting the blending mode of stars to OneMinusDestAlpha
crashed the game (it doesn't seem to support GL_ONE_MINUS_DST_ALPHA
). I even tried computing the same cloud map twice in stars.fragment
to put stars behind clouds, but it didn't work because the coordinate system used in the sky plane was very different from that of stars. OCD gnashes.
I tried fixing that by drawing clouds on the cubemap and the issue had been fixed.
Also I changed
sky.material
like this:
"cubemap": {
"states": [
"Blending"
],
"blendSrc": "SourceAlpha",
"blendDst": "OneMinusSrcAlpha",
"vertexShader": "shaders/cubemap.vertex",
"vrGeometryShader": "shaders/uv.geometry",
"fragmentShader": "shaders/cubemap.fragment",
"samplerStates": [
{
"samplerIndex": 0,
"textureFilter": "Bilinear"
}
],
"vertexFields": [
{ "field": "Position" },
{ "field": "UV0" }
],
"msaaSupport": "Both"
},
Yes, the game renders the cubemap in the foreground of the sky.