Revamp shading
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
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 issuer:
- 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)
🔥🔥🔥
Can someone test sun moon rotation for windows?
ok
Sun/moon rotation in Windows | Minecraft - 1.21.114 @devendrn https://streamable.com/th7wqb
Batman saves the day 🗣️🔥🔥
Can someone test simple, rounded, and realistic clouds movement on windows? It should change with camera position.
Can someone test simple, rounded, and realistic clouds movement on windows? It should change with camera position.
doing a little bit later @devendrn
Clouds 3: https://streamable.com/kn6fle
Clouds 2: https://streamable.com/w121kn
Clouds 1: https://streamable.com/wtn1bx
@devendrn
doing a little bit later @devendrn
Batman saves the day again
doing a little bit later @devendrn
Batman saves the day again
Windows User
@devendrn build pack -p windows fails
default Clouds was successful
@faizul726 try again. I made a typo previously.
@devendrn there's an animated artifact on the sun
see
https://github.com/user-attachments/assets/92f753be-b828-4d11-acc0-014313f95722
https://github.com/user-attachments/assets/d679be4f-b9bd-415a-969b-43d62b14d04c
also, the sun side during rain is a little too bright
@faizul726 when you are free later, check if that sun artifact happens with fully transparent sun texture.
happens with fully transparent image also
and moon is also affected by this issue
@devendrn
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
Sky is too bright when looking at the side of the sun during rain
@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;
@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 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);
@devendrn i just checked again to be sure. let me try the new fix shortly...
https://github.com/user-attachments/assets/4cc034be-97f6-4468-9263-cb7c77130068
assuming i am supposed to revert the previous change (mg8) and build new Sky material.
this is what it looks like now
https://github.com/user-attachments/assets/866ada20-22ba-4f67-b85a-f2c86488aff3
By the way, did you remove Weather material from source? It seems to no longer build it when I run build mats -p windows.
I just noticed there's a black blob sometimes glitching, even through solid blocks. I think that can be the sun (or moon?)
Just a reminder that there are several visual changes. Feedback is needed for me to know whether these changes are moving in the right direction or wrong direction and no new issues are introduced. If lighting could use further improvement, this is the place to comment.
I update the PR heading message every commit to include current changes and to-do changes. Please refer that before testing or giving feedback. https://github.com/devendrn/newb-x-mcbe/pull/52#issue-3541988564
@devendrn sky being bright in rain issue is fixed. and the blob thing is still there, as well as the dot on sun/moon. build from latest commit. I have attached a video for you to see.
https://github.com/user-attachments/assets/f615e9f1-1917-4296-af0f-3355d3936363
@faizul726 try testing with this change:
# src/newb/functions/sky.h
- vec2 g = 0.5 - 0.5*vec2(dot(env.sunDir, viewDir), dot(env.moonDir, viewDir));
+ vec2 g = vec2_splat(1.0);
@devendrn no longer happens. but the glow is gone now.
Maybe clamping this value could fix this issue. @faizul726 Try this:
# src/newb/functions/sky.h
- vec2 g = 0.5 - 0.5*vec2(dot(env.sunDir, viewDir), dot(env.moonDir, viewDir));
+ vec2 g = clamp(0.5 - 0.5*vec2(dot(env.sunDir, viewDir), dot(env.moonDir, viewDir)), 0.0, 1.0);