Wednesday, August 31, 2016

Cave lighting in Unity


I have a cave that is inside a mountain (one mesh) that I created in Blender. I would like to make the cave quite dark inside so that either the player can light it up, or it is lit up with things such as crystals. Because I have ambient light through the scene, it's proven to be quite awkward to make it dark, and removing the ambient light kinda destroys the look.



I then played around with having a separate material for inside the cave so that I can make it darker, which kinda worked, but then I noticed a big issue with shadows.


The following images is from inside the cave far from the entrance.


The first image is with the default settings for shadow distance (in this case it was 70 in the quality settings). As you can see in the image, the shadow doesn't fill the cave because of the distance.


Default


Second image is with the shadow distance turned up to make sure the cave is in darkness (not pitch black though, due to ambient lighting), this took the setting from 70 to around 500.


Increased


The problem with setting the distance so high, is that it causes artifacts on geometry outside the cave, which look nasty.



What's the best way to make a cave dark (doesn't need to be pitch black) without removing ambient lighting for the whole scene?


I was looking at similar art styles to what I am working on, and Grow Home (Unity) is basically where I am heading. They have caves which would be acceptable for what I need, but am not sure how they done it. As far as I know, they have dynamic lighting, as I believe there is a day / night cycle, so I don't think anything is baked.





Answer



Some information on the Grow Home/Grow Up art direction here if you're still interested :)


We relied very heavily on our custom Fresnel shader for... well... the entire look of the game. But it was especially important for the lighting of cave interiors. We pretty much only had one directional light in the whole game from the sun, but you're not seeing any of that here. The 'lighting' that you see in the screenshot above all comes from the Fresnel effect, which reflects the colour of the sky dome on all acute angled polys, giving you that rim-lighting effect everywhere you look.


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...