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

feat: Use parallax in landscape texture blending #338

Merged
merged 11 commits into from
Jul 17, 2024

Conversation

ThePagi
Copy link
Contributor

@ThePagi ThePagi commented Jul 13, 2024

Just a small change in the blending weights of landscape textures, makes details pop out more and make it feel more like distinct materials than a linear blend. Performance impact should be minimal.

@doodlum
Copy link
Owner

doodlum commented Jul 13, 2024

do total = rcp(total) instead of division since it's slow, and add [unroll] where applicable

Copy link
Collaborator

@alandtse alandtse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

height = TexColorSampler.SampleLevel(SampTerrainParallaxSampler, coords, mipLevels[0]).w * input.LandBlendWeights1.x;
pixelOffset[0] = pow(input.LandBlendWeights1.x, 1 + 1 * blendFactor) * (pow(TexColorSampler.SampleLevel(SampTerrainParallaxSampler, coords, mipLevels[0]).w, blendFactor * HEIGHT_POWER));
else
pixelOffset[0] = 0;
Copy link
Collaborator

@Pentalimbed Pentalimbed Jul 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same above, instead of branching here initialize the whole pixelOffset array to zero beforehand and save some elses. Or use inout on the argument since it is already initialised outside the function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made it a bit nicer. Idk if there is a faster way to zero-initialize, but I can't leave old values there with inout, otherwise they will be used when weight is 0.

@doodlum doodlum merged commit a395575 into doodlum:dev Jul 17, 2024
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.

4 participants