Skip to content

perf(particlesys): Improve particle rendering performance using texture atlas - #3557

Draft
stephanmeesters wants to merge 2 commits into
TheSuperHackers:mainfrom
stephanmeesters:perf/texture-atlas
Draft

stephanmeesters wants to merge 2 commits into
TheSuperHackers:mainfrom
stephanmeesters:perf/texture-atlas

Conversation

@stephanmeesters

@stephanmeesters stephanmeesters commented Oct 18, 2026 •

Copy link
Copy Markdown
  • Implement texture atlas and unit tests.
  • Adjust sorting renderer to draw multiple triangles in the same call if render state matches (same texture, same blending mode, etc).
  • Adjust ParticleSys to use the new texture atlas with a shared blending mode

Adds 77% performance to a busy scene.

atlas

@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6a4a705a-5704-45c4-82a3-d47d215747ba
📥 Commits

Reviewing files that changed from the base of the PR and between e572d87 and d86f8b4.

📒 Files selected for processing: 10
  • Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DParticleSys.h
  • Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt
  • Core/Libraries/Source/WWVegas/WW3D2/pointgr.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/pointgr.h
  • Core/Libraries/Source/WWVegas/WW3D2/sortingrenderer.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/textureatlas.cpp
  • Core/Libraries/Source/WWVegas/WW3D2/textureatlas.h
  • Tests/Google/Core/CMakeLists.txt
  • Tests/Google/Core/Libraries/WW3D2/TextureAtlasTest.cpp

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Walkthrough

The particle renderer now uses texture atlases for eligible particle systems and remaps particle UVs to atlas regions. The sorting renderer also groups consecutive triangles with compatible render states into shared draws.

Changes

Particle Texture Atlasing

Layer / File(s) Summary
Texture atlas storage and pixel operations
Core/Libraries/Source/WWVegas/WW3D2/textureatlas.h, Core/Libraries/Source/WWVegas/WW3D2/textureatlas.cpp, Core/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt, Tests/Google/Core/Libraries/WW3D2/TextureAtlasTest.cpp, Tests/Google/Core/CMakeLists.txt
TextureAtlasClass adds paged texture storage, lookup and insertion, mip-level copying, premultiplication, and padding. Tests cover coordinate wrapping, premultiplication, and padding.
Particle batching with atlas UVs
Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DParticleSys.h, Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp, Core/Libraries/Source/WWVegas/WW3D2/pointgr.h, Core/Libraries/Source/WWVegas/WW3D2/pointgr.cpp
W3DParticleSystemManager resolves atlas textures and shaders for eligible systems, stores per-particle UV rectangles, and passes them to PointGroupClass. PointGroupClass remaps generated UVs into those rectangles.

Sorting Renderer Batching

Layer / File(s) Summary
Group draws by compatible render state
Core/Libraries/Source/WWVegas/WW3D2/sortingrenderer.cpp
Same_Render_State checks shader bits, textures, matrices, and material conditions. Compatible consecutive nodes within a chunk share a draw using the first node’s render state.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~60 minutes

Change: Other

Sequence Diagram(s)

sequenceDiagram
  participant W3DParticleSystemManager
  participant TextureAtlasClass
  participant PointGroupClass
  W3DParticleSystemManager->>TextureAtlasClass: Find_Or_Insert particle texture and receive atlas UV rectangle
  W3DParticleSystemManager->>PointGroupClass: Set_Texture_UV_Rects for particle rendering
  PointGroupClass->>PointGroupClass: Remap generated UVs during Render
Loading

Suggested reviewers: mauller, lfeenanea, xezon

Merge Risk: ⚪ Minimal · up to d86f8

The change batches particle rendering through a texture atlas and groups compatible draws. No concrete merge-blocking defect was established. Confirm that the new texture atlas test builds in CI.

Pre-merge checks: Passed 4
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly and concisely describes the main change: improving particle rendering performance with a texture atlas.
Description check Passed The description directly covers the texture atlas, batching changes, ParticleSys integration, tests, and reported performance improvement.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@stephanmeesters stephanmeesters added Major Severity: Minor < Major < Critical < Blocker Performance Is a performance concern Gen Relates to Generals ZH Relates to Zero Hour labels Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Gen Relates to Generals Major Severity: Minor < Major < Critical < Blocker Performance Is a performance concern ZH Relates to Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant