Unlit material casts shadows on some meshes

Hi there,

My GOAL is to use an unlit material AND have shadows cast. I know that this, by default, is a bit of a contradiction. I do know, however, that it’s certainly possible in some way. I haven’t gotten around to figuring out the rendering behind it (custom shader, maybe rendering?), but that’s not my question.

I have a material. When I set this material to be unlit, it continues to cast a shadow (while remaining unlit) on SOME objects. If I apply the same material to a different object, the shadow disappears.

I guess my question really is “why?” and “can I make this happen on command?” Because I really do like the outcome, it’s (almost) what I actually want from rendering, excluding the fact that unlit materials still won’t receive light.

I suspect that it might be a bug, because most other threads on the subject of unlit material shadow casting have at least one comment along the lines of “unlit materials can’t cast shadows because they’re unlit.” I have an unlit material doing just that, but only on certain meshes.

I guess in the end it’s a moot point since in order to have my “unlit” cel shade materials accept light and cast shadows, I’ll probably need to dip into some HLSL (I know it’s possible because Dead Static Drive does exactly that. They messed with the renderer though I think. Seems like it should be possible in just a custom node with HLSL…?) Still though, since I’m working on a pretty tight time schedule, it would be nice to be able to use unlit materials that can at least cast shadows in the interim.

Any help on this would be super appreciated :slight_smile:

maybe most simple way will be if you can turn off the visibility of the light only for the player.
if you want only 1 object to cast shadow then maybe create also invisible walls (without collision) around from the invisible emmisive sun to the object it self, the only problem is if something is on the way the object will get a shadow on his back himself.
i dont know how to make something work only for 1 object .
else i think you can do maths from invisible object passing distance to the one you want to be casting shadow until next objects tracing the line/cone and then either find a way to modify the desired color in range (darken it) or if you are not very picky u can make new spawns of shadows there - very flat small semi transparent meshes, made of squares probably so you can fill the space and keep them without collision
i suggest you update the shadow meshes respawning time to be not super small to avoid lag, or try using the event tick - this one dont cause lag i think

edit: I am browsing some things and just found this. see if it can help you Unlit material that casts shadows - Rendering - Epic Developer Community Forums