<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title>Kazen</title>
  <link href="https://Kazen-Renderer.github.io//"/>
  <link type="application/atom+xml" rel="self" href="https://Kazen-Renderer.github.io//feeds/posts/default/"/>
  <updated>2022-10-14T13:51:46+00:00</updated>
  <id>https://Kazen-Renderer.github.io/</id>
  <author>
    <name>Kazen Renderer</name>
  </author>

  
  <entry>
    <id>https://Kazen-Renderer.github.io//2022/07/kazen-con-v002-report.html</id>
    <link type="text/html" rel="alternate" href="https://Kazen-Renderer.github.io//2022/07/kazen-con-v002-report.html"/>
    <title>Kazen Con 2022-Q2 总结</title>
    <published>2022-07-10T00:00:00+00:00</published>
    <updated>2022-07-10T00:00:00+00:00</updated>
    <author>
        <name>Kazen Renderer</name>
    </author>
    <content type="html">
&lt;p&gt;&lt;a href=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v002-report/kc_v02.png&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v002-report/kc_v02.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;1-core-feature&quot;&gt;1. Core Feature&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;New samplers.
    &lt;ol&gt;
      &lt;li&gt;stratified&lt;/li&gt;
      &lt;li&gt;correlated&lt;/li&gt;
      &lt;li&gt;pmj02-bn&lt;/li&gt;
    &lt;/ol&gt;
  &lt;/li&gt;
  &lt;li&gt;Geometric shadow terminator : remove the shadow-line artifact cause by geometry.&lt;/li&gt;
  &lt;li&gt;Fire fly reduction: increase roughness per bounce.&lt;/li&gt;
  &lt;li&gt;Configurable ray bias for reduce ray intersection computations error (floating point error).&lt;/li&gt;
  &lt;li&gt;Light primary visibility : toggle light visibility.&lt;/li&gt;
&lt;/ol&gt;

&lt;hr /&gt;
&lt;h2 id=&quot;2-sampler-compare&quot;&gt;2. Sampler Compare&lt;/h2&gt;
&lt;ol&gt;
  &lt;li&gt;stratified&lt;/li&gt;
  &lt;li&gt;correlated&lt;/li&gt;
  &lt;li&gt;pmj02-bn&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;21-stratified-sampling&quot;&gt;2.1 Stratified Sampling&lt;/h3&gt;

&lt;p&gt;分层采样 (stratified sampling) 将域划分为离散数量的层，并且在每个层上独立得到一个采样点。相比随机采样，通常会减少采样点的聚簇的现象，所以会有更好的收敛性。&lt;/p&gt;

&lt;div class=&quot;embed-container&quot;&gt;
    &lt;iframe src=&quot;/content/images/2022/kazen-con-v002-report/comparisons/independent_stratified.html&quot; frameborder=&quot;0&quot; border=&quot;0&quot; scrolling=&quot;no&quot;&gt;&lt;/iframe&gt;
&lt;/div&gt;
&lt;div class=&quot;figcaption&quot;&gt;Figure x: 256spp indenpendent (left) | stratified (right). For a full screen comparison, &lt;a href=&quot;/content/images/2022/kazen-con-v002-report/comparisons/independent_stratified.html&quot;&gt;click here.&lt;/a&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;22-correlated-multi-jittered-sampling&quot;&gt;2.2 Correlated multi-jittered sampling&lt;/h3&gt;

&lt;div class=&quot;embed-container&quot;&gt;
    &lt;iframe src=&quot;/content/images/2022/kazen-con-v002-report/comparisons/stratified_correlated.html&quot; frameborder=&quot;0&quot; border=&quot;0&quot; scrolling=&quot;no&quot;&gt;&lt;/iframe&gt;
&lt;/div&gt;

&lt;div class=&quot;figcaption&quot;&gt;Figure 3: 256spp stratified (left) | correlated (right). For a full screen comparison, &lt;a href=&quot;/content/images/2022/kazen-con-v002-report/comparisons/stratified_correlated.html&quot;&gt;click here.&lt;/a&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;23-progressive-multi-jittered-sampling-wtih-blue-nose&quot;&gt;2.3 Progressive multi-jittered sampling wtih blue nose&lt;/h3&gt;

&lt;div class=&quot;embed-container&quot;&gt;
    &lt;iframe src=&quot;/content/images/2022/kazen-con-v002-report/comparisons/stratified_pmj02bn_256spp.html&quot; frameborder=&quot;0&quot; border=&quot;0&quot; scrolling=&quot;no&quot;&gt;&lt;/iframe&gt;
&lt;/div&gt;

&lt;div class=&quot;figcaption&quot;&gt;Figure 5: 256spp stratified (left) | pmj02 (right). For a full screen comparison, &lt;a href=&quot;/content/images/2022/kazen-con-v002-report/comparisons/stratified_pmj02bn_256spp.html&quot;&gt;click here.&lt;/a&gt;&lt;/div&gt;

&lt;hr /&gt;
&lt;h2 id=&quot;3-geometric-shadow-terminator&quot;&gt;3. Geometric shadow terminator&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v002-report/gst.jpg&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v002-report/gst.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class=&quot;figcaption&quot;&gt;Figure x: Geometric shadow terminator 问题&lt;/div&gt;

&lt;p&gt;这个问题是由于：&lt;strong&gt;着色法线 (shading normal)&lt;/strong&gt; 与 &lt;strong&gt;几何法线 (geometric normal)&lt;/strong&gt; 不一致导致的。尤其在底模的情况下非常明显。&lt;/p&gt;

&lt;p&gt;一般来说，光线追踪过程中，要得到光滑的表面，需要对顶点法线进行插值。计算方法是：进行相交检测获得三角形的重心坐标，然后根据重心坐标进行插值。这个法线叫做&lt;strong&gt;着色法线 (shading normal)&lt;/strong&gt;。&lt;/p&gt;

&lt;p&gt;根据图x来看，在计算光源遮挡的时候，插值出来的着色法线与 shadowray 的夹角小于 90°，所以开始进行几何体相交检测，发现着色点被遮挡，那么可以认为这个点处于阴影中。通常是整个三角形被更靠近光源的三角形遮挡住，导致了带棱角的阴影瑕疵。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v002-report/QandTShadowLineShadowtest2.png&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v002-report/QandTShadowLineShadowtest2.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class=&quot;figcaption&quot;&gt;Figure x: shadowray 检测&lt;/div&gt;

&lt;p&gt;这次实现的是 &lt;a href=&quot;https://jo.dreggn.org/home/2021_terminator.pdf&quot;&gt;Johannes Hanika&lt;/a&gt; 提出的一种方法。简单来说：计算一个着色点上方的位置，作为 shadowray 的 origin 位置。其实这也很好理解：我们希望得到一个光滑的效果，也可以认为其实是对几何体构造了一个虚拟的光滑表面，这个表面顶点是沿着几何法线位移了一些，类似于曲面细分。效果如图x。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v002-report/virtualsurface.jpg&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v002-report/virtualsurface.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class=&quot;figcaption&quot;&gt;Figure x: xxxx&lt;/div&gt;

&lt;p&gt;添加 geometric shadow terminator 的对比图&lt;/p&gt;
&lt;div class=&quot;embed-container&quot; style=&quot;padding-bottom:100.0%&quot;&gt;
    &lt;iframe src=&quot;/content/images/2022/kazen-con-v002-report/comparisons/geom_shadow_terminator_compare.html&quot; frameborder=&quot;0&quot; border=&quot;0&quot; scrolling=&quot;no&quot;&gt;&lt;/iframe&gt;
&lt;/div&gt;

&lt;div class=&quot;figcaption&quot;&gt;Figure 3: 256spp stratified (left) | correlated (right). For a full screen comparison, &lt;a href=&quot;/content/images/2022/kazen-con-v002-report/comparisons/geom_shadow_terminator_compare.html&quot;&gt;click here.&lt;/a&gt;&lt;/div&gt;

