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

USERDATA does not work when using GPU trails #93594

Closed
ueshita opened this issue Jun 25, 2024 · 0 comments · Fixed by #93595
Closed

USERDATA does not work when using GPU trails #93594

ueshita opened this issue Jun 25, 2024 · 0 comments · Fixed by #93595

Comments

@ueshita
Copy link
Contributor

ueshita commented Jun 25, 2024

Tested versions

4.3.beta2

System information

Godot v4.3.beta2 - Windows 10.0.22631 - Vulkan (Forward+) - integrated AMD Radeon(TM) Graphics (Advanced Micro Devices, Inc.; 31.0.12027.9001) - AMD Ryzen 9 6900HX with Radeon Graphics (16 Threads)

Issue description

I found that USERDATA does not behave correctly when using GPUParticles3D's trail mode.
I have written to USERDATA1 in start() and read it in process() but cannot get the correct value.
It seemed to affect the initial value of the particle buffer.

Here is the Particle shader code.

shader_type particles;

void start() {
	TRANSFORM = EMISSION_TRANSFORM;
	CUSTOM = vec4(0.0);
	VELOCITY = vec3(0.0, 10.0, 1.0);

	USERDATA1.x = 0.5;
}

void process() {
	TRANSFORM[0][0] = 1.0 - USERDATA1.x;  // this will be invalid data when the trail.

	CUSTOM.x += DELTA;
	if (CUSTOM.x > LIFETIME) {
		ACTIVE = false;
	}
}

Left: Trails is not correctly (X scale is 1.0 or invalid value)
Right: Particles is correctly (X scale is 0.5)

bug_trails_using_userdata

Steps to reproduce

  • Set GPUParticles3D in trail mode
  • Set up particle shader
  • Write USERDATA1 in start()
  • Read USERDATA1 in process()

Minimal reproduction project (MRP)

bug_trails_using_userdata.zip

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

Successfully merging a pull request may close this issue.

3 participants