Repository navigation
Light the vanilla beacon and its beam - #66
JimmyfaQwQ wants to merge 3 commits into
Conversation
An active vanilla beacon cast no light: no built-in rule covered minecraft:beacon, and its beam rendered as an unlit surface. The core is a new built-in beacon rule, a white sphere inside the glass at the block's light level, with its Block Lights control. Vanilla's beacon is light level 15 whether or not it is active, so a block rule matches it and gets the usual terrain-light culling. The beam is lit by LightManager, which finds client-side beacons through LoadedVanillaBeacons, kept in step by a mixin on setWorld and markRemoved. For each active beacon it emits one cylinder per entry of getBeamSegments(), in that segment's colour, with a volumetric scale so the beam reads as a shaft. The lights start at the beacon's top face so they never overlap the core rule, stop at VanillaBeaconBeam.MAX_LIGHT_TOP rather than the renderer's 1024 blocks, are rebuilt only when a segment or the Beacon multiplier changes, and like the Copper Beacon's are never culled. The Beacon row in Block Lights scales the beam as well as the core. The beam glows by itself. Its translucent glow layer is a blended emitter, and its opaque core is a new EMISSIVE_CUTOUT surface mode: still alpha-tested, with the albedo as its emissive texture. A blended core dropped out wherever the beam runs through stained glass and the ray behind it reaches only sky. Refs NVIDIAGameWorks#29. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Junyu Tao <jimmyfa@jimmyfa.xyz>
|
Hey @JimmyfaQwQ that is pretty sick, and looks gorgeous! Thank you for that. Unfortunately we have to be extra careful with analytical lights usage and types. Cylinder lights especially, are notorious for being noisy, and being strong like that, it has potential to create a lot of shimmer in seemingly unrelated areas (during development we had to roll back Lanterns from using cylinder lights to be just emissive surfaces). I know this might be a bummer but, could you reimplement both the beacon beam and block as emissive surfaces only? It should still throw some decent light and look nice in primary view, only won't light up the surroundings as strongly as having an actual analytical light. Thank you again and sorry about it. |
Take main for the light-side files: the analytic beam lights and the beacon rule are dropped at the maintainers' request, so only the beam surface classification survives, moved to the versions/ layout and the Mojang mappings. Signed-off-by: Junyu Tao <jimmyfa@jimmyfa.xyz>
The beam gets no analytic light any more, so the architecture notes say how it lights instead and why. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: Junyu Tao <jimmyfa@jimmyfa.xyz>
Thanks for the detailed feedback, @Ekozmaster, and sorry for the late reply, I only saw your comment today. That makes sense, and I agree: I'll drop the analytic lights entirely, meaning both the beam cylinder lights and the beacon block light rule. The beam will stay as emissive surfaces only, with the translucent glow as EMISSIVE and the opaque core as EMISSIVE_CUTOUT. In the same update I'll also bring the branch up to current main (Mojang mappings and the versions/ layout). I'll include before/after screenshots when it's ready. |
Refs #29.
An active vanilla beacon's beam rendered as an unlit surface: its translucent glow layer was classified
TRANSLUCENTand its opaque coreCUTOUT, both lit by the scene. At night the beam is as bright as the sky behind it, so it is invisible.This change classifies the beam's surfaces as emitters. It creates no light: review asked for no analytic lights, because strong cylinder lights are noisy and shimmer in unrelated areas (lanterns were rolled back from cylinder lights to emissive surfaces during development for the same reason).
Surface.
RenderLayerUtils.surfaceModepasses abeaconBeamProgramflag (the layer's shader isRENDERTYPE_BEACON_BEAM_SHADER) toclassifySurfaceMode. For the beam, the translucent glow layer becomesEMISSIVE(a blended emitter) and the opaque core becomes a newEntitySurfaceMode.EMISSIVE_CUTOUTinrenderer-core.Submitter.
RemixEntitySubmittertreatsEMISSIVE_CUTOUTas cutout for the alpha test, uses the albedo as the emissive texture as it does forEMISSIVE, and attaches no subsurface profile. A blended core would drop out wherever the beam runs through stained glass and the ray behind it reaches only sky; the alpha-tested core stays continuous through the glass, as the unlit core did before.No light. There is no
BlockLightDefaultsrule, noLightManagerchange, and no mixin. The beacon block itself gets nothing from the mod; it glows only through whatever emission its resource pack authors. AGENTS.md gains one architecture sentence (the beam is an emissive surface, not a light) and one invariant (the vanilla beacon and its beam get no analytic light, with the shimmer reason).The branch is up to date with current
main(Mojang mappings, theversions/1.21.1/minecraft/andrenderer-core/layout). Files touched versusmain:EntitySurfaceMode.java,RemixEntitySubmitter.java,RenderLayerUtils.java,RenderLayerUtilsTest.java,AGENTS.md.Verification
.\gradlew.bat test "-PmcVersion=1.21.1" "-Ploader=fabric" --rerun-tasks: 1746 tests pass, including the two beam rows inRenderLayerUtilsTest(translucent beam layer ->EMISSIVE, opaque beam layer ->EMISSIVE_CUTOUT).lowpreset), captured with the mod's own still-shot capture from fixed poses: a flat smooth-stone platform with one plain beacon and one beacon whose beam passes through red then blue stained glass. Two poses: a wide view at noon from about 15 blocks away, and a far view at night from about 100 blocks. Themaincolumn is upstreammainat d5f4a4b; the Vanilla column is the same build with RTX off.mainPixel measurements, mean luminance (0-255) of the brightest beam columns against the median sky column in the upper part of the frame:
main(beam / sky)At night the beam goes from invisible (indistinguishable from the sky on
main) to about 2.3 times the sky; at noon all three are within a few percent of their sky.Visually: both beams glow in their segment colours, the segment above the red glass reads pink-red, and the core is continuous through the glass. The platform is no longer lit by the beam, which is expected without a light.
Pre-existing, not changed here. Viewed obliquely, a stained glass block can show sky where the stone wall behind it should be, with the same vertical gradient as the sky outside; head-on it shows the wall. This happens on
maintoo. Stained glass is a solid refracting cube (BlockTextureManager.buildAtlasTransMaterialInfo:MaterialInfoTranslucentEXT, IOR 1.52, nothinWall). SettingthinWall(0.0625f)locally made the artifact disappear, but also left the glass almost colourless, so fixing it needs its transmittance retuned and belongs in its own change, tracked in #67.🤖 Generated with Claude Code