newb-x-mcbe icon indicating copy to clipboard operation
newb-x-mcbe copied to clipboard

Cloudy fog effect

Open KuriMC606 opened this issue 1 year ago • 6 comments

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 avatar May 02 '24 05:05 KuriMC606

Is this possible?

KuriMC606 avatar May 02 '24 05:05 KuriMC606

Would be quite hard to make something similar to that

devendrn avatar May 02 '24 06:05 devendrn

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.

devendrn avatar May 02 '24 11:05 devendrn

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

KuriMC606 avatar May 02 '24 11:05 KuriMC606

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

1Sekon avatar May 09 '24 12:05 1Sekon

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.

devendrn avatar May 09 '24 13:05 devendrn

Partially implemented.

devendrn avatar Mar 22 '25 14:03 devendrn