Is it possible to mix 2d and 3d objects?

I’m trying to mix 2d sprites and 3d meshes together. I’d like 2d lights to affect the sprites and 3d lights to affect the meshes. This seems like it would be simple, but I can’t get it to work.

I’ve tried making the camera use the 2d renderer, but that results in 3d meshes that can’t be lit by either 2d nor 3d lights. I tried making the 3d mesh material sprite-lit-default, but that just results in an all-white mesh.
I’ve tried stacking cameras as Unity’s documentation says this is the correct way to mix 2d and 3d assets:

Camera stacking allows you to create effects such as a 3D model in a 2D UI, or the cockpit of a vehicle.

That results in an error saying that I can’t mix render pipelines, and is also called out lower on the same documentation page:

You cannot use a mix of different types of renderers (2D and 3D) for cameras in a camera stack.

I’m not sure the path forward here, but it doesn’t seem like it should be impossible to mix 2d and 3d objects and have separate lighting work.

Any pointers would be appreciated!

1 Like

What pops up in my mind is that you can control this by pass tags in your shader.For example, in URP’s default Lit shader, there’s a pass called ForwardLit:


The model with Lit shader assigned will be affected by 3d lights. There’s also a pass called Universal 2D:

The model with Lit shader assigned will be affected by 2d lights too. So if trying to create your own shader with the light mode tag you want, it’s possible to mix 2d and 3d objects and have separate lighting work.

1 Like