natural-mystic-shaders icon indicating copy to clipboard operation
natural-mystic-shaders copied to clipboard

Clouds don't hide stars behind them

Open depressed-pho opened this issue 6 years ago • 3 comments

Some stars should be visible when the clouds are thin, but not all of them should be.

depressed-pho avatar Dec 28 '18 10:12 depressed-pho

Same here 03977c64-6e71-4f64-850c-3a55aca455c0

pasithea2 avatar Jan 05 '19 16:01 pasithea2

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.

depressed-pho avatar Jan 06 '19 02:01 depressed-pho

Screenshot_20210803-051139 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.

Rinloid avatar Aug 02 '21 20:08 Rinloid