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

Fix GPUParticles2D ignoring AtlasTexture region #64701

Merged

Conversation

Geometror
Copy link
Member

Fixes #13923.
Also fixes GPUParticles2D's texture not updating in some cases.

@Calinou
Copy link
Member

Calinou commented Aug 21, 2022

Out of curiosity, do you know if a similar approach can be used for GPUParticles3D?

@Geometror
Copy link
Member Author

Geometror commented Aug 21, 2022

@Calinou The problem is that GPUParticles3D and CPUParticles3D are using regular meshes with normal materials, so the logic would have to go in BaseMaterial3D. As BaseMaterial3D supports many different kind of textures (normal, detail, roughness,...) I think this would get quite complicated or it wouldn't be feasable at all since you can't guarantee that every texture is an AtlasTexture.

@kleonc
Copy link
Member

kleonc commented Aug 21, 2022

It won't work for AtlasTextures with margins. To properly take margins into account points would also need to be changed (and it would need to be taken into account in uvs as well after rethinking uvs would remain the same). Also would be nice if these would be calculated iteratively so nested AtlasTextures would be supported too.

Copy link
Member

@clayjohn clayjohn left a comment

Choose a reason for hiding this comment

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

This matches the behaviour of CPUParticles2D and is a big improvement over doing nothing.

To properly take margin into account, we will need to make further changes to how UVs are computed by both CPUParticles2D and GPUParticles2D, but that can be done in another PR

@akien-mga
Copy link
Member

Needs rebase.

@Geometror Geometror force-pushed the fix-atlastexture-gpuparticles-2d branch from 353b6af to 73bbcae Compare August 30, 2022 09:40
@Geometror
Copy link
Member Author

Rebased.

@akien-mga akien-mga merged commit 733d04f into godotengine:master Aug 30, 2022
@akien-mga
Copy link
Member

Thanks!

akien-mga added a commit that referenced this pull request Aug 30, 2022
@Mickeon
Copy link
Contributor

Mickeon commented Aug 30, 2022

My condolences!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Particles 2D ignore AtlasTexture region
7 participants