depressed-pho / natural-mystic-shaders

Shader pack for Minecraft Bedrock aliming to be as realistic as possible
Creative Commons Zero v1.0 Universal
28 stars 3 forks source link

Clouds don't hide stars behind them #34

Open depressed-pho opened 5 years ago

depressed-pho commented 5 years ago

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

pasithea2 commented 5 years ago

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

depressed-pho commented 5 years ago

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.

Rinloid commented 2 years ago

# 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.