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

Improve color mixing for SDF smooth union and subtraction operations #141

Merged
merged 3 commits into from
Jun 24, 2024

Conversation

bryndsey
Copy link
Contributor

Previously, when performing union or subtraction operations with smoothing of 2 SDFs that used the same color, the operation would change the color (i.e. making it lighter for subtraction or darker for union). The amount of color variation increased as the value for the operation smoothing increased. See these screenshots for example, where the skin color should be uniform (discounting variations due to lighting):

Small smoothing value Larger smoothing value
image image

Modifying the union and subtraction operation functions as in this PR seems to resolve the color mixing, and produces the expected result:

image

@bryndsey
Copy link
Contributor Author

Note: I haven't tested any changes with anything other than GLSL. I updated the others for consistency, but I don't have a setup to test it.

@patriciogonzalezvivo patriciogonzalezvivo merged commit b708d44 into patriciogonzalezvivo:main Jun 24, 2024
@patriciogonzalezvivo
Copy link
Owner

Thank you!

This pull request was closed.
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.

2 participants