devendrn / newb-x-mcbe

A custom vanilla RenderDragon shader for Minecraft Bedrock
https://devendrn.github.io/newb-shader
MIT License
84 stars 43 forks source link

Cloudy fog effect #17

Open KuriMC606 opened 2 months ago

KuriMC606 commented 2 months ago

New fog type with nlRenderVolFog function, uses ray matching on this fog to appear randomly and move on the map, similar to Rain Mist and this photo Volumetric-ground-fog

KuriMC606 commented 2 months ago

Is this possible?

devendrn commented 2 months ago

Would be quite hard to make something similar to that

devendrn commented 2 months ago

This is a good suggestion, but I'm not sure how the result will turn out to be. Two ways I think this could be implemented are:

Approach 1 (Realistic):

  1. Use worldPos and cPos to somehow get tiledWorldPos.
  2. Create a 3D tiled noise pattern (add linear waves to get motion)
  3. Add fog fade to 3d noise
  4. Raymarch volumetrics
  5. Mix with actual fog

Approach 2 (Just fake it):

  1. Make some good looking noise pattern
  2. Add it to fog

Approach 1 isn't really suited for this shader, but it's possible.

KuriMC606 commented 2 months ago

I think you add it and add a config line to toggle between the two approach and turn it on and off

1Sekon commented 2 months ago

does Approach 1 is possible to do in vertex shader? i know noise is possible but how about for() function?

devendrn commented 2 months ago

Approach 1 is possible to do in vertex shader?

Yes, its possible. But it will look a little weird when you move because of interpolation. As example, look at the cloud/aurora reflection on water in this shader.

how about for() function?

Yes you can use any control statement in vertex shader. See GLES 2.0 Reference card to understand GLSL more.