Stochastic Transparency Samuli Laine Tero Karras NVIDIA Research Stratified Stochastic Transparency Goal Improve image quality of stochastic transparency Enderton et al 2010 Motivation As always good sampling produces less noise than bad sampling ID: 1026524
Download Presentation The PPT/PDF document "Stratified Sampling for" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
1. Stratified Sampling for Stochastic TransparencySamuli Laine, Tero KarrasNVIDIA Research
2. Stratified Stochastic TransparencyGoal: Improve image quality of stochastic transparency [Enderton et al. 2010]Motivation: As always, good sampling produces less noise than bad samplingRandom samplingStratified sampling
3. What Is Stochastic Transparency?Order-independent transparency (OIT) algorithmDraw surface into a sample with probability αBinary decision, no blending with previous colorMSAA resolve produces the blended result+ Fixed storage requirements+ Correct expected value− Noise in the result
4. How to Realize Probability α?Build on the basic algorithm of Enderton et al. For each samplePick reference value xIf α < x, discardOtherwise proceed (Z test, stencil, ROP, etc.)As long as x is properly distributed, the expected value is correct
5. Choice of α ReferenceIn each sample, what do we compare α against?Random numberbetween 0 and 1Reference valuesspaced 1/N apart(N = samples / pixel)
6. The Hard Part: Multiple SurfacesCan the reference value assignment be static?No, separate surfaces must be uncorrelatedCurrent alpha-to-coverageCan they be changedbetween each triangle?No, interior edges ofsurfaces become visible
7. Our Bag of TricksTrick 1: Know when a surface changesTrick 2: Generate good, uncorrelated α reference values for every surfaceTrick 3: Improve stratification for partially occluded surfaces
8. Trick 1: Surface TrackingKeep a surface ID per pixelKeep bit per sample indicating current surface coverageBit = 1: We have already touched this sample with the current surface ID
9. Surface Tracking ExampleStart a new surface herebecause of conflictsChange surfaceat every triangleChange surfacewhen conflict
10. Trick 2: Generation of α Ref. ValuesWe need to takeSurface IDPixel IDSample ID.. And produce an α reference value that isStratified within the pixel (spaced 1/N apart)Well-interleaved between nearby pixelsFor high-quality ditheringDetails in the paperUncorrelated for different surface IDs
11. Reference Value GeneratorStart with standard base-2 radical inverseOnly one problem: Correlated sub-spansE.g., 0..3 and 4..7 are the same, offset 0.125 apartWould result in pixels and surfaces being almost perfectly correlated wrong results
12. Improving the Reference ValuesAdd a scramble where each bit is flipped based on a hash of bits below itSimilar to Sobol sequence but more generic
13. Example ImplementationHash + XOR for allbits simultaneously
14. Example ResultWith scrambled base-2 inverseEqually well stratified but now different sub-spans are uncorrelatedPerfect!
15. Now for the Hairy StuffWe now have excellent stratification both spatially and in α domain for single surfacesWhat about stratification between multiple surfaces in the same pixel?First draw50% red in frontThen draw50% green in backWrong result(should be 25% green)+=
16. A Fix for Multiple Surfaces?First stab: Compact samples after Z testFirst draw50% red in frontThen draw50% green in back,ONLY consideringsamples thatsurvive Z testCorrect result+=
17. Almost Works, But…What’s goingon here?Low noiseHigh noise
18. Back-to-Front Still Broken When rendering back-to-front, the samples are not stratified for previously drawn surfacesCompaction after Z test does not help hereFirst draw50% green in backThen draw50% red in frontResult is stillwrong+=
19. Trick 3: Make It Work Both WaysSolution: Sort previous samples based on depthGroups samples from previous surfaces intocontinuous spansEach previously drawn surface gets a continuous span of α reference values good stratificationFirst draw50% green in backThen 50% red in front,assigned in sorted orderCorrect result+=
20. Example ResultCompact after Z, no sortCompact after Z and sort
21. Putting Everything Together
22. Results, 16 sppPrevious methodRMSE = 17.2Our methodRMSE = 10.3
23. Results, 16 sppPrevious methodRMSE = 8.4Our methodRMSE = 5.6
24. Results, 64 sppPrevious methodRMSE = 8.7Our methodRMSE = 4.0
25. Results, 64 sppPrevious methodRMSE = 4.1Our methodRMSE = 2.0
26. Stratification Faster ConvergenceRMSE results for the test scenes
27. Thank YouQuestions
28. Dithering ExampleStratification between pixelsNo cooperation between pixels,results in random ditheringStratification within aligned 2x2,4x4, etc. pixel blocks