I have been researching volumetric clouds this past week, and am wondering if anyone else has any experience working with it. I have found some open source examples/demos, but can't really wrap my head around it. As I see it ray marching is the way to go, but how that works is currently magic to me
Is volumetric clouds even feasible in a game? In my case, they would have to be easy to place out for a level designer, not be too costly on performance and look good and thick when flying through them. Anyone got any experience or ideas?
Thanks
Replies
Yesterday I've worked on a scene to study lighting, ambience and post processing and it turned out pretty good:
https://www.youtube.com/watch?v=3FVhfHvw9Ro
Don't mind the low FPS, I don't have a high-end PC and I had to record this in HD to get the sawdust particles on the record.
The scene used only 1 light source, as I didn't saw a reason to use other lights.
In more complex scenes, you can always use a good light probe (wich I didn't used in my scene) and most of the FPS related problems will go away.
More info. about the stuffs I've used can be found in the video's description.
http://shaderbits.com/blog/ue4-volumetric-fog-techniques
Something you could fly through and feel its density basically.
@Eric Chadwick That looks dope, but you can't really know if it's just trickery or actually done volumetrically(?). I have done some research these past days and I'm pretty sure doing it properly volumetric requires too much performance and is not really easy to edit (say you want a cloud in x size at y position...).
I'm currently looking at ways to fake it, looking at how they did it in The Witness. But damn, it's hard Anyone have any clue on how to modify normal directions of a mesh based on another gameobject? trying to fake this technique:
Currently I have a fragment shader, and I figured out you can access the normals through
https://www.youtube.com/watch?v=PCrc2cWDX1E
That's amazing. I spent pretty much the entire week researching raymarching and came back empty handed. It's just me taking water over my head at the moment, which is why I'm trying to "cheat" to be able to get some result and have a starting point.
Yes I have kept my eye on it, and will definitely check it out. It will probably be great to use. Right now I'm hoping to soak in as much knowledge and experience as I can, and trying not to rely entirely on others solution. With that said, I most definitely learn from looking at others solutions
Currently I'm able to change the normal directions. I have an empty gameobject and I transfer its position into the shader of the cloud, but from there I'm not sure where to go. I want the clouds normals to point outward from the gameobject (which is in the middle of the cloud). I figured some sort of raycast would solve that, so I did:
And then lerped and normalized the direction with the clouds normals (which I was told to do in the Unity forums...)
If someone knows how to do it you will see I took a few too many right turns when I should've taken a left Things that I am confused/stuck/wrong about:
- It's one minused because all faces face the wrong way. I probably shouldn't have to do that
- I have no idea how much I should lerp with, or why
- I'm still changing all of the normals in a clump (o.nDir), not per normal vertex. Maybe that is OK, though
- Not sure that the raycast is the way to calculate the outward-pointing-from-center to change the normals
Also, right now the mesh is invisible from certain angle, like so:https://gfycat.com/BrokenSpeedyAlabamamapturtle
You may also note that all normals point in the same direction, so I know that the above calculation is wrong for real. Doesn't matter where I place the center point to calculate from, it always looks the same.
EDIT: I just added a camera to the scene. Now the invisible parts of the cloud is instead black:
I was looking for a way to "fake" modified normals inside of Unity. I have since abandon that ship and did it the way The Witness did it with multiple passes (Alpha cutout for sorting + Alpha fade for smooth edges), but instead of having multiple chunks of planes making the cloud I instead use a single mesh with triplanar displacement map to give it the cloud shape.
https://www.youtube.com/watch?v=3oQVWmhgGmk&t=10s
And here you have a screenshot from my system as it is right now:
In any case, the best way may be using houdini to create a 3d texture. And use it to create you scalar field. Is the same thing the guys from Guerrilla did in Horizon.