- Home /
Need a shader that allows shadows, but will not change object colour.
I imagine this has been asked for previously, but I've been searching all weekend and I can't find a thing!
This is the kind of visual style I am after, as seen on the big grey area in the middle. The game is viewed from an isometric angle, and I wanted to be able to control the colour of each side of the shape. So there is a light, mid, and dark side.
So far, I have set the ambient light in the scene to pure white, and am using coloured quads to get precise control over each faces colour. The main reason for this is because I don't like the tonal values generated by using things like directional lights. This method seems to be better for marrying the in-game scene with the Photoshop concept art.
The problem is that for a player to understand the spatial construction of each level, shadows are needed. A downward facing directional light was added, and suddenly the additive effect it has on the colours loses the art style. As you can see my light grey tone is now pure white!
What I THINK I need is a shader that allows me to get these shadows appearing on objects correctly, but without affecting the coloured quads. I have tried a bunch and nothing works. I tried making my own, but still no good.
Later on I would like to add some ambient occlusion, so I guess whatever I use also needs to work with light mapping.
A friend suggested using coloured lights to actually achieve the tonal values instead of coloured quads, but I don't really want three directional lights in a mobile game if possible.
I may even just be going about setting this all up in entirely the wrong way, so please put me right if that's the case :)
Answer by siaran · Apr 20, 2015 at 02:53 PM
Have you tried reducing the intesity of your directional light?
Yep. It does start to reveal some of that grey again, but even at 0.05 it's way too light, and then of course you lose the shadow! I need to control the colour of each face perfectly whilst allowing shadows to fall in the usual way.
Hmm, have you tried reducing the intensity of the ambient light ins$$anonymous$$d of the directional one?
That has a pretty similar outcome. It really just increases the contrast, i.e the shadows become darker along with the half-lit surfaces, but the upward faces remain really bright. This still doesn't allow me control over the surface colour in the way I want.
I have been trying to learn more about shaders, so I am going to try and write my own soon to get exactly what I want!