- Home /
Objects affected by fog at different distances
I'm curious if there is a method people use to make objects affected by fog at varying distances.
Currently all my objects are affected by global fog and thus disappear into fog at the same distance away from the camera. Let's assume this is 100 meters. However, I'd like some objects to be affected by fog, so that the distance that they fade into the fog is much further away (hence being able to see the silhouette of them from afar). Let's assume this distance is 1000 meters.
In essence, I'm trying to create large objects that can be seen from a far distance away, that are affected by fog differently than the local objects that are near the camera.
I know how to make objects not affected by fog at all, but I'm struggling to determine how to make objects affected by fog when at different distances.
Any thoughts on how I might achieve this?
Thanks in advance!
Bump. After further reading it seems that it might be able to be done with a customized fog shader. Can someone point me toward an example of something like this?
The only way I can think of doing this involves using a custom shader on every object that you want to be affected by fog, which is a bit impractical. (The shader itself would just be a matter of calculating distance to the camera, then blending the object's color with a fog color with an amount depending on that distance and from what distance you want it to blend).