Skip to content

Revamp shading#52

Open
devendrn wants to merge 34 commits intomainfrom
dev
Open

Revamp shading#52
devendrn wants to merge 34 commits intomainfrom
dev

Conversation

@devendrn
Copy link
Owner

@devendrn devendrn commented Oct 22, 2025

All changes made to this branch will be for testing, and will include redundant code and comments.

Changes in mind for this PR:

  • New sky model
  • Update lighting
  • Improve clouds
  • Improve fog
sunrise rain during sunrise noon sun reflection on water

Please report any issue with these changes. Feedback will really help.

New Sky

Features

  • Custom sun/moon rotation (yaw, tilt) . Also removes in-game sun/moon scaling effect when looking at it.
  • 2d sky based on sun/moon direction (old one was 1d, with extra overlay effects)
  • New cube sun texture (based on current moon texture)
  • Rainbow positioning based on sun direction (also rainbow is now enabled by default during rain). Reduced rainbow width also.
  • Sun/moon light present in sky reflections and fog now (TODO: Make this a brighter for reflection and dimmer for fog?)

Known issues:

  • Moon abtruptly changing position right after midnight (FIXED)
  • Disabled underwater streak. need to update it (TOFIX)
  • Sun/Moon flickering near sunrise/sunset (FIXED)
  • Dark blob artifact at sun/moon center in some devices (FIXED)

Updated Lighting

Features

  • New lighting logic (also moved all lighting logic to vertex shader itself). No more hacky torchlight dimming in sunlight region. Now it blends properly with sun light.
  • Improved day/night transition using sun direction
  • Improved dawn lighting. Slight sunlight gradient fade during sunrise.
  • Correct cloud shadow projection (also enabled cloud shadow on terrain by default)

Known issues:

  • Need to update actor,items shading to match terrain (TODO)
  • Need to update underwater lighting (TODO)

Update clouds

Features

  • Move clouds with minecraft world position (for rounded, realistic)
  • Cloud reflection now matches correctly with actual cloud plane and is now present for terrain reflection aswell.
  • Improve clouds lighting (TODO)

Other changes

Features

  • Improve water and lava noise (TODO)

- New sky model
- Custom sun/moon rotation
- Rewrite parts of code
@xLynxiummcx
Copy link
Collaborator

🔥🔥🔥

@devendrn
Copy link
Owner Author

Can someone test sun moon rotation for windows?

@BatmanBinSuparman49
Copy link

ok

@BatmanBinSuparman49
Copy link

Sun/moon rotation in Windows | Minecraft - 1.21.114
@devendrn
https://streamable.com/th7wqb

@faizul726
Copy link
Contributor

Batman saves the day 🗣️🔥🔥

- Add sun/moon glow to sky reflection
- Refactor some code
- Follow sun direction now
- Enable by default now
@devendrn
Copy link
Owner Author

Can someone test simple, rounded, and realistic clouds movement on windows? It should change with camera position.

@faizul726
Copy link
Contributor

Can someone test simple, rounded, and realistic clouds movement on windows? It should change with camera position.

doing a little bit later @devendrn

@BatmanBinSuparman49
Copy link

Clouds 3:
https://streamable.com/kn6fle

Clouds 2:
https://streamable.com/w121kn

Clouds 1:
https://streamable.com/wtn1bx

@devendrn

@faizul726
Copy link
Contributor

doing a little bit later @devendrn

Batman saves the day again

@BatmanBinSuparman49
Copy link

doing a little bit later @devendrn

Batman saves the day again

Windows User

@faizul726
Copy link
Contributor

@devendrn build pack -p windows fails

image

default Clouds was successful

@devendrn
Copy link
Owner Author

@faizul726 try again. I made a typo previously.

@faizul726
Copy link
Contributor

@devendrn there's an animated artifact on the sun

see

bandicam.2025-10-28.00-36-38-556.mp4
bandicam.2025-10-28.00-38-16-128.mp4

also, the sun side during rain is a little too bright

@devendrn
Copy link
Owner Author

@faizul726 when you are free later, check if that sun artifact happens with fully transparent sun texture.

@faizul726
Copy link
Contributor

happens with fully transparent image also

image image

and moon is also affected by this issue

@devendrn

@BatmanBinSuparman49
Copy link

image

It's doesn't happen to me
@faizul726
It could be a GPU issue
@devendrn

Also Fazul, send that transparent sun.png and let me try

@BatmanBinSuparman49
Copy link

image

Sky is too bright when looking at the side of the sun during rain

@devendrn
Copy link
Owner Author

@faizul726 does this artifact happen when you set mg8 to 0.0?

