Light travels through Imported Blender Mesh

Godot Version

4.0.2 stable


I have imported Meshes and Lamp Models made in Blender. The light from the models appears to travel through the blender meshes and light surfaces on the other side of the mesh instead of creating shadows.

extends Node3D

var lights = []
var init = false

# Called when the node enters the scene tree for the first time.
func _ready():
	pass # Replace with function body.

# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
	if not init:
		#Initialize all Lights
		for lamp in get_children():
		#Reset lamp settings
		for l in lights:
			l.light_energy = 1
			l.rotation = Vector3(deg_to_rad(-90),deg_to_rad(90),deg_to_rad(36))
			l.light_indirect_energy = 0
			l.shadow_enabled = true
			l.distance_fade_enabled = true
			l.shadow_normal_bias = 0
		#End Initialization in the process
		init = true

This is the lamp code and settings I have for the problamatic light sources. They are of the Spotlight3D node type.
Another thing I have noticed is that light that comes from my DirectionalLight3D does not appear to have light travel through these blender meshes, I only noticed the issue with the Imported Spotlights.

I have attatched an image with what it looks like in game. There is a floor of meshes in between the spotlight above and the floor below which should have no light.

Any help or insight to this issue would be greatly appreciated!

Is this meant to be a dynamic or baked light?

1 Like

I think it is meant to be baked as these light sources will be static in the scene and unmoving.
I switched the light_bake_mode on all the lamps by adding this line in the for loop:

l.light_bake_mode = 1

The problem still perists with this change, but hopefully this gives more information.

I have an update on the situation:
I decided to just use the model from blender and instead created a seperate godot light instead of using the blender imported light.
I am not sure how these lights differ, but it has appeared to solve the issue and the lights no longer travel through the meshes.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.