剛從 assetStore 把人形買回來放到 URP 上的時候. 不知道要花多久時間來設定的狀態.
死魚眼…. 把高光都調一下, 頭髮這個很有問題…皮膚也很暗啞
研究一下頭髮的寫法.
Ref : 2004 年的 Kajiya-Kay light model.
https://developer.amd.com/wordpress/media/2012/10/Scheuermann_HairSketchSlides.pdf
Ref : https://zhuanlan.zhihu.com/p/363829203
使用 Kajiya-Kay 的散射運算以及能反映髮質的高光顏色.
加上 Rim Light 感覺好多了.
Kajiya-Kay 的寫法很簡單重要的就那 2,3 句.
這邊是我的寫法.
struct HighLight { half4 color; half shift; }; struct Specular { half width; half power; half scale; }; half HairHighLight(Specular specular, half3 T, half3 V, half3 L) { half3 H = normalize(V + L); half HdotT = dot(T, H); half sinTH = sqrt(1 - HdotT * HdotT); half dirAtten = smoothstep(-specular.width, 0, HdotT); return dirAtten * saturate(pow(sinTH, specular.power)) * specular.scale; } half3 ShiftTangent(half3 T, half3 N, float shift) { return normalize(T + shift * N); } half3 SpecularStrandLighting(HighLight primary, HighLight secondary, Specular specular, half shiftTex, half3 N, half3 TB, half3 V, half3 L) { // TB := Tangent/Bitangent to define the direction of hair highlight specular half3 t1 = ShiftTangent(TB, N, primary.shift + shiftTex); half3 t2 = ShiftTangent(TB, N, secondary.shift + shiftTex); half3 highLight = half3(0.0, 0.0, 0.0); highLight += primary.color.rgb * primary.color.a * HairHighLight(specular, t1, V, L); highLight += secondary.color.rgb * secondary.color.a * HairHighLight(specular, t2, V, L); return highLight; } // Simple subsurface scattering approximation // https://developer.amd.com/wordpress/media/2012/10/Scheuermann_HairSketchSlides.pdf half3 KajiyaKayLightTerm(Light light, half3 N) { return light.color * light.shadowAttenuation * light.distanceAttenuation * max(0.0, 0.75 * dot(N, light.direction.xyz) + 0.25); }
目前結果不甚滿意, 所以繼續找資料. 多謝 Jason 提供的清單
- Real-Time Hair Rendering on the GPU, SIGGRAPH2008
https://developer.download.nvidia.com/presentations/2008/SIGGRAPH/RealTimeHairRendering_SponsoredSession2.pdf - A Data-Driven Light Scattering Model for Hair
https://graphics.pixar.com/library/DataDrivenHairScattering/paper.pdf - Hair In tomb raider
https://www.slideshare.net/WolfgangEngel/hair-intombraider-final - https://www.taylorfrancis.com/chapters/edit/10.1201/b16721-14/tressfx-advanced-real-time-hair-rendering-timothy-martin-wolfgang-engel-nicolas-thibieroz-jason-yang-jason-lacroix
Extra Study Ref