2019年9月28日 星期六

Shader Graph custom lighting + PBR master node + stripping unused

最近開始熟悉 Unity SRP 和 shader graph (SRP 還不算熟)

上過課之後

看官方的部落格介紹文章也很快進入狀況

https://blogs.unity3d.com/2019/07/31/custom-lighting-in-shader-graph-expanding-your-graphs-in-2019/?fbclid=IwAR387bG0VVwX7nF0vwRZL_7_Qmf2ZgsoXWhRL0eJnuUfTYZqQQ2XGZjobkk

差不多有感覺可以駕馭 shader graph (至少針對 LWRP)

另外延伸看到有人分享文章

https://medium.com/@larsbertram1/lwrp-and-custom-lighting-in-shader-graph-6a7c48008a1d
====
The shader compiler comes to our rescue, as it will strip all code, it thinks, which will not contribute to the final pixel. So if we set albedo to constant 0,0,0 or black the entire diffuse lighting pass will always result in 0,0,0 and thus the shader compiler will strip it, right? Setting occlusion to 0.0? Ambient diffuse and specular lighting will always be 0.0, so these parts should get stripped as well. What’s about direct specular lighting, which includes the most expensive calculations? Setting smoothness to 0.0 and specular to 0.0 as well should do the trick.
====

使用 Unlit shader 製作 custom lighting shader 無法運用 Unity 內建的 global illumination / lightmap / cascaded shadow 功能, 使用 PBR Master Node 的話又會顧慮到做多餘 PBS lighting 的 shader codes/calculations.
因此將 custom lighting 的結果直接指定給 PBR Master Node 的 Emission input, 其他用不到的 feature 就歸零, 這個方式就可以透過 Unity stripping shader codes 功能將 PBR Master Node 多餘的計算相關 shader codes 排除.

非常有用的資訊.

2019年9月24日 星期二

[Unknown] #0: 首次筆記

老樣子, 一直以來沒有時間做自己想做的遊戲

我也不知道現在算不算開始動了

總之最近開始練習 Probuilder, 打算先把 prototype level 做出來

初次更新











我想做的是有地面也有坑洞用來放置立體機械裝置

比如說機械車位系統

希望未來能持續投入時間

加油一下吧