Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finish Modularizing PBRTerrainUtils.glsllb #2377

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

yaRnMcDonuts
Copy link
Member

@yaRnMcDonuts yaRnMcDonuts commented Feb 20, 2025

Previously I only modularized AdvnacedPBRTerrain.j3md

But now this PR applies the same concept to PBRTerrain.j3md

I ended up deleting the PBRTerrain.frag file, so now both of the terrain's .j3md files reference the same fragment shader, but the advanced version has a define that gets set to true to tell the fragment shader to read from texture arrays instead of normal textures.

I also added suppor for metallicRoughnessAoEi maps in the regular PRRTerrain shader (Ao being ambient occlusion that is packed in blue channel, and Ei being emissiv intensity which gets packed in the alpha channel). You will still be limited to 16 textures without using texture arrays, and as always I'd suggest most people juts use the advanced version of the shader primarily, but atleast the option is there.

Previously I only modularized AdvnacedPBRTerrain.j3md

But now this PR applies the same concept to PBRTerrain.j3md

I ended up deleting the PBRTerrain.frag file, so now both of the terrain's .j3md files reference the same fragment shader, but the advanced version has a boolean called UseTextureArrays set to true to tell the fragment shader to read from texture arrays instead of normal textures.

I also added suppor for metallicRoughnessAoEi maps in the regular PRRTerrain shader (Ao being ambient occlusion that is packed in blue channel, and Ei being emissiv intensity which gets packed in the alpha channel). You will still be limited to 16 textures without using texture arrays, and as always I'd suggest most people juts use the advanced version of the shader primarily, but atleast the option is there.
@yaRnMcDonuts yaRnMcDonuts changed the title Ya rn mc donuts patch 9 Finihs Modularizing PBRTerrainUtils.glsllb Feb 20, 2025
@yaRnMcDonuts yaRnMcDonuts changed the title Finihs Modularizing PBRTerrainUtils.glsllb Finish Modularizing PBRTerrainUtils.glsllb Feb 20, 2025
@yaRnMcDonuts yaRnMcDonuts added this to the v3.8.0 milestone Feb 24, 2025
Removes the UseTextureArrays boolean, and instead map the define to the AlbedoTextureArray. This should be a cleaner way to do it that the define doesn't rely on users going back and setting a boolean on old terrain mats, and gives less chance to accidentally break the shader if the boolean value is cleared by mistake for some reason.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant