Skip to content

Add water shader with terrain integration#146

Open
stainlu wants to merge 1 commit intomainfrom
feat/water-shader
Open

Add water shader with terrain integration#146
stainlu wants to merge 1 commit intomainfrom
feat/water-shader

Conversation

@stainlu
Copy link
Copy Markdown
Owner

@stainlu stainlu commented Apr 6, 2026

Summary

  • Add a dedicated water render pipeline with animated Gerstner-style wave displacement, fresnel-based transparency, specular highlights, and subsurface caustic approximation
  • Extend SceneUniforms with elapsed_time field across all shader backends (WGSL, Metal MSL) for time-driven animation
  • Introduce WaterChunk marker component and is_water flag on DrawCommand to route water terrain chunks through the water pipeline instead of the standard PBR path

Test plan

  • cargo check --workspace -- workspace compiles
  • cargo check -p euca-render --features metal-native -- Metal path compiles
  • cargo test --workspace -- all tests pass (including updated SceneUniforms size pin)
  • cargo clippy --workspace -- -D warnings -- zero warnings
  • cargo fmt --all -- --check -- clean formatting
  • cargo build -p euca-game --example dota_client --release -- MOBA builds
  • cargo build -p euca-game --example dota_client --features metal-native --release -- MOBA Metal builds

🤖 Generated with Claude Code

Introduce a dedicated water render pipeline with animated wave displacement
and fresnel-based transparency. Water chunks in the MOBA terrain are now
rendered with multi-octave sine waves, specular highlights, and view-angle
dependent alpha, instead of the flat PBR material.

Key changes:
- Add elapsed_time field to SceneUniforms (Rust + all WGSL/Metal shaders)
- Create water.wgsl shader with Gerstner-style wave displacement
- Add water_pipeline to Renderer (alpha blend, depth read, no depth write)
- Add is_water flag to DrawCommand for pipeline selection
- Add WaterChunk marker component to tag water terrain entities
- Partition draw commands into opaque/transparent/water categories
- Wire up WaterChunk in dota_client terrain spawning and draw collection

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying euca-engine with  Cloudflare Pages  Cloudflare Pages

Latest commit: a0f95ed
Status: ✅  Deploy successful!
Preview URL: https://1225f3a8.euca-engine.pages.dev
Branch Preview URL: https://feat-water-shader.euca-engine.pages.dev

View logs

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant