- Home /
How do I make things fade into the distance?
I have a game where the player stays at the centre of the game world. There are then a number of characters that approach it from all angles. I want to be able to do it so it looks like they're coming into view from darkness. It should be gradual lighting of the characters, rather than them just appearing into view.
Putting a spotlight at the top doesn't work as it's only lighting the top of the characters. There doesn't seem to be any attenuation of the point light.
What's the best way of achieving this effect? Bear in mind that I have zero confidence with shaders.
Without meaning to sound facetious, you need to build up your confidence with shaders. It's one line to make an object's alpha fade with its depth. Failing that, have you considered global fog?
You can always use the Update functioln or a Coroutine to set the $$anonymous$$eshRenderer's material color's alpha value to a value that is calculated from the distance between the object and the world center.
Yep. I think alpha channel is the way to go with this. I did try the global fog but couldn't figure out how to set it up correctly. The lack of detail in the scene at the moment makes it difficult to see what's happening when I set the fog.
Besides, in the past I've tried setting the fog but it doesn't work on some devices - most notably Windows Phone.
Answer by Morozov_5f · Jan 12, 2016 at 09:21 AM
I think, you are looking for fog. You can enable it in Lighting window (open via Window->Lighting).
Menu looks looks that:
You can play with params to make your game look awesome :)
That's what I used on previous projects and it looked cool - until I tested it on Windows Phone. Seems my Lumia 925 doesn't support a high enough shader level. :( It's what I use as my primary testing platform as deployment is simple.
Fog would have been perfect but I think I'll go with Alpha. For now at least.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Way to have 2D Sprites lit by Lights? 3 Answers
Application.LoadLevel() changes lighting for some reason? 12 Answers
Bloom in a 2D game on iOS? 1 Answer