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

Godot 4.3 Web Export: CPU and GPUParticles2D do not render with default shader #96030

Closed
a-soulspark opened this issue Aug 24, 2024 · 3 comments

Comments

@a-soulspark
Copy link

Tested versions

  • Reproducible from 4.3.dev6 to 4.3.stable (tested with the Godot web editor)

System information

Godot v4.3.stable - Web - GLES3 (Compatibility) - WebKit WebGL - (2 Threads)

Issue description

In the specified Godot 4.3 versions, CPUParticles2D and GPUParticles2D nodes' particles do not render at all on web export, unless given a shader that overrides their COLOR. For example, this would suffice to fix it:

shader_type canvas_item;

void fragment() {
	COLOR = texture(TEXTURE, UV);
}

Steps to reproduce

  1. Create a new project
  2. Add CPUParticles2D node
  3. Export to web
  4. They should not render

If you use the web editor, you can even skip step 3. as the particles won't show up in the editor's viewport anyway.

Minimal reproduction project (MRP)

N/A

@a-soulspark
Copy link
Author

a-soulspark commented Aug 24, 2024

On a further note, it seems like the shader I specified above is not a full workaround: the particles appear without coloring, even on desktop.

On PC, a variation of this shader can fix the lack of coloring, by obtaining the color information in the vertex shader:

shader_type canvas_item;

varying vec4 MODULATE;

void vertex() {
	MODULATE = COLOR;
}

void fragment() {
	COLOR = texture(TEXTURE, UV) * MODULATE;
}

However, this causes the particles to become invisible on web again, so I tried a variation of this shader that only copies the color information's RGB channels:

// snip

void fragment() {
	vec4 textureColor = texture(TEXTURE, UV);
	COLOR.rgb = textureColor.rgb * MODULATE.rgb;
	COLOR.a = textureColor.a;
}

This version renders on PC, though of course it lacks the alpha value from the particle color.

On web, they now also render, though their color information appears to be wrong: white particles show up magenta, and yellow particles show as red. It appears that the green channel appears to be constantly zero.
My theory is that the alpha channel is also constantly zero, which would explain why the particles are invisible with the default shader.

@Maran23
Copy link
Contributor

Maran23 commented Aug 24, 2024

Maybe related to #95797

@akien-mga
Copy link
Member

Seems to be the same as #95797 indeed, consolidating there.

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

No branches or pull requests

4 participants