Skip to content

Conversation

@mvaligursky
Copy link
Contributor

@mvaligursky mvaligursky commented Apr 24, 2025

  • soft shadows works using WGSL
  • fixed few other issues in WGSL chunks this example exposed

Screenshot 2025-04-24 at 16 16 04

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 pull request implements soft shadows using WGSL along with a few fixes in shadow and depth linearization functions.

  • Updated depth linearization functions to use the new linearizeDepthWithParams API.
  • Replaced conventional saturate and gamma-correction functions with their WGSL-specific counterparts (saturate3 and gammaCorrectInputVec3).
  • Introduced a new WGSL implementation for soft shadows and adjusted shader chunk imports accordingly.

Reviewed Changes

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

Show a summary per file
File Description
src/scene/shader-lib/chunks/lit/frag/pass-shadow/litShadowMain.js Updated to call linearizeDepthWithParams for improved depth calculations.
src/scene/shader-lib/chunks/lit/frag/lighting/shadowSoft.js Removed the extraneous numRings parameter from prepareDiskConstants and updated related calls.
src/scene/shader-lib/chunks/lit/frag/lighting/shadowPCSS.js Replaced linearizeDepth with linearizeDepthWithParams for consistency.
src/scene/shader-lib/chunks/common/frag/linearizeDepth.js Renamed depth linearization function to linearizeDepthWithParams and updated alias usage.
src/scene/shader-lib/chunks-wgsl/standard/frag/specular.js
src/scene/shader-lib/chunks-wgsl/standard/frag/sheen.js
src/scene/shader-lib/chunks-wgsl/standard/frag/emissive.js
src/scene/shader-lib/chunks-wgsl/standard/frag/diffuse.js
Changed shader functions to use saturate3 and gammaCorrectInputVec3 variants per new WGSL practices.
src/scene/shader-lib/chunks-wgsl/lit/frag/pass-shadow/litShadowMain.js Mirrored the depth linearization update in WGSL shaders.
src/scene/shader-lib/chunks-wgsl/lit/frag/lighting/shadowSoft.js Added a complete WGSL implementation for soft shadows using PCSS with updated disk sampling routines.
src/scene/shader-lib/chunks-wgsl/lit/frag/lighting/lighting.js Adjusted shader chunk imports and added comments regarding unsupported omni/spot PCSS on WebGPU.
src/scene/shader-lib/chunks-wgsl/lit/frag/lighting/lightFunctionShadow.js Minor formatting adjustments in light shadow function logic.
src/scene/shader-lib/chunks-wgsl/lit/frag/cubeMapRotate.js Updated cube map rotation to reference a uniform variable.
src/scene/shader-lib/chunks-wgsl/common/frag/linearizeDepth.js Introduced a new WGSL depth linearization file matching the updated API conventions.
src/scene/shader-lib/chunks-wgsl/chunks-wgsl.js Updated shader chunk imports to reflect the recent WGSL function and file changes.
Comments suppressed due to low confidence (1)

src/scene/shader-lib/chunks-wgsl/lit/frag/lighting/shadowSoft.js:85

  • Ensure that 'pcPosition' is defined and properly passed as a shader input since it's used to generate the random seed.
let randomSeed: f32 = fractSinRand(pcPosition.xy);

@mvaligursky mvaligursky merged commit 020e955 into main Apr 24, 2025
7 checks passed
@mvaligursky mvaligursky deleted the mv-soft-shadows-wgsl branch April 24, 2025 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: graphics Graphics related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants