Light with 2D sprites


How to make an AnimatedSprite2D illuminated by 3D Light? I need to use a custom material? If yes, someone can make a small material example?


I have this technique (SpriterTechnique.xml)

<technique vs="LitSolid" ps="LitSolid" psdefines="DIFFMAP">
        <pass name="alpha" depthwrite="false" blend="alpha" vs="Urho2D" ps="Urho2D" />

And this material

<?xml version="1.0"?>
	<technique name="Techniques/SpriteTechnique.xml" />
	<texture unit="diffuse" name="Urho2D/Box.png" />

I still don’t know how to figure the lighting.
What I want to achieve is exactly how the lighting affects a simple Cube or a Sphere in the editor.

Using OpenGL and DiffAlpha.xml technique seems working partially.

Basically the image is darker and probably it doesn’t get illuminated because of normal image.

I tried to add

<texture unit="normal" name="Urho2D/Box2.png" />


But the same thing…

Can you provide a reference of what effect you trying to achieve?

You can’t use normal maps on billboards in Urho right out the box. As tangent and binormal vectors are not generated for billboard mesh. You can write custom shader, to calculate tangent and binormal vectors in vertex programm.

Solved by using a plane with a material that use DiffLightMapAlpha.xml as technique.