Project Red 1.18: The Fabulous Lighting Update #1775
MrTJP
announced in
Announcements
Replies: 2 comments
-
I'm very excited about the return of Relocation. Many thanks! Can hardly wait... |
Beta Was this translation helpful? Give feedback.
0 replies
-
Can't wait for the 1.19.2 version, it's such an amazing mod! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The Project Red port to 1.18.2 has been more or less complete for over a week now, but while there are still some minor fixes pending on CBMulipart side, I've been taking the time to squeeze in some new features:
Project Red 1.18 Teaser
Fabulous lighting
Up first is the new lighting renderer. Now that we are no longer on an ancient version of OpenGL, light rendering is improved in two ways:
Obligatory for showing off any type of shader work, here is my Pool Room rendering :)
You can see the bloom effect giving the impression of bright light sources refracting off the lens of the camera. While Minecraft's lighting engine does not support colored lights directly, this sort of effect can go a long way to convince you otherwise, especially when up close.
Fully compatible with any light source, including multipart lights (lanterns, fixtures, cage lights, etc), and even Lamp Microblocks:
You'll even notice how the halos properly blend together, mixing their colors in both the halo itself, as well as the bloom they cast
How it works
If you don't care about the technical details about how the bloom rendering works, you may skip this section.
This was my first time messing with shaders. The actual bloom technique used here was pulled form this excellent article on learnopengl.com by Alexander Christensen on Physically Based Bloom.
The high-level summary of the technique is to render your light sources, downscale them a few times, then upscale them back to the original size to convert the original lights into blurs. Then, the blur layer can be blended back to the original frame. Note the slight deviation from the technique in the article. Original technique describes a way to lift out the bright light sources from the image by using a threshold value. This works particularly well for HDR frames, where the lights are easily distinguishable from everything else based on their total brightness value. It also brings along any bright reflections that lights are casing on other parts of the screen.
But this is Minecraft. We don't have fancy lighting engines with reflections. So simply rendering the lights to a separate frame by themselves, blurring it, and blending it back is enough for us. And by using a special light-only frame, we avoid the issue of adding softness to the entire frame (which may be desirable in some cases, but not here).
To be specific, we do 4 passes of down-sampling (cutting the resolution in half every time), and another 4 to upsample. Blending back into the original main render target is done through another shader as well, but only because Minecraft's PostChain class enforces the target to be cleared, leaving glBlend to not have any effect. The final shader receives the original target and the final blur target (after down/upsampling) as 2 samplers, and blends them together with the standard transparency blend equation directly in the fragment shader (SRC_ALPHA, ONE_MINUS_SRC). Seems weird but may be a commonly used technique, idk.
Relocation: Frames and Motors
Frames are back! Along with the awesome deep integration with CBMultipart that you have come to expect.
Hats off to the Mojang team. They have really cleaned up the Rendering system since the 1.12 days when frames were previously a part of this mod. Back then, I needed several hacks to get moving blocks to render, and even then, it was could be very glitchy at times. Now that rendering is done based off a passed-around PoseStack object, rendering can be cleanly hijacked to get the blocks to "move" on your screen, and in a way that looks very natural without rendering artifacts or glitches.
And of course, because the Lighting Bloom effect is a post-processing shader, the glow correctly follows lights as they move. You can notice the glow against the white backdrop in this video:
rgb_frame.mov
License Change
In case you haven't noticed, the License for this mod has changed to MIT. Probably doesn't have many implications for users, but there you go. Not that it was ever required, but you no longer need my permission to add this mod to any modpacks. Since this is new, the license change may not be reflected everywhere yet.
To Follow
This release will drop in the next few days. There are a few things in the works to come in a follow-up release, including:
Plan is to get the initial release out on 1.18.2, then immediately jump over to 1.19.2. After which, I'll maintain 1.18 occasionally by cherry picking bug fixes, but will be feature locked.
That's all for now..
Beta Was this translation helpful? Give feedback.
All reactions