Use a vertical fade for the flashlight beam
Full build / Import + headless tests (push) Successful in 37s
Full build / Full desktop build + optional release (push) Skipped

A GradientTexture1D varies along U, so the cone showed a bright ring; build a
1×64 vertical ramp for UV.y instead (faint at the lens, brightest near the
start, gone before the tip). Regenerate the affected captures; headless 227/227,
compare 11 good / 0 bad.
This commit is contained in:
zwitschi committed 2026-11-01 17:06:09 +01:00
1 parent 4a672025a2
commit 3c07525351
8 files changed
+15 -7

No files matched your search

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 756 KiB

After

Width:  |  Height:  |  Size: 756 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 856 KiB

After

Width:  |  Height:  |  Size: 856 KiB

+15 -7
View File
@@ -139,13 +139,21 @@ static func light_beam() -> StandardMaterial3D:
mat.cull_mode = BaseMaterial3D.CULL_DISABLED
mat.depth_draw_mode = BaseMaterial3D.DEPTH_DRAW_DISABLED
mat.albedo_color = Color(1.0, 0.95, 0.82, 1.0)
var fade := Gradient.new()
fade.set_color(0, Color(1.0, 0.95, 0.82, 0.08))
fade.add_point(0.15, Color(1.0, 0.95, 0.82, 0.5))
fade.set_color(fade.get_point_count() - 1, Color(1.0, 0.95, 0.82, 0.0))
var ramp := GradientTexture1D.new()
ramp.gradient = fade
mat.albedo_texture = ramp
# A vertical ramp, not a GradientTexture1D: a cylinder's UV.y runs along its
# height, while the 1D gradient varies with U and would paint a bright ring.
var ramp := Image.create(1, 64, false, Image.FORMAT_RGBA8)
for y in 64:
var t := float(y) / 63.0
# Symmetric fade (bright in the middle, gone at both ends) so the look
# does not depend on which way CylinderMesh orients its V coordinate; the
# far end must never show as a bright ring.
var alpha := 0.0
if t < 0.5:
alpha = lerpf(0.0, 0.3, t / 0.5)
else:
alpha = lerpf(0.3, 0.0, (t - 0.5) / 0.5)
ramp.set_pixel(0, y, Color(1.0, 1.0, 1.0, alpha))
mat.albedo_texture = ImageTexture.create_from_image(ramp)
mat.texture_filter = BaseMaterial3D.TEXTURE_FILTER_LINEAR
return mat