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 MeshRenderer'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.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
58 People are following this question.
Multiple Cars not working
Distribute terrain in zones
Triggering candle lights on with Colliders
Marching cubes terrain, is this properly lit?