Is there a way to apply FOG to mesh only and not be visible?

Is there a way to apply fog for each mesh in a scene but not to show up in the scene background? So objects can fade to white or whatever the fog color is at z limit.

Or is there an alternate way to achieve this effect?

Only way that comes to my mind is writing a custom shader.

Hi!

Then maybe don’t set the same colour to the fog and background.

Scene is black background, fog effect requires is fade to white, if I apply a fog to the scene I loose the black background.

Yes, I think this is the way…

Alternate partial solution, which kinda works but I would need to handle alpha’s at a certain z limit is setting the items emmisive material to 0xFFFFFF.

Have you tried it?
I’ve got the result as I said in my post. Background is black, Fog is white.
изображение
https://jsfiddle.net/prisoner849/Lqpbzca2/

The only option I can think of, when you can get the fog is affecting background, is when background is an object too (like a big box or a sphere).
изображение
But in this case, you can solve it, setting fog property of a material to false
изображение

https://jsfiddle.net/prisoner849/z5ae7r4w/

2 Likes

Oh daymn…
I do have a massive plane close to or after fog limit lol, completely forgot about that!

Nice 1, THERE BE FOG HERE!!!

Shifted background plane to scene2, removed emissive and presto :slight_smile:

1 Like

I believe I had the same result some time ago, unless something changed with the new versions.

1 Like

@DolphinIQ
If I remember it correctly, I’ve got that effect in this scene (with r73): Hyperspace
The space is just two tubes, so with current implementation you would see a hole behind the starship, when you look at its front :slight_smile: Insteat it’s a shining.
So, yes, seems something changed :slight_smile:

2 Likes

Nice demo, I bet that decal code took a bit of working out, nice 1 :wink:

Just stripped your hyper demo down and bolted in three r113.2, works fine.
You got me tinkering with decals now lol