Lighting on a Billboard

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By huny

Hi, I have a question about Lighting. (Translated from Japanese by DeepL. The grammar may be wrong.)
I would like to apply lighting to a billboard. I’m trying to make the lighting look natural, not just lit.

An example of the ideal lighting I’m aiming for is Paper Mario 64.
This billboard only gets brighter in one area where the lights are, while the rest of the billboard remains dark. This means that we need a shader that uses lights.
However, the shadow on the feet is not the shadow of the billboard, but the shadow of the circle.

In realizing this, we faced two problems.

When I set the mesh for the cast shadow to shadows only at the same location as the billboard, the billboard also receives the shadow.

So if I turn off the lighting on the billboard, I can’t handle the light information in the shader and can’t do my own lighting.

In other words, what I want to do is
I want to make it so that only certain shadows are not affected, like the physics layer.
I want to use a fragment shader or vertex shader with “render_mode unshaded;” to get the light information.
Or if there is another solution.

:bust_in_silhouette: Reply From: Wolchy

Hey! If I understand correctly, you need to keep part of the billboard unlit. For this, you can use a normal map. Add a normal map to the billboard texture, then add light. In this case, only the part of the billboard that the map allows will be illuminated.

enter image description here

If you have difficulties with creating normal maps, you can use the SpriteIlluminator application (it is paid, but there is a trial period).

Also, if you want to soften the lighting of the elements, you can use the light levels shading. A detailed tutorial on how to write and use it here: Toon Shading for 2D Sprites v1 - Godot Shaders

There is also another way. You can split your billboard into two sprites and use light masks to add or exclude elements in light groups.

enter image description here

I hope that I saw the problem correctly and could help you :slight_smile: Good luck!

Thank you for your reply and support! I may have misspoken a bit.
It’s not “the way the light hits” but "the way the shadow hits.

Please look at this image. Do you get the idea?
enter image description here
I don’t want the billboard to receive physical light and dark, but I want to add light and dark using shaders.
I know how to write shaders to a certain extent, but I’m looking for a way to handle the light information while still disabling receive shadows.

Also, Node2d has it, but Spatial, Sprite3D, etc. don’t have a Canvas item and can’t handle light masks.
If 3D nodes also had light masks, it would solve everything…

huny | 2022-01-07 04:23

Sorry, I didn’t understand that we talking about 3D from the description :frowning:

I’m not sure how to make “honest” shadows in this case because I don’t know much about 3D in Godot…

I would add one light above your character’s head and move it with him. In this case, you can turn off the shadows from other light sources to get the picture you want. But this is a bad solution. I’m sorry I couldn’t help you :cry:

Wolchy | 2022-01-14 19:06