-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Added render_mode world_vertex_coords
in canvas
#24002
Conversation
Moving to 3.2 milestone as we are reaching beta stage for 3.1 and no longer merging new features. |
Actually I'd like @reduz to have a glance at this one before moving to 3.2. It doesn't really impact the existing features, so it could still be merged. |
I am not sure about this for a number of reasons: Would kick for after 3.1 is out to discuss properly. |
@reduz do you think it would be a good idea to make a note in the documentation for now? |
Might be time to revisit this PR? |
Sure! I can resolve conflicts and we can see what reduz thinks. |
Bump :) |
56a2244
to
fbefd13
Compare
@akien-mga Thanks for the reminder :) The merge conflict led me to realize that there was a bug in nearby code that would have broken particles in GLES2 if uses used "skip_vertex_transform". So I fixed the bug and included it in this PR. If reduz decides not to merge this for 3.2 then I need to fix the bug in its own PR. |
fbefd13
to
337c43b
Compare
337c43b
to
88f1c27
Compare
We discussed this on IRC, @reduz is not so keen on merging this as it has already been fixed properly in the
@fracteed @bfishman Do you still need this feature, and if so, do you need it in 3.2 or can your projects wait for 4.0? And if you need it in 3.2, could you test this PR and check that it actually solves your use case? @clayjohn I guess the bugfix you mentioned would be worth having in another PR. |
@akien-mga I made a PR for the bugfix. Let me know if we are going to merge this PR so I can rebase it with the bugfix as I fixed it in a better way than I did in this PR. |
@akien-mga sure I am happy to wait for 4.0 for this feature. |
@akien-mga personally I can wait. I had to put all non essential projects on hold because of Thank you all |
This PR brings the render mode
world_vertex_coords
to canvas item shaders. It also provides access to two new uniform matrices for converting to and from world coordinates namedGLOBAL_MATRIX
andINV_GLOBAL_MATRIX
respectively. I would prefer to name themWORLD_MATRIX
(which is what it is internally) andINV_WORLD_MATRIX
, however, for some reason the modelview transform is accessed usingWORLD_MATRIX
(which is incredibly confusing for users).The behaviour is the same as in spatial shaders. It presents
VERTEX
to the user in world coordinates, and then transforms it into view and NDC coordinates after the user written code is run.Many users have asked for access to this render mode and it directly addresses issue #19800. With the current system there is no way to acquire world position in the shader without passing in the global transform as a mat4 (which is currently broken, but fixed with #23976) or passing in the global position, scale, rotation and calculating the position manually (which is needlessly complicated/difficult).
Bugsquad edit: Fixes #19800.