Jump to content

[1.19.2] [Solved] How to apply a custom shader to all blocks in a specific chunk?


Recommended Posts

Posted (edited)

I've been playing around with how chunk rendering works, and found how to conditionally render specific chunks with this code:

https://pastebin.com/5UzA0s1F

This code prevents the rendering of all chunks outside of a 30 block radius around a specific mob type. However, my end goal is to just apply a shader to show those chunks are out of range, rather than just not render them at all - something simple like painting them all black or changing it to monochrome. I believe I'd have to write a fragment shader (.fsh) for this which I've done before but only in isolation, playing around with this editor here: https://patriciogonzalezvivo.github.io/glslEditor/. I am assuming here that the shader I write can get an input of the original colour of each pixel which I can then modify.

Does Forge provide this compatibility and if so, how can I go about registering and applying the shader in code once it's been written?

Also, I don't think I'm going worry about rendering entities or block entities in these "dark" chunks so hopefully that simplifies this.

EDIT: nevermind, I found a solution that doesn't require shaders - since I just want to darken the chunks and not apply any complex effects, I realised I can just mixin ModelBlockRenderer and change the lightmap values.

Edited by SoLegendary
  • SoLegendary changed the title to [1.19.2] [Solved] How to apply a custom shader to all blocks in a specific chunk?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.