Skip to content

Conversation

@mvaligursky
Copy link
Contributor

@mvaligursky mvaligursky commented May 6, 2025

  • converted all particle shader chunks to WGSL, and using those for both rendering and simulation shaders
  • updated WGSL processor, to merge vertex and fragment resources based on parsed information, instead of simply comparing string, to allow for formatting variations
  • made particle_uv attribute used by Particles driven by the mesh containing UV instead of relying on the shader compiler stripping out unused attributes, which does not happen on WGSL side
  • particle system specifies used attributes when creating shaders, as that's required by WGSL processing (no reflection)

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR converts the particle system shader chunks to WGSL and updates the WGSL processor to merge vertex and fragment shader resources more robustly while adding new support for particle UV attributes.

  • Converted particle shader chunks (for both simulation and rendering) to WGSL syntax
  • Updated the WGSL processor to merge shader resources based on parsed properties rather than string comparisons
  • Modified the particle emitter and material configuration to support the new particle_uv attribute requirement

Reviewed Changes

Copilot reviewed 57 out of 57 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/scene/shader-lib/chunks-wgsl/particle/frag/particleUpdaterSphere.js Added WGSL shader for sphere-based particle spawn calculations
src/scene/shader-lib/chunks-wgsl/particle/frag/particleUpdaterRespawn.js Implemented WGSL particle updater for respawn logic
src/scene/shader-lib/chunks-wgsl/particle/frag/particleUpdaterOnStop.js Implemented WGSL updater for on-stop particle behavior
src/scene/shader-lib/chunks-wgsl/particle/frag/particleUpdaterNoRespawn.js Added WGSL updater for non-respawn particle mechanics
src/scene/shader-lib/chunks-wgsl/particle/frag/particleUpdaterInit.js Added WGSL initialization shader chunk with updated uniform and varying declarations
src/scene/shader-lib/chunks-wgsl/particle/frag/particleUpdaterEnd.js Added WGSL end shader chunk to finalize output color
src/scene/shader-lib/chunks-wgsl/particle/frag/particleUpdaterAABB.js Added WGSL updater for box-shaped emitter calculations
src/scene/shader-lib/chunks-wgsl/particle/frag/particleOutputRgba8.js Introduced WGSL shader to encode particle output as RGBA8
src/scene/shader-lib/chunks-wgsl/particle/frag/particleOutputFloat.js Introduced WGSL shader to encode particle output as floats
src/scene/shader-lib/chunks-wgsl/particle/frag/particleInputRgba8.js Added WGSL shader to decode particle input from RGBA8 textures
src/scene/shader-lib/chunks-wgsl/particle/frag/particleInputFloat.js Added WGSL shader to decode particle input from float textures
src/scene/shader-lib/chunks-wgsl/particle/frag/particle.js Added WGSL particle fragment shader combining color map, lighting, and blending
src/scene/shader-lib/chunks-wgsl/particle/frag/particle-simulation.js Consolidated WGSL simulation shader with proper resource inclusion based on emitter type
src/scene/shader-lib/chunks-wgsl/particle/frag/particle-shader.js Constructed WGSL shader for particle rendering with configurable lighting and blending
src/scene/shader-lib/chunks-wgsl/common/frag/screenDepth.js Updated helper function name for retrieving screen depth in WGSL shaders
src/scene/shader-lib/chunks-wgsl/chunks-wgsl.js Re-enabled and updated WGSL shader chunk imports and resource includes
src/scene/particle-system/particle-material.js Adjusted material shader variant generation to include new meshUv attribute
src/scene/particle-system/particle-emitter.js Updated emitter shader creation to support WGSL/GLSL selection and improved vertex buffer allocation
src/scene/materials/standard-material.js Removed deprecated customFragmentShader flag
src/platform/graphics/webgpu/webgpu-shader-processor-wgsl.js Improved resource merging logic and refined error messages in WGSL shader processor

@mvaligursky mvaligursky merged commit 026afc1 into main May 6, 2025
7 checks passed
@mvaligursky mvaligursky deleted the mv-particles-wgsl branch May 6, 2025 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: graphics Graphics related issue area: particles

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants