Search Unity

Question Lighting 2D sprites in 3D

Discussion in 'General Graphics' started by Bannanaking3, Jan 27, 2023.

  1. Bannanaking3

    Bannanaking3

    Joined:
    Jun 21, 2022
    Posts:
    121
    This has been a major headache for a minute for me, I really don't know where to take this problem from here. I have an enemy in a game I'm working on where the enemy has an empty parented to it, and that empty has a sprite renderer(I'm trying to make the doom 2.5d type look). for some reason I can't begin to fathom with a few days research, the sprite does not take light how I'd expect. Here are my issues broken down:
    1: the sprite seems to be taking light from the back to light the front, so when it's on the edge of a point light, it's dim, but when it's just past the middle on the other side, so the light should be hitting it on the front directly, it's black.
    2: this may be a symptom of the previous issue, but it doesn't take light from my character's flashlight, which is a realtime spotlight.
    3: I don't want to use a quad with a transparent/cutout shader because that (I think) will make animating this thing a lot more difficult.

    So Ideally, here's how I'd like it to work; the sprite is lit correctly, taking light from the front, including from a flashlight, and maybe possibly it casts shadows, all still as a sprite, rather than a quad or something else that'll make it harder to animate.