# src/newb/functions/sky.h
-  float mg8 = (g8.x+g8.y)*mask*(1.0-0.9*env.rainFactor);
+  float mg8 = 0.0;

@faizul726
Copy link
Contributor

@devendrn it's 12 am here right now. i will try to test in morning.

also i am updating minecraft to v1.21.120 (which broke materials again)

so you may want to update the material source once again.

@faizul726
Copy link
Contributor

image still happens @devendrn

@devendrn
Copy link
Owner Author

@faizul726 are you sure you applied the change properly?

Try again. If it still shows up, try with this change instead:

# src/newb/functions/sky.h
-  vec2 g = 0.5 - 0.5*vec2(dot(env.sunDir, viewDir), dot(env.moonDir, viewDir));
+  vec2 g = vec2_splat(0.0);

@mcbegamerxx954
Copy link

mcbegamerxx954 commented Dec 27, 2025

I have an idea, if the auto fixer can detect files name. Wouldn't it be better to add a file called ".1.21.130" in the pack?

Much simple in mind ig

I can't list files in mbl2 but can be done, I dont like adding extra files just for this purpose tho.

@IndeedItzGab
Copy link
Collaborator

IndeedItzGab commented Dec 27, 2025

I have an idea, if the auto fixer can detect files name. Wouldn't it be better to add a file called ".1.21.130" in the pack?
Much simple in mind ig

I can't list files in mbl2 but can be done, I dont like adding extra files just for this purpose tho

You don't need to add files in the pack or wherever, the developer of the shader will add the file with a specific prefix for you to check. If the file doesn't exists then do what it normally do. However, not all dev will know about this information, so I guess it is much better to do the manifest.json thing

@devendrn
Copy link
Owner Author

@mcbegamerxx954 This won't work for my lightmap fix involving fract:

    let finder4 = Finder::new(b"65535.0");

Can we add new finder for vec2(256.0, 4096.0) to detect my fix?

@mcbegamerxx954
Copy link

@mcbegamerxx954 This won't work for my lightmap fix involving fract:

    let finder4 = Finder::new(b"65535.0");

Can we add new finder for vec2(256.0, 4096.0) to detect my fix?

Can do

@devendrn
Copy link
Owner Author

New lava noise
image

Old:
ss-25-12-27-19-50

@IndeedItzGab
Copy link
Collaborator

https://media.discordapp.net/attachments/844591538025791492/1454501946340675757/image0.jpg?ex=695151ff&is=6950007f&hm=34cff15a9469c34c26b14ca11260fe3591bcf21b9a6c3eeb06694b70157103cf&=&format=webp&width=415&height=876

this one looks fine and performance friendly, untested in-game so I don't know if the repetition is noticeable
screenshot by @ amg

@faizul726
Copy link
Contributor

@mcbegamerxx954 This won't work for my lightmap fix involving fract:

    let finder4 = Finder::new(b"65535.0");

Can we add new finder for vec2(256.0, 4096.0) to detect my fix?

This issue is fixed now for MBL2, Draco and MB Loader.
9a51160 in mtbinloader2
04c7266 in mcbe_shader_redirector

@devendrn

@faizul726
Copy link
Contributor

Also I assume the release of v16.50 is unintentional?

@devendrn
Copy link
Owner Author

Hi, how are you? I loved the NewB x Legacy Dev 16.50 version, but there was a minor bug in the end. When I was modifying the end lightmap or the horizon fog, it looked like this and didn't turn the dark color I was supposed to; instead, it reverted to the default color of the vanilla Minecraft end. Here are some screenshots of what happened. 1.21.130

@Jesusmendozaxxx What is the bug exactly here? What config options did you change exactly?

@devendrn
Copy link
Owner Author

@Jesusmendozaxxx I have created discussion page for these things. You can ask for support there. #61

Repository owner deleted a comment from Jesusmendozaxxx Dec 30, 2025
Repository owner deleted a comment from Jesusmendozaxxx Dec 30, 2025
@faizul726
Copy link
Contributor

@devendrn I am keeping a list of commits that worked on specific versions of Minecraft. (As 1.21.100 - 1.21.130 went pretty rough in context of breaking existing shaders)

So, I want to know, do you remember updating lightmap/code 1.21.111 - v1.21.114 and 1.21.120 - 1.21.124 range? I can't find the relevant commits and I am unable to recall whether .100's lightmap fix worked on those versions.

@faizul726
Copy link
Contributor

Also, some (perhaps many) people don't like the new pinkish sky/sun. You may want to reconsider looks of those.

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.

8 participants