&lt;hr /&gt;
&lt;h2 id=&quot;4-firefly-reduction&quot;&gt;4. Firefly reduction&lt;/h2&gt;

&lt;p&gt;Firefly 产生的原因可以看 Matt Pharr 在《Ray Tracing Gems》的第 17 章的 &lt;a href=&quot;https://link.springer.com/content/pdf/10.1007/978-1-4842-4427-2_17.pdf&quot;&gt;Ignoring the Inconvenient When
Tracing Rays&lt;/a&gt;，介绍的比较全面。&lt;/p&gt;

&lt;p&gt;简单来说：根据距离平方反比定律，一个小光源想要照亮场景的话就需要很大的能量值，比如说 radiance = 500 这样。从某个像素发出的路径，在非常小的概率下击中光源，导致 throughput 过大。一个像素的值范围是 [0, 1]，如果要消除这个很大的值，就需要后面非常多的采样才能平滑掉。&lt;/p&gt;

&lt;p&gt;这次实现了 &lt;a href=&quot;https://twitter.com/YuriyODonnell/status/1199253959086612480&quot;&gt;Yuriy O’Donnell&lt;/a&gt; 提出的方法：每一次弹射光线与场景相交，就累加一个粗糙度偏移值 (roughness bias)，然后将这个值累加给当前材质的粗糙度上。这样，随着光线深度的增加，材质累加的粗糙度会越来越大。&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-c++&quot;&gt;// https://twitter.com/YuriyODonnell/status/1199253959086612480
float oldRoughness = payload.roughness;
payload.roughness = min(1.0, payload.roughness + roughnessBias);
roughnessBias += oldRoughness *  0.2; 
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;作者原来的实现是: &lt;code&gt;roughnessBias += oldRoughness *  0.75;&lt;/code&gt; 但是 0.75 这个乘数过大，导致金属和地面交接处的焦散消失了。所以我们将这个系数暴露出来:  &lt;code&gt;accumulatedRoughnessCoff&lt;/code&gt;，使得我们可以在外面手动调节这个参数。下面的例子是 &lt;code&gt;accumulatedRoughnessCoff&lt;/code&gt; 为 0.2 的效果。&lt;/p&gt;

&lt;div class=&quot;embed-container&quot; style=&quot;padding-bottom:100.0%&quot;&gt;
    &lt;iframe src=&quot;/content/images/2022/kazen-con-v002-report/comparisons/firefly_compare.html&quot; frameborder=&quot;0&quot; border=&quot;0&quot; scrolling=&quot;no&quot;&gt;&lt;/iframe&gt;
&lt;/div&gt;
&lt;div class=&quot;figcaption&quot;&gt;Figure x:  Naive (left) | Roughness accumulated (right). &lt;br /&gt; accumulatedRoughnessCoff 为 0.2 的对比效果 &lt;a href=&quot;/content/images/2022/kazen-con-v002-report/comparisons/firefly_compare.html&quot;&gt;click here.&lt;/a&gt;&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;这里可以看到，accumulated a roughness 后的 Firefly 明显减少，但会使金属材质变得更亮了，&lt;strong&gt;效果错误&lt;/strong&gt;。
因为在金属之间的弹射 SS 路径，累加粗糙度似乎不正确，或许这种方法只适合 SDS 路径？&lt;br /&gt;
&lt;br /&gt;
后续需要阅读 &lt;a href=&quot;https://cg.ivd.kit.edu/publications/p2013/PSR_Kaplanyan_2013/PSR_Kaplanyan_2013.pdf&quot;&gt;Path Space Regularization for Holistic and Robust Light Transport&lt;/a&gt; 来寻找答案，文中提到了一种更加通用的 Vertex Connection and Merging 方法。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr /&gt;
&lt;h2 id=&quot;5-ray-epsilon&quot;&gt;5. Ray epsilon&lt;/h2&gt;

&lt;p&gt;由于在路径追踪过程中的 &lt;a href=&quot;https://en.wikipedia.org/wiki/Floating-point_arithmetic#Accuracy_problems&quot;&gt;数值精度问题&lt;/a&gt;，会出现类似 “self shadowing” 的渲染瑕疵。&lt;/p&gt;

&lt;p&gt;这是由于反射射线与被反射的表面相交。为了避免这个问题，反射光并不是从相交点开始，而是从离表面一定距离的地方开始，我们用 \(\epsilon\) &lt;code&gt;rayEpsilon&lt;/code&gt; 表示这个距离，单位是米。例如，如果射线的 \(\epsilon\) 为 0.1，那么偏移量为 0.1 米 (=10厘米)。&lt;/p&gt;

&lt;p&gt;一般来说，我们希望让射线的 \(\epsilon\) 变得非常小。根据经验，它大约是摄像机 &amp;lt;===&amp;gt; 物体距离的 1 / 100000 ~ 1 / 1000。在大多数“现实场景”的尺度范围内 ( 对象尺寸为 0.1 米 ~ 100 米 )，默认值 0.001 应该就可以了。&lt;/p&gt;

&lt;div class=&quot;embed-container&quot; style=&quot;padding-bottom:100.0%&quot;&gt;
    &lt;iframe src=&quot;/content/images/2022/kazen-con-v002-report/comparisons/rayEpsilon_compare.html&quot; frameborder=&quot;0&quot; border=&quot;0&quot; scrolling=&quot;no&quot;&gt;&lt;/iframe&gt;
&lt;/div&gt;
&lt;div class=&quot;figcaption&quot;&gt;Figure x:  rayEpsilon=0.00001 (left) | rayEpsilon=0.001 (right). &lt;br /&gt; 左侧比右侧暗，这是因为自阴影导致反射光线被截断了。另外，也能看到背景物体上明显的线条瑕疵。增加 rayEpsilon 就可以去除这类渲染瑕疵 (self-shadowing, dark lines, etc.) &lt;a href=&quot;/content/images/2022/kazen-con-v002-report/comparisons/rayEpsilon_compare.html&quot;&gt;click here.&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;在 integrator 中的 shadowRay 和 bsdf 生成新的 ray 都需要重新设置一下 rayEpsilon。例如：&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-c++&quot;&gt;/* Apply ray epsilon to shadow ray. */
lRec.shadowRay.mint = m_rayEpsilon;
lRec.shadowRay.maxt -= m_rayEpsilon;

/* Apply ray epsilon to trace ray. */
ray = Ray3f(its.p, its.toWorld(bRec.wo));
ray.mint = m_rayEpsilon;
&lt;/code&gt;&lt;/pre&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;6-final-result&quot;&gt;6. Final result&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v002-report/Stormtrooper_16384spp_1.1h.png&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v002-report/Stormtrooper_16384spp_1.1h.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class=&quot;figcaption&quot;&gt;Figure x: 1920x1080 | 16384 spp | 1.1 h. &lt;a href=&quot;https://blendswap.com/blend/13953&quot;&gt; Stormtrooper (by ScottGraham) License: CC BY 3.0 &lt;/a&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;reference&quot;&gt;Reference&lt;/h2&gt;

&lt;p&gt;[1] &lt;a href=&quot;http://www.cs.cmu.edu/afs/cs/academic/class/15462-s15/www/lec_slides/p51-cook.pdf&quot;&gt;Stochastic Sampling in Computer Graphics&lt;/a&gt; &lt;strong&gt;ROBERT L. COOK&lt;/strong&gt;. 1986&lt;/p&gt;

&lt;p&gt;[2] &lt;a href=&quot;https://graphics.pixar.com/library/MultiJitteredSampling/paper.pdf&quot;&gt;Correlated Multi-Jittered Sampling&lt;/a&gt; &lt;strong&gt;Andrew Kensler&lt;/strong&gt;. 2013&lt;/p&gt;

&lt;p&gt;[3] &lt;a href=&quot;https://andrew-helmer.github.io/permute/&quot;&gt;Andrew Kensler’s permute()&lt;/a&gt; &lt;strong&gt;Andrew Helmer&lt;/strong&gt;. 2021&lt;/p&gt;

&lt;p&gt;[4] &lt;a href=&quot;https://graphics.pixar.com/library/ProgressiveMultiJitteredSampling/paper.pdf&quot;&gt;Progressive Multi-Jittered Sample Sequences&lt;/a&gt; &lt;strong&gt;Per Christensen, Andrew Kensler and Charlie Kilpatrick&lt;/strong&gt;. 2015&lt;/p&gt;

&lt;p&gt;[5] &lt;a href=&quot;https://www.pbrt.org/&quot;&gt;Physically Based Rendering v4: from theory to implementation&lt;/a&gt; &lt;strong&gt;Matt Pharr, Wenzel Jakob and Greg Humphreys&lt;/strong&gt;. 2023&lt;/p&gt;

&lt;p&gt;[6] &lt;a href=&quot;https://jo.dreggn.org/home/2021_terminator.pdf&quot;&gt;Hacking the Shadow Terminator&lt;/a&gt; &lt;strong&gt;Johannes Hanika&lt;/strong&gt;. 2021&lt;/p&gt;

&lt;p&gt;[7] &lt;a href=&quot;https://twitter.com/YuriyODonnell/status/1199253959086612480&quot;&gt;Accumulate a roughness bias based on roughness of hitting surface&lt;/a&gt; &lt;strong&gt;Yuriy O’Donnell&lt;/strong&gt;. 2019&lt;/p&gt;

&lt;p&gt;[8] &lt;a href=&quot;https://alain.xyz/blog/ray-tracing-denoising#statistical-analysis&quot;&gt;Ray Tracing Denoisinge&lt;/a&gt; &lt;strong&gt;Alain Galvan&lt;/strong&gt;. 2020&lt;/p&gt;

</content>
  </entry>
  
  <entry>
    <id>https://Kazen-Renderer.github.io//2022/05/rez-cpp-dev-env.html</id>
    <link type="text/html" rel="alternate" href="https://Kazen-Renderer.github.io//2022/05/rez-cpp-dev-env.html"/>
    <title>使用 Rez 作为包管理工具开发 c++</title>
    <published>2022-05-23T00:00:00+00:00</published>
    <updated>2022-05-23T00:00:00+00:00</updated>
    <author>
        <name>Kazen Renderer</name>
    </author>
    <content type="html">&lt;ul&gt;
  &lt;li&gt;Rez 是什么
    &lt;ul&gt;
      &lt;li&gt;rez 是什么?&lt;/li&gt;
      &lt;li&gt;包管理是什么&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;安装 Rez
    &lt;ul&gt;
      &lt;li&gt;wsl2 安装开发&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;写一个简单的 Rez package
    &lt;ul&gt;
      &lt;li&gt;cmake / python 基础知识推荐视频&lt;/li&gt;
      &lt;li&gt;rp 中的 cmake / python 基本套路&lt;/li&gt;
    &lt;/ul&gt;

    &lt;h2 id=&quot;什么是pkg-config&quot;&gt;什么是pkg-config&lt;/h2&gt;

    &lt;p&gt;简单理解，pkg-config根据&lt;code&gt;.pc&lt;/code&gt;结尾的文件做依赖配置。
 找到.pc文件周，解析其内容，然后对底层构建工具（C/C++编译器、链接器）或高层构建工具（automake?, cmake）提供具体配置项目。&lt;/p&gt;

    &lt;p&gt;通常是在POSIX系统（Linux，MacOS等）使用pkg-config，解决第三方依赖项配置问题。&lt;/p&gt;

    &lt;p&gt;近些年来随着CMake的越发流行，原本用pkg-config的很多软件包提供了cmake的配置作为替代；少部分仍然提供.pc文件作为兼容考虑；还有另外一小部分的软件包，即使基于cmake构建了，对外提供依赖配置时仍然只有.pc文件。&lt;/p&gt;

    &lt;p&gt;这就导致一个问题：虽然我学会了cmake在大部分时候都能解决依赖问题，但个别格楞子软件包还是要用pkg-config来搞。&lt;/p&gt;

    &lt;h2 id=&quot;building-packages&quot;&gt;Building Packages&lt;/h2&gt;

    &lt;p&gt;rez包可以使用rez-build工具来构建和本地安装。这个工具有以下操作：&lt;/p&gt;

    &lt;ul&gt;
      &lt;li&gt;遍历一个包的变体&lt;/li&gt;
      &lt;li&gt;构建环境&lt;/li&gt;
      &lt;li&gt;在此环境中运行构建系统&lt;/li&gt;
    &lt;/ul&gt;

    &lt;p&gt;每一个构建都来自构建的目录路径。（通常是构建的子目录或构建下的变体特定子目录）
例如一个包含两个基本python变体的程序包：&lt;/p&gt;

    &lt;h2 id=&quot;env-cmake&quot;&gt;ENV cmake&lt;/h2&gt;

    &lt;p&gt;Operator to read environment variables.&lt;/p&gt;

    &lt;p&gt;Use the syntax &lt;code&gt;$ENV{VAR}&lt;/code&gt; to read environment variable &lt;code&gt;VAR&lt;/code&gt;.&lt;/p&gt;

    &lt;p&gt;To test whether an environment variable is defined, use the signature &lt;code&gt;if(DEFINED ENV{&amp;lt;name&amp;gt;})&lt;/code&gt; of the &lt;a href=&quot;https://cmake.org/cmake/help/latest/command/if.html#command:if&quot;&gt;&lt;code&gt;if()&lt;/code&gt;&lt;/a&gt; command.&lt;/p&gt;

    &lt;p&gt;See the &lt;a href=&quot;https://cmake.org/cmake/help/latest/command/set.html#command:set&quot;&gt;&lt;code&gt;set()&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;https://cmake.org/cmake/help/latest/command/unset.html#command:unset&quot;&gt;&lt;code&gt;unset()&lt;/code&gt;&lt;/a&gt; commands to see how to write or remove environment variables.&lt;/p&gt;

    &lt;h2 id=&quot;cmake_prefix_path&quot;&gt;CMAKE_PREFIX_PATH&lt;/h2&gt;

    &lt;p&gt;&lt;a href=&quot;https://cmake.org/cmake/help/latest/manual/cmake-language.7.html#cmake-language-lists&quot;&gt;Semicolon-separated list&lt;/a&gt; of directories specifying installation &lt;em&gt;prefixes&lt;/em&gt; to be searched by the &lt;a href=&quot;https://cmake.org/cmake/help/latest/command/find_package.html#command:find_package&quot;&gt;&lt;code&gt;find_package()&lt;/code&gt;&lt;/a&gt;, &lt;a href=&quot;https://cmake.org/cmake/help/latest/command/find_program.html#command:find_program&quot;&gt;&lt;code&gt;find_program()&lt;/code&gt;&lt;/a&gt;, &lt;a href=&quot;https://cmake.org/cmake/help/latest/command/find_library.html#command:find_library&quot;&gt;&lt;code&gt;find_library()&lt;/code&gt;&lt;/a&gt;, &lt;a href=&quot;https://cmake.org/cmake/help/latest/command/find_file.html#command:find_file&quot;&gt;&lt;code&gt;find_file()&lt;/code&gt;&lt;/a&gt;, and &lt;a href=&quot;https://cmake.org/cmake/help/latest/command/find_path.html#command:find_path&quot;&gt;&lt;code&gt;find_path()&lt;/code&gt;&lt;/a&gt; commands. Each command will add appropriate subdirectories (like &lt;code&gt;bin&lt;/code&gt;, &lt;code&gt;lib&lt;/code&gt;, or &lt;code&gt;include&lt;/code&gt;) as specified in its own documentation.&lt;/p&gt;

    &lt;p&gt;By default this is empty. It is intended to be set by the project.&lt;/p&gt;

    &lt;h2 id=&quot;build-environment-variables&quot;&gt;Build Environment Variables&lt;/h2&gt;

    &lt;p&gt;https://github.com/AcademySoftwareFoundation/rez/wiki/Environment-Variables&lt;/p&gt;

    &lt;p&gt;These are variables that rez generates within a build environment, in addition to those listed &lt;a href=&quot;https://github.com/AcademySoftwareFoundation/rez/wiki/Environment-Variables#context-environment-variables&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

    &lt;ul&gt;
      &lt;li&gt;&lt;strong&gt;REZ_BUILD_ENV&lt;/strong&gt; - Always present in a build, has value 1.&lt;/li&gt;
      &lt;li&gt;&lt;strong&gt;REZ_BUILD_INSTALL&lt;/strong&gt; - Has a value of 1 if an installation is taking place (either a &lt;em&gt;rez-build -i&lt;/em&gt; or &lt;em&gt;rez-release&lt;/em&gt;), otherwise 0.&lt;/li&gt;
      &lt;li&gt;&lt;strong&gt;REZ_BUILD_INSTALL_PATH&lt;/strong&gt; - Installation path, if an install is taking place.&lt;/li&gt;
      &lt;li&gt;&lt;strong&gt;REZ_BUILD_PATH&lt;/strong&gt; - Path where build output goes.&lt;/li&gt;
      &lt;li&gt;&lt;strong&gt;REZ_BUILD_PROJECT_DESCRIPTION&lt;/strong&gt; - Equal to the &lt;em&gt;description&lt;/em&gt; attribute of the package being built.&lt;/li&gt;
      &lt;li&gt;&lt;strong&gt;REZ_BUILD_PROJECT_FILE&lt;/strong&gt; - The filepath of the package being built (typically a &lt;em&gt;package.py&lt;/em&gt; file).&lt;/li&gt;
      &lt;li&gt;&lt;strong&gt;REZ_BUILD_PROJECT_NAME&lt;/strong&gt; - Name of the package being built.&lt;/li&gt;
      &lt;li&gt;&lt;strong&gt;REZ_BUILD_PROJECT_VERSION&lt;/strong&gt; - Version of the package being built.&lt;/li&gt;
      &lt;li&gt;&lt;strong&gt;REZ_BUILD_REQUIRES&lt;/strong&gt; - Space-separated list of requirements for the build - comes from the current package’s &lt;em&gt;requires&lt;/em&gt;, &lt;em&gt;build_requires&lt;/em&gt; and &lt;em&gt;private_build_requires&lt;/em&gt; attributes, including the current variant’s requirements.&lt;/li&gt;
      &lt;li&gt;&lt;strong&gt;REZ_BUILD_REQUIRES_UNVERSIONED&lt;/strong&gt; - Equivalent but unversioned list to &lt;em&gt;REZ_BUILD_REQUIRES&lt;/em&gt;.&lt;/li&gt;
      &lt;li&gt;&lt;strong&gt;REZ_BUILD_SOURCE_PATH&lt;/strong&gt; - Path containing the package.py file.&lt;/li&gt;
      &lt;li&gt;&lt;strong&gt;REZ_BUILD_THREAD_COUNT&lt;/strong&gt; - Number of threads being used for the build.&lt;/li&gt;
      &lt;li&gt;&lt;strong&gt;REZ_BUILD_TYPE&lt;/strong&gt; - One of &lt;em&gt;local&lt;/em&gt; or &lt;em&gt;central&lt;/em&gt;. Value is &lt;em&gt;central&lt;/em&gt; if a release is occurring.&lt;/li&gt;
      &lt;li&gt;&lt;strong&gt;REZ_BUILD_VARIANT_INDEX&lt;/strong&gt; - Zero-based index of the variant currently being built. For non-varianted packages, this is “0”.&lt;/li&gt;
      &lt;li&gt;&lt;strong&gt;REZ_BUILD_VARIANT_REQUIRES&lt;/strong&gt; - Space-separated list of runtime requirements of the current variant. This does not include the common requirements as found in &lt;em&gt;REZ_BUILD_REQUIRES&lt;/em&gt;. For non-varianted builds, this is an empty string.&lt;/li&gt;
      &lt;li&gt;
        &lt;p&gt;&lt;strong&gt;REZ_BUILD_VARIANT_SUBPATH&lt;/strong&gt; - Subdirectory containing the current variant. For non-varianted builds, this is an empty string.&lt;/p&gt;
      &lt;/li&gt;
      &lt;li&gt;tbb 包生成&lt;/li&gt;
      &lt;li&gt;测试 tbb
        &lt;ul&gt;
          &lt;li&gt;target 名字是 TBB::tbb，可以在 kazen\packages\tbb\2021.2.0\platform-linux\arch-x86_64\lib\cmake\TBB\TBBTargets.cmake&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;阶段总结&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;ul&gt;
  &lt;li&gt;写一个复杂库的 Rez package
    &lt;ul&gt;
      &lt;li&gt;embree3&lt;/li&gt;
      &lt;li&gt;测试 embree 3 功能&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;写一个纯头文件库的 Rez package
    &lt;ul&gt;
      &lt;li&gt;tinyobjloader&lt;/li&gt;
      &lt;li&gt;测试 tinyobjloader 功能&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;写一个自己的启动环境，测试开发
    &lt;ul&gt;
      &lt;li&gt;vfx platform 介绍&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;Rez 优缺点分析&lt;/li&gt;
  &lt;li&gt;阶段总结&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  
  <entry>
    <id>https://Kazen-Renderer.github.io//2022/05/wsl2-cpp-setup.html</id>
    <link type="text/html" rel="alternate" href="https://Kazen-Renderer.github.io//2022/05/wsl2-cpp-setup.html"/>
    <title>c++ 开发环境搭建 (wsl2)</title>
    <published>2022-05-22T00:00:00+00:00</published>
    <updated>2022-05-22T00:00:00+00:00</updated>
    <author>
        <name>Kazen Renderer</name>
    </author>
    <content type="html">&lt;h1 id=&quot;1-适用于-linux-的-windows-子系统-wsl&quot;&gt;1. 适用于 Linux 的 Windows 子系统 (wsl)&lt;/h1&gt;

&lt;p&gt;&lt;a href=&quot;https://docs.microsoft.com/zh-cn/windows/wsl/&quot;&gt;https://docs.microsoft.com/zh-cn/windows/wsl/&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;11-安装&quot;&gt;1.1 安装&lt;/h2&gt;

&lt;pre&gt;&lt;code&gt;$ wsl --list --online
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;以下是可安装的有效分发的列表。
请使用“wsl --install -d &amp;lt;分发&amp;gt;”安装。

NAME            FRIENDLY NAME
Ubuntu          Ubuntu
Debian          Debian GNU/Linux
kali-linux      Kali Linux Rolling
openSUSE-42     openSUSE Leap 42
SLES-12         SUSE Linux Enterprise Server v12
Ubuntu-16.04    Ubuntu 16.04 LTS
Ubuntu-18.04    Ubuntu 18.04 LTS
Ubuntu-20.04    Ubuntu 20.04 LTS
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;安装 Ubuntu 20.04 LTS 版本&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ wsl --install -d Ubuntu-20.04
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&quot;12-卸载&quot;&gt;1.2 卸载&lt;/h2&gt;

&lt;p&gt;检查已经安装的 wsl2 系统&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ wsl --list
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;适用于 Linux 的 Windows 子系统分发版:
Ubuntu-20.04
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;卸载 Ubuntu-20.04&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ wsl --unregister Ubuntu-20.04
&lt;/code&gt;&lt;/pre&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;2-ubuntu-2004-软件源更新&quot;&gt;2. Ubuntu-20.04 软件源更新&lt;/h1&gt;

&lt;p&gt;默认情况下Ubuntu 的apt下载源是国外的仓库，我们可以将它的默认下载地址切换到国内环境下，例如阿里云的镜像地址。&lt;/p&gt;

&lt;h2 id=&quot;21-备份&quot;&gt;2.1 备份&lt;/h2&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ sudo cp /etc/apt/sources.list /etc/apt/sources.list.bakup
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&quot;22-修改&quot;&gt;2.2 修改&lt;/h2&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ sudo vim /etc/apt/sources.list
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;将 &lt;code&gt;sources.list&lt;/code&gt; 文件内容替换成下面的&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&quot;23-更新&quot;&gt;2.3 更新&lt;/h2&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ sudo apt-get update
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&quot;24-升级&quot;&gt;2.4 升级&lt;/h2&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ sudo apt-get upgrade
&lt;/code&gt;&lt;/pre&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;3-安装-zsh&quot;&gt;3. 安装 zsh&lt;/h1&gt;

&lt;p&gt;&lt;a href=&quot;https://www.zsh.org/&quot;&gt;zsh&lt;/a&gt; 是 Z shell 的简称。用于交互式登录的 shell 及脚本编写的命令解释器，可以拓展一些功能丰富的第三方插件和主题，提高 shell 使用效率。&lt;/p&gt;

&lt;h2 id=&quot;31-安装&quot;&gt;3.1 安装&lt;/h2&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ sudo apt-get install zsh
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&quot;32-检查&quot;&gt;3.2 检查&lt;/h2&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ cat /etc/shells
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;# /etc/shells: valid login shells
/bin/sh
/bin/bash
/usr/bin/bash
/bin/rbash
/usr/bin/rbash
/bin/dash
/usr/bin/dash
/usr/bin/tmux
/usr/bin/screen
/bin/zsh
/usr/bin/zsh
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&quot;33-启动-zsh&quot;&gt;3.3 启动 zsh&lt;/h2&gt;

&lt;p&gt;输入命令&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ zsh
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;可以看到第一次运行 zsh 时会进入如下的配置引导页面：&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;This is the Z Shell configuration function for new users,
zsh-newuser-install.
You are seeing this message because you have no zsh startup files
(the files .zshenv, .zprofile, .zshrc, .zlogin in the directory
~).  This function can help you with a few settings that should
make your use of the shell easier.
​
You can:
​
(q)  Quit and do nothing.  The function will be run again next time.
​
(0)  Exit, creating the file ~/.zshrc containing just a comment.
     That will prevent this function being run again.
​
(1)  Continue to the main menu.
​
--- Type one of the keys in parentheses ---
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;这里我们选择 q 直接退出。&lt;/p&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;4-安装-oh-my-zsh&quot;&gt;4. 安装 oh-my-zsh&lt;/h1&gt;

&lt;p&gt;由于 zsh 配置较为复杂，推荐使用配置管理工具来配置 zsh。下面介绍使用 &lt;a href=&quot;https://ohmyz.sh/&quot;&gt;oh-my-zsh&lt;/a&gt; 来修改 zsh 的主题和安装常用的插件。&lt;/p&gt;

&lt;h2 id=&quot;41-安装&quot;&gt;4.1 安装&lt;/h2&gt;

&lt;p&gt;获取源码&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ git clone https://gitee.com/mirrors/oh-my-zsh.git
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;执行安装命令&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ sh oh-my-zsh/tools/install.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;完成后可以看到如下界面&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;Cloning Oh My Zsh...
remote: Enumerating objects: 1295, done.
remote: Counting objects: 100% (1295/1295), done.
remote: Compressing objects: 100% (1249/1249), done.
remote: Total 1295 (delta 26), reused 1250 (delta 26), pack-reused 0
Receiving objects: 100% (1295/1295), 1.06 MiB | 3.69 MiB/s, done.
Resolving deltas: 100% (26/26), done.
From https://github.com/ohmyzsh/ohmyzsh
 * [new branch]      master     -&amp;gt; origin/master
Branch 'master' set up to track remote branch 'master' from 'origin'.
Already on 'master'
/home/kazen/oh-my-zsh/tools

Looking for an existing zsh config...
Using the Oh My Zsh template file and adding it to ~/.zshrc.

Time to change your default shell to zsh:
Do you want to change your default shell to zsh? [Y/n] y
Changing your shell to /usr/bin/zsh...
[sudo] password for kazen:
Shell successfully changed to '/usr/bin/zsh'.

         __                                     __
  ____  / /_     ____ ___  __  __   ____  _____/ /_
 / __ \/ __ \   / __ `__ \/ / / /  /_  / / ___/ __ \
/ /_/ / / / /  / / / / / / /_/ /    / /_(__  ) / / /
\____/_/ /_/  /_/ /_/ /_/\__, /    /___/____/_/ /_/
                        /____/                       ....is now installed!


Before you scream Oh My Zsh! look over the `.zshrc` file to select plugins, themes, and options.

• Follow us on Twitter: @ohmyzsh
• Join our Discord community: Discord server
• Get stickers, t-shirts, coffee mugs and more: Planet Argon Shop
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&quot;42-配置-zsh&quot;&gt;4.2 配置 zsh&lt;/h2&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ vim ~/.zshrc
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;**主题修改&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ZSH_THEME=&quot;robbyrussell&quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;其中可以将 robbyrussell 改为 &lt;a href=&quot;https://github.com/ohmyzsh/ohmyzsh/wiki/Themes&quot;&gt;Theme&lt;/a&gt; 中的任意一种，比如 &lt;code&gt;ZSH_THEME=&quot;agnoster&quot;&lt;/code&gt; 。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;插件配置&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;plugins=(git)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;修改为&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;plugins=(git zsh-autosuggestions)
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&quot;43-安装-autosuggestion-插件&quot;&gt;4.3 安装 autosuggestion 插件&lt;/h2&gt;

&lt;p&gt;上面我们为 zsh 配置了 autosuggestions 插件，但这个插件并不是 zsh 自带的插件，需要下载安装。&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;安装完成后，重新更新配置。&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ source .zshrc
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;在编辑指令的时候，对于之前使用过的指令，按 &lt;code&gt;→&lt;/code&gt; 即可快速补全。&lt;/p&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;5-c-cmake-开发环境搭建&quot;&gt;5. c++ (cmake) 开发环境搭建&lt;/h1&gt;

&lt;p&gt;我们需要在 Windows 环境中安装 VS Code。从官网下载最新版本，直接安装：&lt;a href=&quot;https://link.zhihu.com/?target=https%3A//code.visualstudio.com/&quot;&gt;https://code.visualstudio.com/&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;51-基础软件安装&quot;&gt;5.1 基础软件安装&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;build-essential&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;构建基础包（&lt;code&gt;build-essential&lt;/code&gt;）实际上是属于 Debian 的。在它里面其实并不是一个软件。它包含了创建一个 Debian 包（&lt;code&gt;.deb&lt;/code&gt;）所需的软件包列表。这些软件包包括 &lt;code&gt;libc&lt;/code&gt;、&lt;code&gt;gcc&lt;/code&gt;、&lt;code&gt;g++&lt;/code&gt;、&lt;code&gt;make&lt;/code&gt; 等。构建基础包包含这些所需的软件包作为依赖，所以当你安装它时，你只需一个命令就能安装所有这些软件包。&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ sudo apt-get install build-essential
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;em&gt;GDB&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;全称 GNU symbolic debugger，是 Linux 下常用的程序调试器。&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ sudo apt-get install gdb
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;em&gt;CMake&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;是一种优秀的跨平台的构建系统，类似于 Makefile，是专为 C/C++ 开发的一套构建系统。&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ sudo apt install cmake
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;em&gt;Remote-WSL&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;在 Windows 环境中安装 VS Code。&lt;a href=&quot;https://code.visualstudio.com/&quot;&gt;官网&lt;/a&gt;下载最新版本并安装&lt;/li&gt;
  &lt;li&gt;在 VS Code 的插件市场，搜索 &lt;code&gt;remote-wsl&lt;/code&gt; 插件，然后安装&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;52-测试&quot;&gt;5.2 测试&lt;/h2&gt;

&lt;p&gt;创建一个文件夹 test ，然后进入文件夹。&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ mkdir test
$ cd test
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;在文件夹中启动 vscode&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ code .
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;新建 main.cpp 文件，完成代码&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-cpp&quot;&gt;#include &amp;lt;iostream&amp;gt;

using namespace std;
int main() {
    cout &amp;lt;&amp;lt; &quot;Hell World!&quot; &amp;lt;&amp;lt; endl;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;新建 CMakeLists.txt 文件，完成代码&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cmake_minimum_required (VERSION 3.10)
project (test)
add_executable(test main.cpp)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;构建应用程序&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ cmake .
$ make
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;测试应用程序&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ ./test
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;Hell World!
&lt;/code&gt;&lt;/pre&gt;

</content>
  </entry>
  
  <entry>
    <id>https://Kazen-Renderer.github.io//2022/05/sampler-compare.html</id>
    <link type="text/html" rel="alternate" href="https://Kazen-Renderer.github.io//2022/05/sampler-compare.html"/>
    <title>Sampler 的比较</title>
    <published>2022-05-19T00:00:00+00:00</published>
    <updated>2022-05-19T00:00:00+00:00</updated>
    <author>
        <name>Kazen Renderer</name>
    </author>
    <content type="html">&lt;div class=&quot;embed-container&quot;&gt;
    &lt;iframe src=&quot;/content/images/2022/sampler-compare/comparisons/independent_stratified.html&quot; frameborder=&quot;0&quot; border=&quot;0&quot; scrolling=&quot;no&quot;&gt;&lt;/iframe&gt;
&lt;/div&gt;
&lt;div class=&quot;figcaption&quot;&gt;Figure 1:  indenpendent (left) | stratified (right). For a full screen comparison, &lt;a href=&quot;/content/images/2022/sampler-compare/comparisons/independent_stratified.html&quot;&gt;click here.&lt;/a&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;div class=&quot;embed-container&quot;&gt;
    &lt;iframe src=&quot;/content/images/2022/sampler-compare/comparisons/independent_correlated.html&quot; frameborder=&quot;0&quot; border=&quot;0&quot; scrolling=&quot;no&quot;&gt;&lt;/iframe&gt;
&lt;/div&gt;
&lt;div class=&quot;figcaption&quot;&gt;Figure 2:  indenpendent (left) | correlated (right). For a full screen comparison, &lt;a href=&quot;/content/images/2022/sampler-compare/comparisons/independent_correlated.html&quot;&gt;click here.&lt;/a&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;div class=&quot;embed-container&quot;&gt;
    &lt;iframe src=&quot;/content/images/2022/sampler-compare/comparisons/stratified_correlated.html&quot; frameborder=&quot;0&quot; border=&quot;0&quot; scrolling=&quot;no&quot;&gt;&lt;/iframe&gt;
&lt;/div&gt;

&lt;div class=&quot;figcaption&quot;&gt;Figure 3:  stratified (left) | correlated (right). For a full screen comparison, &lt;a href=&quot;/content/images/2022/sampler-compare/comparisons/stratified_correlated.html&quot;&gt;click here.&lt;/a&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;div class=&quot;embed-container&quot;&gt;
    &lt;iframe src=&quot;/content/images/2022/sampler-compare/comparisons/stratified_pmj02bn_16spp.html&quot; frameborder=&quot;0&quot; border=&quot;0&quot; scrolling=&quot;no&quot;&gt;&lt;/iframe&gt;
&lt;/div&gt;

&lt;div class=&quot;figcaption&quot;&gt;Figure 4: 16spp  stratified (left) | pmj02 (right). For a full screen comparison, &lt;a href=&quot;/content/images/2022/sampler-compare/comparisons/stratified_pmj02bn_16spp.html&quot;&gt;click here.&lt;/a&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;div class=&quot;embed-container&quot;&gt;
    &lt;iframe src=&quot;/content/images/2022/sampler-compare/comparisons/stratified_pmj02bn_256spp.html&quot; frameborder=&quot;0&quot; border=&quot;0&quot; scrolling=&quot;no&quot;&gt;&lt;/iframe&gt;
&lt;/div&gt;

&lt;div class=&quot;figcaption&quot;&gt;Figure 5:  256spp stratified (left) | pmj02 (right). For a full screen comparison, &lt;a href=&quot;/content/images/2022/sampler-compare/comparisons/stratified_pmj02bn_256spp.html&quot;&gt;click here.&lt;/a&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;div class=&quot;embed-container&quot;&gt;
    &lt;iframe src=&quot;/content/images/2022/sampler-compare/comparisons/test.html&quot; frameborder=&quot;0&quot; border=&quot;0&quot; scrolling=&quot;no&quot;&gt;&lt;/iframe&gt;
&lt;/div&gt;

&lt;div class=&quot;figcaption&quot;&gt;Figure 6:  test. For a full screen comparison, &lt;a href=&quot;/content/images/2022/sampler-compare/comparisons/test.html&quot;&gt;click here.&lt;/a&gt;&lt;/div&gt;
</content>
  </entry>
  
  <entry>
    <id>https://Kazen-Renderer.github.io//2022/04/kazen-con-v001-report.html</id>
    <link type="text/html" rel="alternate" href="https://Kazen-Renderer.github.io//2022/04/kazen-con-v001-report.html"/>
    <title>Kazen Con 2022-Q1 总结</title>
    <published>2022-04-01T00:00:00+00:00</published>
    <updated>2022-04-01T00:00:00+00:00</updated>
    <author>
        <name>Kazen Renderer</name>
    </author>
    <content type="html">&lt;p&gt;&lt;a href=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/final_3.4h_4k_10000spp.jpg&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/final_3.4h_4k_10000spp.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;1-core-feature&quot;&gt;1. Core Feature&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;Monte Carlo unbiased path tracing&lt;/li&gt;
  &lt;li&gt;multiple importance sample&lt;/li&gt;
  &lt;li&gt;Material ：kazen initial standard surface ( kiss )
    &lt;ol&gt;
      &lt;li&gt;diffuse ：Disney diffuse with Retro-Reflective&lt;/li&gt;
      &lt;li&gt;specular ：GGX-Smith BRDF with VNDF&lt;/li&gt;
      &lt;li&gt;clearcoat ：GGX-Smith BRDF with VNDF&lt;/li&gt;
      &lt;li&gt;sheen ：Disney sheen&lt;/li&gt;
    &lt;/ol&gt;
  &lt;/li&gt;
  &lt;li&gt;Textures and simple textures ops ( nested blend, ramp color, scale uv )&lt;/li&gt;
  &lt;li&gt;OIIO texture system&lt;/li&gt;
  &lt;li&gt;Normal mapping&lt;/li&gt;
  &lt;li&gt;Camera : Perspective / Thin Lens&lt;/li&gt;
  &lt;li&gt;Light : mesh light, basic environment ( Blinn/Newell Latitude Mapping )&lt;/li&gt;
&lt;/ol&gt;

&lt;hr /&gt;
&lt;h2 id=&quot;2-kiss-pbr-shading-model&quot;&gt;2. KISS PBR shading model&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;KISS&lt;/strong&gt; (kazen initial standard surface) , is a linear blend of a metallic BSDF and a dielectric BSDF, see &lt;strong&gt;Figure 1&lt;/strong&gt;. Currently we only support opaque dielectric BSDF and it can be used as materials like plastics, wood, or stone.&lt;/p&gt;

&lt;div align=&quot;center&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/kiss_sm.jpg&quot; width=&quot;320&quot; /&gt;&lt;/div&gt;
&lt;div class=&quot;figcaption&quot;&gt;Figure 1: Structure of the KISS PBR Shading Model.&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;KISS&lt;/strong&gt; blend metallic and dielectric BSDFs based on parameters &lt;strong&gt;metallic&lt;/strong&gt;.&lt;/p&gt;

&lt;div align=&quot;center&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/kiss_algo.jpg&quot; width=&quot;320&quot; /&gt;&lt;/div&gt;
&lt;div class=&quot;figcaption&quot;&gt;Figure 2: The KISS BRDF is a blend of metallic and dielectric BRDF models based on a metallic shader parameter.&lt;/div&gt;

&lt;p&gt;For sampling the BRDF, I first use Russian-roulette to decide between sampling the diffuse lobe or the specular lobes with the following ratio:&lt;/p&gt;

&lt;div align=&quot;center&quot;&gt;
$$ ratio_{diffuse} = \frac{1 - metallic}{2} $$
&lt;/div&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;The specular samples are divided into sampling the GGX (specular lobe) and GGX (clearcoat lobe) distribution with the following ratio:&lt;/p&gt;

&lt;div align=&quot;center&quot;&gt;
$$ ratio_{GGX} = \frac{1}{1 + clearcoat} $$
&lt;/div&gt;

&lt;p&gt;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.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-c++&quot;&gt;// diffuse weight
float ratioDiffuse = (1.0f - metallic) / 2;

// specular weight
float ratioGGX = 1.0f / (1.0f + clearcoat);
&lt;/code&gt;&lt;/pre&gt;

&lt;hr /&gt;
&lt;p&gt;These following images shows material parameters support by &lt;strong&gt;KISS&lt;/strong&gt;:&lt;/p&gt;

&lt;h3 id=&quot;21-roughness&quot;&gt;2.1 roughness&lt;/h3&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;0.0&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;0.5&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/param/m0.0_r0.png&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/param/m0.0_r0.5.png&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;strong&gt;0.0&lt;/strong&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;strong&gt;1.0&lt;/strong&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/param/m0.0_r0.png&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/param/m0.0_r1.png&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;22-metallic&quot;&gt;2.2 metallic&lt;/h3&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;0.0&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;0.5&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/param/m1_r0.png&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/param/m1_r0.5.png&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;strong&gt;0.0&lt;/strong&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;strong&gt;1.0&lt;/strong&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/param/m1_r0.png&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/param/m1_r1.png&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;23-specular&quot;&gt;2.3 specular&lt;/h3&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;0.0&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;0.5&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/param/m0_r0_spec0.png&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/param/m0_r0_spec0.5.png&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;strong&gt;0.0&lt;/strong&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;strong&gt;1.0&lt;/strong&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/param/m0_r0_spec0.png&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/param/m0_r0_spec1.png&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;24-speculartint&quot;&gt;2.4 specularTint&lt;/h3&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;0.0&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;0.5&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/param/m0_r0_spec1.png&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/param/m0_r0_spec1_st0.5.png&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;strong&gt;0.0&lt;/strong&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;strong&gt;1.0&lt;/strong&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/param/m0_r0_spec1.png&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/param/m0_r0_spec1_st1.png&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;25-clearcoat&quot;&gt;2.5 clearcoat&lt;/h3&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;0.0&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;0.5&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/param/r0.5_c0.png&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/param/r0.5_c0.5.png&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;strong&gt;0.0&lt;/strong&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;strong&gt;1.0&lt;/strong&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/param/r0.5_c0.png&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/param/r0.5_c1.png&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;hr /&gt;
&lt;h3 id=&quot;26-clearcoatroughness&quot;&gt;2.6 clearcoatRoughness&lt;/h3&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;0.0&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;0.5&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/param/r0.5_c1.png&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/param/r0.5_c1_cr0.5.png&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;strong&gt;0.0&lt;/strong&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;strong&gt;1.0&lt;/strong&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/param/r0.5_c1.png&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/param/r0.5_c1_cr1.png&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;27-sheen&quot;&gt;2.7 sheen&lt;/h3&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;0.0&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;0.5&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/param/r0_s0.png&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/param/r0_s0.5.png&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;strong&gt;0.0&lt;/strong&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;strong&gt;1.0&lt;/strong&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/param/r0_s0.png&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/param/r0_s1.png&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;28-sheentint&quot;&gt;2.8 sheenTint&lt;/h3&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;0.0&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;0.5&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/param/r0_s1.png&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/param/r0_s1_st0.5.png&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;strong&gt;0.0&lt;/strong&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;strong&gt;1.0&lt;/strong&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/param/r0_s1.png&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/param/r0_s1_st1.png&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;3-debug-error&quot;&gt;3. Debug Error&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/m0_r0_spec0.5_error.png&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/m0_r0_spec0.5_error.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class=&quot;figcaption&quot;&gt;Figure 3: Firefly error and incorrect color bleeding in shadow | 4096 spp.&lt;/div&gt;

&lt;p&gt;This error occurred when we set integrator &lt;strong&gt;&lt;code&gt;maxDepth&lt;/code&gt;&lt;/strong&gt; 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.&lt;/p&gt;

&lt;p&gt;Althrought, kill light path by &lt;strong&gt;&lt;code&gt;maxDepth&lt;/code&gt;&lt;/strong&gt; without compensation will cause statistics bias.&lt;/p&gt;

&lt;div class=&quot;embed-container&quot;&gt;
    &lt;iframe src=&quot;/content/images/2022/kazen-con-v001-report/comparisons/beforeafter_maxdepth_error.html&quot; frameborder=&quot;0&quot; border=&quot;0&quot; scrolling=&quot;no&quot;&gt;&lt;/iframe&gt;
&lt;/div&gt;
&lt;div class=&quot;figcaption&quot;&gt;Figure 4: maxDepth=5 (left) and maxDepth=1024 (right). For a full screen comparison, &lt;a href=&quot;/content/images/2022/kazen-con-v001-report/comparisons/beforeafter_maxdepth_error.html&quot;&gt;click here.&lt;/a&gt;&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;code&gt;maxDepth&lt;/code&gt; parameter is found when I check cycles render setting : Light path, by default it sets &lt;code&gt;maxBounces&lt;/code&gt; to 4.&lt;br /&gt;
&lt;strong&gt;So the take-away is : Reverse thinking code logic by ground truth (cycles) results, not just debug through code.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;4-look-dev&quot;&gt;4. Look-dev&lt;/h2&gt;

&lt;p&gt;This shows the &lt;strong&gt;cycles&lt;/strong&gt; shading graph.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/cycles_shader_graph.jpg&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/cycles_shader_graph.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class=&quot;figcaption&quot;&gt;Figure 5: The shading graph for creating the look.&lt;/div&gt;

&lt;p&gt;The corresponding &lt;strong&gt;nano-Kazen&lt;/strong&gt; material scene graph:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-xml&quot;&gt;&amp;lt;bsdf type=&quot;normalmap&quot;&amp;gt;
    &amp;lt;texture type=&quot;imagetexture&quot;&amp;gt;
        &amp;lt;string name=&quot;filename&quot; value=&quot;textures/MSMC_Brass_Hammered_Normal.jpg&quot;/&amp;gt;
        &amp;lt;float name=&quot;scale&quot; value=&quot;1.0&quot;/&amp;gt;
        &amp;lt;string name=&quot;colorspace&quot; value=&quot;linear&quot;/&amp;gt;
    &amp;lt;/texture&amp;gt;
    &amp;lt;bsdf type=&quot;kazenstandard&quot;&amp;gt;
        &amp;lt;texture type=&quot;blend&quot; id=&quot;baseColor&quot;&amp;gt;
            &amp;lt;string name=&quot;blendmode&quot; value=&quot;mix&quot;/&amp;gt;
            &amp;lt;texture type=&quot;constanttexture&quot; id=&quot;input1&quot;&amp;gt;
                &amp;lt;color name=&quot;color&quot; value=&quot;0.887923 0.351533 0.002125&quot;/&amp;gt;
            &amp;lt;/texture&amp;gt;
            &amp;lt;texture type=&quot;constanttexture&quot; id=&quot;input2&quot;&amp;gt;
                &amp;lt;color name=&quot;color&quot; value=&quot;0.982251 0.822786 0.62396&quot;/&amp;gt;
            &amp;lt;/texture&amp;gt;
            &amp;lt;texture type=&quot;imagetexture&quot; id=&quot;mask&quot;&amp;gt;
                &amp;lt;string name=&quot;filename&quot; value=&quot;textures/MSMC_Circle_Outline_Grid.jpg&quot;/&amp;gt;
                &amp;lt;float name=&quot;scale&quot; value=&quot;1.0&quot;/&amp;gt;
                &amp;lt;string name=&quot;colorspace&quot; value=&quot;linear&quot;/&amp;gt;
            &amp;lt;/texture&amp;gt;
        &amp;lt;/texture&amp;gt;
        &amp;lt;texture type=&quot;constanttexture&quot; id=&quot;roughness&quot;&amp;gt;
            &amp;lt;color name=&quot;color&quot; value=&quot;0.166233 0.166233 0.166233&quot;/&amp;gt;
        &amp;lt;/texture&amp;gt;
        &amp;lt;texture type=&quot;imagetexture&quot; id=&quot;metallic&quot;&amp;gt;
            &amp;lt;string name=&quot;filename&quot; value=&quot;textures/MSMC_Circle_Outline_Grid.jpg&quot;/&amp;gt;
            &amp;lt;float name=&quot;scale&quot; value=&quot;1.0&quot;/&amp;gt;
            &amp;lt;string name=&quot;colorspace&quot; value=&quot;srgb&quot;/&amp;gt;
        &amp;lt;/texture&amp;gt;
        &amp;lt;float name=&quot;anisotropy&quot; value=&quot;0.0&quot;/&amp;gt;
        &amp;lt;float name=&quot;specular&quot; value=&quot;0.5&quot;/&amp;gt;
        &amp;lt;float name=&quot;specularTint&quot; value=&quot;0.0&quot;/&amp;gt;
        &amp;lt;float name=&quot;clearcoat&quot; value=&quot;0.0&quot;/&amp;gt;
        &amp;lt;float name=&quot;clearcoatRoughness&quot; value=&quot;0.0&quot;/&amp;gt;
        &amp;lt;float name=&quot;sheen&quot; value=&quot;0.0&quot;/&amp;gt;
        &amp;lt;float name=&quot;sheenTint&quot; value=&quot;0.0&quot;/&amp;gt;
    &amp;lt;/bsdf&amp;gt;
&amp;lt;/bsdf&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;a href=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/look1.png&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/look1.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class=&quot;figcaption&quot;&gt;Figure 6: 1920x1080 | 4096 spp | 11.7 min.&lt;/div&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;5-final-result&quot;&gt;5. Final result&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/final_3.4h_4k_10000spp.jpg&quot;&gt;&lt;img src=&quot;https://Kazen-Renderer.github.io//content/images/2022/kazen-con-v001-report/final_3.4h_4k_10000spp.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class=&quot;figcaption&quot;&gt;Figure 7: 3840x2160 | 10000 spp | 3.4 h.&lt;/div&gt;

&lt;p&gt;Compare with Blender render result.&lt;/p&gt;
&lt;div class=&quot;embed-container&quot;&gt;
    &lt;iframe src=&quot;/content/images/2022/kazen-con-v001-report/comparisons/compare_nano_and_cycles.html&quot; frameborder=&quot;0&quot; border=&quot;0&quot; scrolling=&quot;no&quot;&gt;&lt;/iframe&gt;
&lt;/div&gt;
&lt;div class=&quot;figcaption&quot;&gt;Figure 8: nano-Kazen: 3840x2160 | 10000 spp | 3.4 h (left) and cycles: 1920x1080 | 2500 spp | 4.47 min (right). For a full screen comparison, &lt;a href=&quot;/content/images/2022/kazen-con-v001-report/comparisons/compare_nano_and_cycles.html&quot;&gt;click here.&lt;/a&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;reference&quot;&gt;Reference&lt;/h2&gt;

&lt;p&gt;[1] &lt;a href=&quot;https://media.disneyanimation.com/uploads/production/publication_asset/48/asset/s2012_pbs_disney_brdf_notes_v3.pdf&quot;&gt;Physically Based Shading at Disney&lt;/a&gt; &lt;strong&gt;Brent Burley&lt;/strong&gt;. 2012&lt;/p&gt;

&lt;p&gt;[2] &lt;a href=&quot;https://blog.selfshadow.com/publications/s2015-shading-course/burley/s2015_pbs_disney_bsdf_notes.pdf&quot;&gt;Extending the Disney BRDF to a BSDF with Integrated Subsurface Scattering&lt;/a&gt; &lt;strong&gt;Brent Burley&lt;/strong&gt;. 2015&lt;/p&gt;

&lt;p&gt;[3] &lt;a href=&quot;http://simon-kallweit.me/rendercompo2015/report/&quot;&gt;Simon Kallweit’s project report&lt;/a&gt; &lt;strong&gt;Simon Kallweit&lt;/strong&gt;. 2015&lt;/p&gt;

&lt;p&gt;[4] &lt;a href=&quot;https://www.cs.cornell.edu/~srm/publications/EGSR07-btdf.pdf&quot;&gt;Microfacet Models for Refraction through Rough Surfaces&lt;/a&gt; &lt;strong&gt;Bruce Walter&lt;/strong&gt;. 2007&lt;/p&gt;

&lt;p&gt;[5] &lt;a href=&quot;https://jcgt.org/published/0003/02/03/paper.pdf&quot;&gt;Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs&lt;/a&gt; &lt;strong&gt;Eric Heitz&lt;/strong&gt;. 2014&lt;/p&gt;

&lt;p&gt;[6] &lt;a href=&quot;https://jcgt.org/published/0007/04/01/paper.pdf&quot;&gt;Sampling the GGX Distribution of Visible Normals&lt;/a&gt; &lt;strong&gt;Eric Heitz&lt;/strong&gt;. 2018&lt;/p&gt;

&lt;p&gt;[7] &lt;a href=&quot;https://graphics.stanford.edu/papers/veach_thesis/thesis.pdf&quot;&gt;Robust monte carlo methods for light transport simulation&lt;/a&gt; &lt;strong&gt;Eric Veach&lt;/strong&gt;. 1997&lt;/p&gt;

&lt;p&gt;[8] &lt;a href=&quot;https://www.pbrt.org/&quot;&gt;Physically Based Rendering: from theory to implementation&lt;/a&gt; &lt;strong&gt;Matt Pharr, Wenzel Jakob and Greg Humphreys&lt;/strong&gt;. 2016&lt;/p&gt;

&lt;p&gt;[9] &lt;a href=&quot;https://www.mitsuba-renderer.org/&quot;&gt;Mitsuba 2: Physically Based Renderer&lt;/a&gt; &lt;strong&gt;Wenzel Jakob&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;[10] &lt;a href=&quot;https://www.embree.org/&quot;&gt;Embree 3: High Performance Ray Tracing&lt;/a&gt; &lt;strong&gt;Intel&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;[11] &lt;a href=&quot;https://sites.google.com/site/openimageio/home&quot;&gt;OpenImageIO: a library for reading and writing images, and a bunch of related classes, utilities, and applications&lt;/a&gt; &lt;strong&gt;Larry Gritz&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;[12] &lt;a href=&quot;https://greyscalegorilla.com/product/modern-surface-material-collection/&quot;&gt;Greyscalegorilla: modern surface material collection&lt;/a&gt; &lt;strong&gt;Greyscalegorilla&lt;/strong&gt;. 2021&lt;/p&gt;
</content>
  </entry>
  

</feed>
