Kazen Con 2022-Q1 总结
1. Core Feature
- Monte Carlo unbiased path tracing
- multiple importance sample
- Material :kazen initial standard surface ( kiss )
- diffuse :Disney diffuse with Retro-Reflective
- specular :GGX-Smith BRDF with VNDF
- clearcoat :GGX-Smith BRDF with VNDF
- sheen :Disney sheen
- Textures and simple textures ops ( nested blend, ramp color, scale uv )
- OIIO texture system
- Normal mapping
- Camera : Perspective / Thin Lens
- Light : mesh light, basic environment ( Blinn/Newell Latitude Mapping )
2. KISS PBR shading model
KISS (kazen initial standard surface) , is a linear blend of a metallic BSDF and a dielectric BSDF, see Figure 1. Currently we only support opaque dielectric BSDF and it can be used as materials like plastics, wood, or stone.
KISS blend metallic and dielectric BSDFs based on parameters metallic.
For sampling the BRDF, I first use Russian-roulette to decide between sampling the diffuse lobe or the specular lobes with the following ratio:
For non-metallic materials, 1/2 the samples are sampled with cosine weighted hemisphere sampling, the 1/2 with specular sampling described below. For metallic materials, all samples are sampled using specular sampling.
The specular samples are divided into sampling the GGX (specular lobe) and GGX (clearcoat lobe) distribution with the following ratio:
For materials with no clearcoat, samples are only sampled using the GGX distribution, for materials with 100% clearcoat, 1/2 the samples are directed to either of the distributions.
// diffuse weight
float ratioDiffuse = (1.0f - metallic) / 2;
// specular weight
float ratioGGX = 1.0f / (1.0f + clearcoat);
These following images shows material parameters support by KISS:
2.1 roughness
0.0 | 0.5 |
---|---|
0.0 | 1.0 |
2.2 metallic
0.0 | 0.5 |
---|---|
0.0 | 1.0 |
2.3 specular
0.0 | 0.5 |
---|---|
0.0 | 1.0 |
2.4 specularTint
0.0 | 0.5 |
---|---|
0.0 | 1.0 |
2.5 clearcoat
0.0 | 0.5 |
---|---|
0.0 | 1.0 |
2.6 clearcoatRoughness
0.0 | 0.5 |
---|---|
0.0 | 1.0 |
2.7 sheen
0.0 | 0.5 |
---|---|
0.0 | 1.0 |
2.8 sheenTint
0.0 | 0.5 |
---|---|
0.0 | 1.0 |
3. Debug Error
This error occurred when we set integrator maxDepth
to a very high value, so the light path will be terminated only by russian roulette. The scenario is the light will bounce between floor and sphere forever, and make the shadow part look aweful.
Althrought, kill light path by maxDepth
without compensation will cause statistics bias.
maxDepth
parameter is found when I check cycles render setting : Light path, by default it setsmaxBounces
to 4.
So the take-away is : Reverse thinking code logic by ground truth (cycles) results, not just debug through code.
4. Look-dev
This shows the cycles shading graph.
The corresponding nano-Kazen material scene graph:
<bsdf type="normalmap">
<texture type="imagetexture">
<string name="filename" value="textures/MSMC_Brass_Hammered_Normal.jpg"/>
<float name="scale" value="1.0"/>
<string name="colorspace" value="linear"/>
</texture>
<bsdf type="kazenstandard">
<texture type="blend" id="baseColor">
<string name="blendmode" value="mix"/>
<texture type="constanttexture" id="input1">
<color name="color" value="0.887923 0.351533 0.002125"/>
</texture>
<texture type="constanttexture" id="input2">
<color name="color" value="0.982251 0.822786 0.62396"/>
</texture>
<texture type="imagetexture" id="mask">
<string name="filename" value="textures/MSMC_Circle_Outline_Grid.jpg"/>
<float name="scale" value="1.0"/>
<string name="colorspace" value="linear"/>
</texture>
</texture>
<texture type="constanttexture" id="roughness">
<color name="color" value="0.166233 0.166233 0.166233"/>
</texture>
<texture type="imagetexture" id="metallic">
<string name="filename" value="textures/MSMC_Circle_Outline_Grid.jpg"/>
<float name="scale" value="1.0"/>
<string name="colorspace" value="srgb"/>
</texture>
<float name="anisotropy" value="0.0"/>
<float name="specular" value="0.5"/>
<float name="specularTint" value="0.0"/>
<float name="clearcoat" value="0.0"/>
<float name="clearcoatRoughness" value="0.0"/>
<float name="sheen" value="0.0"/>
<float name="sheenTint" value="0.0"/>
</bsdf>
</bsdf>
5. Final result
Compare with Blender render result.
Reference
[1] Physically Based Shading at Disney Brent Burley. 2012
[2] Extending the Disney BRDF to a BSDF with Integrated Subsurface Scattering Brent Burley. 2015
[3] Simon Kallweit’s project report Simon Kallweit. 2015
[4] Microfacet Models for Refraction through Rough Surfaces Bruce Walter. 2007
[5] Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs Eric Heitz. 2014
[6] Sampling the GGX Distribution of Visible Normals Eric Heitz. 2018
[7] Robust monte carlo methods for light transport simulation Eric Veach. 1997
[8] Physically Based Rendering: from theory to implementation Matt Pharr, Wenzel Jakob and Greg Humphreys. 2016
[9] Mitsuba 2: Physically Based Renderer Wenzel Jakob
[10] Embree 3: High Performance Ray Tracing Intel
[11] OpenImageIO: a library for reading and writing images, and a bunch of related classes, utilities, and applications Larry Gritz
[12] Greyscalegorilla: modern surface material collection Greyscalegorilla. 2021