From 47a8ec2895e8238c2e60b3cc3d27f038e4aef04d Mon Sep 17 00:00:00 2001 From: melancholytron Date: Sun, 1 Mar 2026 12:41:21 -0600 Subject: [PATCH] Create fresh material in webcam_display instead of duplicating Co-Authored-By: Claude Opus 4.6 --- scripts/webcam_display.gd | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/scripts/webcam_display.gd b/scripts/webcam_display.gd index 1b254a1..dae667d 100644 --- a/scripts/webcam_display.gd +++ b/scripts/webcam_display.gd @@ -18,24 +18,18 @@ var _has_received_frame: bool = false func _ready() -> void: - # Get or create the material — duplicate to ensure each instance has its own - _material = material_override as StandardMaterial3D - if _material != null: - _material = _material.duplicate() as StandardMaterial3D - material_override = _material - else: - _material = StandardMaterial3D.new() - material_override = _material - - # Configure material for unlit display (no scene lighting affects the webcam feed) + # Always create a fresh material — instanced scenes share sub_resources, + # so we must not reuse the scene's material or all quads show the same texture + _material = StandardMaterial3D.new() _material.shading_mode = BaseMaterial3D.SHADING_MODE_UNSHADED _material.albedo_color = default_color _material.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA + material_override = _material # Create initial texture (will be replaced on first frame) _texture = ImageTexture.new() - print("[WebcamDisplay] Ready, waiting for frames...") + print("[WebcamDisplay] %s ready, waiting for frames..." % name) func _process(delta: float) -> void: