Skip to content

WebGPU: Carry pcg generator state through stage#728

Merged
gkjohnson merged 1 commit intogkjohnson:webgpu-pathtracerfrom
TheBlek:webgpu-wavefront-rand-state
Feb 27, 2026
Merged

WebGPU: Carry pcg generator state through stage#728
gkjohnson merged 1 commit intogkjohnson:webgpu-pathtracerfrom
TheBlek:webgpu-wavefront-rand-state

Conversation

@TheBlek
Copy link
Copy Markdown

@TheBlek TheBlek commented Feb 27, 2026

Before:
chrome_Yyh7EvrgrE

After:
chrome_VyTtLAOUpW

From my understanding pseudo-random generators usually do not behave uniformly when sampling only a couple numbers before initializing with a new seed:

This has worse randomness:
init( 1 );
rand()
rand()
init( 2 );
rand()
rand()
...

Than this:
init( 1 );
rand()
rand()
rand()
rand()
...

Issues got more pronounced with more complex bsdfs in #717, but here it is also visible.

@TheBlek TheBlek changed the title Carry pcg generator state through stage WebGPU: Carry pcg generator state through stage Feb 27, 2026
@gkjohnson
Copy link
Copy Markdown
Owner

gkjohnson commented Feb 27, 2026

Thanks - passing the bounces value into the seed was a fairly lazy fix I forgot to got back and check 😅

In terms of randomness getting the "sobol" random function working is probably our better bet for stratified sampling functions. It provides a better result and should still be applicable for the wavefront path tracing approach. See this tweet

@gkjohnson gkjohnson merged commit e46a2a9 into gkjohnson:webgpu-pathtracer Feb 27, 2026
1 check passed
@gkjohnson gkjohnson added this to the v0.0.25 milestone Feb 27, 2026
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.

2 participants