generated from jaredlll08/MultiLoader-Template
-
Notifications
You must be signed in to change notification settings - Fork 13
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
Vanilla friendly HDR (effects) implementation #28
Draft
shBLOCK
wants to merge
12
commits into
FoundryMC:1.20
Choose a base branch
from
shBLOCK:bloom
base: 1.20
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…chments parameters of CopyPostStage
shBLOCK
changed the title
Vanilla friendly HDR effects
Vanilla friendly HDR effects & HDR workflow
Jul 24, 2024
shBLOCK
changed the title
Vanilla friendly HDR effects & HDR workflow
Vanilla friendly HDR (effects) implementation
Jul 24, 2024
Added BasicHDRBlock
… the CopyPostStage change, forgot to commit)
…dded methods to assign custom rendertypes to items
… very incomplete, many TODOs
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR proposed a possible implementation of HDR-related effects (bloom and tonemapping) that avoids impact on the look of non-related stuff (vanilla & mods not using veil).
General Description
Since tonemapping influences the look of things that aren't designed for HDR, they need to be corrected. This is done by "inverse tonemapping" (similar to the concept of inverse functions in math).(old idea, turned out to be impractical)Since tonemapping influences the look of things that aren't designed for HDR, we simply try to ignore them when doing tonemapping & bloom.
To distinguish between non-HDR things and things that are actually designed for HDR (from veil users), two techniques are used for the deferred rendering pipeline and gui stuff.
For the deferred pipeline, a bitmask flag is used in the red channel of the
MaterialSampler
. Therefore, dedicated shaders are needed for HDR things (although veil's shader definition system makes this very easy).One problem that comes with this implementation is post-processing shader compatibility. If a post-processing shader warps the color buffer then the material buffer won't match up with the color buffer anymore. To work around this, any warping post-processing needs to update the material buffer accordingly to keep the relation.
For Gui, HDR things are rendered into dedicated framebuffer, the HDR framebuffer is then composed back to the main buffer based on depth testing in the end. The non-HDR gui parts also need to be rendered into a separate framebuffer to apply reverse tonemapping to it.
Note: In the following sections I might not include changes to the transparent pipeline since it's basically the same as the opaque one.
Pipeline Changes (Slightly out-of-date)
veil:post
framebuffer, if compatibility won't be a problem).minecraft:main
.TODO List
IMPORTANT NOTE!!!
Below here are descriptions of the original plan that uses inverse tonemapping, but during development many more problems were found that makes me think it doesn't really make sense (or it's not worth the trade-off) to do a proper full-image tonemap for MC if we were to implement HDR effects, while keeping the vanilla look.
Pipeline Changes
CompatibilitySampler
ofveil:opaque
.VanillaLightRenderer
render before any other lights.VanillaLightRenderer
, apply the inverse tonemapping toveil:opaque_light
.AlbedoSampler
ofveil:opaque
?Compose HDR framebuffer toveil:opaque
andveil:opaque_light
(based on depth test).Remaining Problems & Ideas