- Home /
How to cast real time shadow from object without illuminating it?
I am trying to figure out how to cast real time shadows from an object without adding to the illumination of the object.
I have one directional light setup for the shading of my object, set not to cast shadows because it is angled and I want my shadows to be top down, not skewed into the background.
I can add a second directional light, pointing down, set it to cast shadows and get real time shadows from the object, the problem is, in order for it to cast shadows, I have to allow it to illuminate the object which messes up my shading :/
Answer by Xtro · Aug 20, 2013 at 02:13 PM
use an "unlit" shader for the object.
That would break my shading and the entire style of the game. I need to keep the shader I am currently using. So far I am seeing three options, I would like option 2:
1) The highly expensive way I would like to avoid: duplicate the object on top of itself: render the first one with my toon shader without any shadows, and then render the second one with the other directional light only (using layers) with a shader that only renders shadows.
2) Find out from someone that knows a lot about shaders if it is even possible to have one shader that takes illu$$anonymous$$ation only from one directional light and shadows only from a second directional light and figure out how to update the shader I am using.
3) Give up and use blob shadows :/
what, you said you don't need lighting on the object. if there is no lighting on it? how do you shade it ? does its shader have lighting function? can you edit the shader to remove that function ?
Sorry, I apparently wasn't very clear. I in fact have a directional light setup to illu$$anonymous$$ate the object. I need to add shadow and shadow only, from a second directional light.
I am using the Toony Colors Pro shaders from the asset store. They are heavily affected by the angle of the lighting. So I setup a directional light at an angle to create the look for the illu$$anonymous$$ation shading I want. However, that angle produces bad, stretched shadows, so I cannot allow that light to cast shadows. I ins$$anonymous$$d need to have the shadows cast from a second "light" whos only purpose is to cast shadows, adding no illu$$anonymous$$ation to the object.
I don't know much about editing shaders. A good starting point would be knowing if it is even possible to set one up such that: Light A: illu$$anonymous$$ates the object without casting shadows from it Light B: casts shadows from the object without illu$$anonymous$$ating it
hmm I think this is not possible. in software world, I never say impossible but in unity's shading system, it looks impossible to me :(
Aye, thanks for the replies though :) $$anonymous$$aybe someone else will jump in with some voodoo answer that forces it to work lol.
Anyway, in case you are curious, you can see an early WIP of the game I am working on (currently with blob shadows) here (I'll make a Unity forum thread soonish): PJ WIP