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

Add a new shader - 3D Vertical Dissolve in Object Space #1

Merged

Conversation

alfredbaudisch
Copy link
Contributor

@alfredbaudisch alfredbaudisch commented Aug 4, 2022

This shader uses the same code from the "3D Vertical Dissolve" shader, but instead of taking the object's global_transform, it uses the object pixel in local space to dissolve, this way, it dissolves from the mesh's real local top-down or bottom-up (for example, "from head to chin" or "from chin to head").

The only change is in vec3 position = (inverse(WORLD_MATRIX) * CAMERA_MATRIX * vec4(VERTEX, 1.0)).xyz; instead of vec3 position = world_pos;.

This is the final result:

GodotVerticalDissolveObjectSpace.mp4

As a comparison, this is the behaviour of the existing 3D Vertical Dissolve shader, notice after 0:02 when I rotate the mesh, how it's dissolved (it doesn't take into consideration that the "top" is the "head"):

GodotDissolveGlobalSpace.mp4

This shader uses the same code from the "3D Vertical Dissolve" shader, but instead of taking the object's global_transform, it uses the object pixel in local space to dissolve, this way, it dissolves from the mesh's real local top-down or bottom-up (when checking Up).
@ceceppa
Copy link
Owner

ceceppa commented Aug 4, 2022

I love that, thanks.
I remember trying unsuccessfully to do that without using the world_pos.

@ceceppa ceceppa merged commit c76e91c into ceceppa:master Aug 4, 2022
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