Skip to content

Commit 8383ca2

Browse files
authored
Add BCSDF Approximation for Second Hair Material Type (#4935)
* Initial commit of the marschner infrastructure (LUT/LTC, Analytic BSDF, ShaderGraph, etc.) * Initial commit to add scattering mode dropdown * Add the framework for a preintegrated Marschner FGD * Re-hide the material type for hair * Correct some slight typos * Un-hide the hair material type * Initial commit strand count estimation from density volume * Initial work for Surface to BSDF data * Initial readdition of the hair reference * Adapt the reference to use the new BSDF data * Use the reference for the raster BSDF * Add the first lobe approximation * Initial commit TRT approximation * Add TT attenuation term * Further simplify the attenuation TT * Add roughened azimuthal scattering, remove IOR param, add TT distribution * Initial work for environment evaluation * Add the approximated scattering mode. Move the environment evaluation to post evaluate BSDF * Disable area lights for Marschner (temporary until LTC is fixed for anisotropy) * Use the newly fitted gaussian coefficient LUT for azimuthal transmission roughness * Readjust the gaussian fit for azimuthal roughness * Skip TT lobe for environment sample * Improve Parameterization: Longitudinal Roughness -> Smoothness * Improve Parameterization: Azimuthal Roughness -> Radial Smoothness * Optimize the math for spherical coordinate angles. * NaN suppression * Revert back from sine theta to the half angle for longitudinal scatter * Fix all the warnings * Re-enable area light and fall back to GGX like Kajiya * Add note regarding Marschner pre-integration * Update hair graphics test * Update some reference images for Vulkan/Metal due to some shadow cascade discrepancy * Remove the primary reflection smooth parameter. * Roughness clamping for longitudinal scattering * Rename Use Light Facing Normal to Geometry Mode (Cards, Strands) * Documentation - First Pass * Rename Geometry Mode -> Geometry Type * Tooltips - Also hide the Scattering Mode until the improved approximation is merged. * Incorporate documentation feedback * Fix an issue with documentation bulletin * Fix an issue with a shader graph asset breaking the hair test
1 parent 99d91a1 commit 8383ca2

File tree

57 files changed

+32890
-1357
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+32890
-1357
lines changed

TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/1x_Materials/1401_HairGraph.unity

Lines changed: 1897 additions & 488 deletions
Large diffs are not rendered by default.

TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/1x_Materials/1401_HairGraph/HairTest Light Facing Normal_Opaque.mat

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ MonoBehaviour:
1313
m_Name:
1414
m_EditorClassIdentifier:
1515
version: 12
16+
hdPluginSubTargetMaterialVersions:
17+
m_Keys: []
18+
m_Values:
1619
--- !u!21 &2100000
1720
Material:
1821
serializedVersion: 6
@@ -135,6 +138,18 @@ Material:
135138
m_Texture: {fileID: 0}
136139
m_Scale: {x: 1, y: 1}
137140
m_Offset: {x: 0, y: 0}
141+
- unity_Lightmaps:
142+
m_Texture: {fileID: 0}
143+
m_Scale: {x: 1, y: 1}
144+
m_Offset: {x: 0, y: 0}
145+
- unity_LightmapsInd:
146+
m_Texture: {fileID: 0}
147+
m_Scale: {x: 1, y: 1}
148+
m_Offset: {x: 0, y: 0}
149+
- unity_ShadowMasks:
150+
m_Texture: {fileID: 0}
151+
m_Scale: {x: 1, y: 1}
152+
m_Offset: {x: 0, y: 0}
138153
m_Ints: []
139154
m_Floats:
140155
- AlphaCutoff: 0.564
@@ -158,6 +173,7 @@ Material:
158173
- _Anisotropy: 0
159174
- _BlendMode: 0
160175
- _CoatMask: 0
176+
- _ConservativeDepthOffsetEnable: 0
161177
- _CullMode: 0
162178
- _CullModeForward: 0
163179
- _Cutoff: 0.5
@@ -185,6 +201,7 @@ Material:
185201
- _DistortionVectorBias: -1
186202
- _DistortionVectorScale: 2
187203
- _DoubleSidedEnable: 1
204+
- _DoubleSidedGIMode: 0
188205
- _DoubleSidedNormalMode: 1
189206
- _Drag: 1
190207
- _DstBlend: 0
@@ -226,7 +243,7 @@ Material:
226243
- _ReceivesSSR: 1
227244
- _ReceivesSSRTransparent: 0
228245
- _RefractionModel: 0
229-
- _RenderQueueType: 4
246+
- _RenderQueueType: 1
230247
- _RequireSplitLighting: 0
231248
- _RimTransmissionIntensity: 0
232249
- _SSRefractionProjectionModel: 0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,318 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!114 &-4727822957753971342
4+
MonoBehaviour:
5+
m_ObjectHideFlags: 11
6+
m_CorrespondingSourceObject: {fileID: 0}
7+
m_PrefabInstance: {fileID: 0}
8+
m_PrefabAsset: {fileID: 0}
9+
m_GameObject: {fileID: 0}
10+
m_Enabled: 1
11+
m_EditorHideFlags: 0
12+
m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3}
13+
m_Name:
14+
m_EditorClassIdentifier:
15+
version: 12
16+
hdPluginSubTargetMaterialVersions:
17+
m_Keys: []
18+
m_Values:
19+
--- !u!21 &2100000
20+
Material:
21+
serializedVersion: 6
22+
m_ObjectHideFlags: 0
23+
m_CorrespondingSourceObject: {fileID: 0}
24+
m_PrefabInstance: {fileID: 0}
25+
m_PrefabAsset: {fileID: 0}
26+
m_Name: HairTest Marschner Light Facing Normal
27+
m_Shader: {fileID: -6465566751694194690, guid: 84386fd8e1506df4fb7fb982c2ed9ec2,
28+
type: 3}
29+
m_ShaderKeywords: _ALPHATEST_ON _BLENDMODE_ALPHA _DISABLE_SSR_TRANSPARENT _DOUBLESIDED_ON
30+
_ENABLE_FOG_ON_TRANSPARENT _SURFACE_TYPE_TRANSPARENT _TRANSPARENT_WRITES_MOTION_VEC
31+
m_LightmapFlags: 4
32+
m_EnableInstancingVariants: 0
33+
m_DoubleSidedGI: 1
34+
m_CustomRenderQueue: 3000
35+
stringTagMap:
36+
MotionVector: User
37+
RenderType: Transparent
38+
disabledShaderPasses:
39+
- MOTIONVECTORS
40+
m_SavedProperties:
41+
serializedVersion: 3
42+
m_TexEnvs:
43+
- Texture2D_189C8E90:
44+
m_Texture: {fileID: 2800000, guid: e0d86873105ce774d8fa34942fc1e8fc, type: 3}
45+
m_Scale: {x: 1, y: 1}
46+
m_Offset: {x: 0, y: 0}
47+
- Texture2D_6C0DA6CC:
48+
m_Texture: {fileID: 2800000, guid: 66171ce41a2b74140b03d4b2781a85bf, type: 3}
49+
m_Scale: {x: 1, y: 1}
50+
m_Offset: {x: 0, y: 0}
51+
- Texture2D_9D58E1D1:
52+
m_Texture: {fileID: 2800000, guid: f71a4355f2f772b4b99ed08b8d564c3c, type: 3}
53+
m_Scale: {x: 1, y: 1}
54+
m_Offset: {x: 0, y: 0}
55+
- _AnisotropyMap:
56+
m_Texture: {fileID: 0}
57+
m_Scale: {x: 1, y: 1}
58+
m_Offset: {x: 0, y: 0}
59+
- _BaseColorMap:
60+
m_Texture: {fileID: 2800000, guid: f71a4355f2f772b4b99ed08b8d564c3c, type: 3}
61+
m_Scale: {x: 1, y: 1}
62+
m_Offset: {x: 0, y: 0}
63+
- _BentNormalMap:
64+
m_Texture: {fileID: 0}
65+
m_Scale: {x: 1, y: 1}
66+
m_Offset: {x: 0, y: 0}
67+
- _BentNormalMapOS:
68+
m_Texture: {fileID: 0}
69+
m_Scale: {x: 1, y: 1}
70+
m_Offset: {x: 0, y: 0}
71+
- _CoatMaskMap:
72+
m_Texture: {fileID: 0}
73+
m_Scale: {x: 1, y: 1}
74+
m_Offset: {x: 0, y: 0}
75+
- _DetailMap:
76+
m_Texture: {fileID: 0}
77+
m_Scale: {x: 1, y: 1}
78+
m_Offset: {x: 0, y: 0}
79+
- _DistortionVectorMap:
80+
m_Texture: {fileID: 0}
81+
m_Scale: {x: 1, y: 1}
82+
m_Offset: {x: 0, y: 0}
83+
- _EmissiveColorMap:
84+
m_Texture: {fileID: 0}
85+
m_Scale: {x: 1, y: 1}
86+
m_Offset: {x: 0, y: 0}
87+
- _HeightMap:
88+
m_Texture: {fileID: 0}
89+
m_Scale: {x: 1, y: 1}
90+
m_Offset: {x: 0, y: 0}
91+
- _IridescenceMaskMap:
92+
m_Texture: {fileID: 0}
93+
m_Scale: {x: 1, y: 1}
94+
m_Offset: {x: 0, y: 0}
95+
- _IridescenceThicknessMap:
96+
m_Texture: {fileID: 0}
97+
m_Scale: {x: 1, y: 1}
98+
m_Offset: {x: 0, y: 0}
99+
- _MainTex:
100+
m_Texture: {fileID: 2800000, guid: f71a4355f2f772b4b99ed08b8d564c3c, type: 3}
101+
m_Scale: {x: 1, y: 1}
102+
m_Offset: {x: 0, y: 0}
103+
- _MaskMap:
104+
m_Texture: {fileID: 2800000, guid: cbd88c0d1d791c044950d2a6b99b7db5, type: 3}
105+
m_Scale: {x: 1, y: 1}
106+
m_Offset: {x: 0, y: 0}
107+
- _NormalMap:
108+
m_Texture: {fileID: 2800000, guid: f75fdfd95ada34844997dda9b91794b8, type: 3}
109+
m_Scale: {x: 1, y: 1}
110+
m_Offset: {x: 0, y: 0}
111+
- _NormalMapOS:
112+
m_Texture: {fileID: 0}
113+
m_Scale: {x: 1, y: 1}
114+
m_Offset: {x: 0, y: 0}
115+
- _SpecularColorMap:
116+
m_Texture: {fileID: 0}
117+
m_Scale: {x: 1, y: 1}
118+
m_Offset: {x: 0, y: 0}
119+
- _SubsurfaceMaskMap:
120+
m_Texture: {fileID: 0}
121+
m_Scale: {x: 1, y: 1}
122+
m_Offset: {x: 0, y: 0}
123+
- _TangentMap:
124+
m_Texture: {fileID: 0}
125+
m_Scale: {x: 1, y: 1}
126+
m_Offset: {x: 0, y: 0}
127+
- _TangentMapOS:
128+
m_Texture: {fileID: 0}
129+
m_Scale: {x: 1, y: 1}
130+
m_Offset: {x: 0, y: 0}
131+
- _ThicknessMap:
132+
m_Texture: {fileID: 0}
133+
m_Scale: {x: 1, y: 1}
134+
m_Offset: {x: 0, y: 0}
135+
- _TransmittanceColorMap:
136+
m_Texture: {fileID: 0}
137+
m_Scale: {x: 1, y: 1}
138+
m_Offset: {x: 0, y: 0}
139+
- unity_Lightmaps:
140+
m_Texture: {fileID: 0}
141+
m_Scale: {x: 1, y: 1}
142+
m_Offset: {x: 0, y: 0}
143+
- unity_LightmapsInd:
144+
m_Texture: {fileID: 0}
145+
m_Scale: {x: 1, y: 1}
146+
m_Offset: {x: 0, y: 0}
147+
- unity_ShadowMasks:
148+
m_Texture: {fileID: 0}
149+
m_Scale: {x: 1, y: 1}
150+
m_Offset: {x: 0, y: 0}
151+
m_Ints: []
152+
m_Floats:
153+
- AlphaCutoff: 0
154+
- Boolean_F987B642: 0
155+
- Vector1_7D9AC3D3: 0.36
156+
- Vector1_901E5FC2: 1
157+
- _AORemapMax: 1
158+
- _AORemapMin: 0
159+
- _ATDistance: 1
160+
- _AddPrecomputedVelocity: 0
161+
- _AlbedoAffectEmissive: 0
162+
- _AlphaCutoff: 0.5
163+
- _AlphaCutoffEnable: 1
164+
- _AlphaCutoffPostpass: 0.25
165+
- _AlphaCutoffPrepass: 0.96
166+
- _AlphaCutoffShadows: 0.75
167+
- _AlphaDstBlend: 10
168+
- _AlphaSrcBlend: 1
169+
- _AlphaToMask: 0
170+
- _AlphaToMaskInspectorValue: 0
171+
- _Anisotropy: 0
172+
- _BlendMode: 0
173+
- _CoatMask: 0
174+
- _ConservativeDepthOffsetEnable: 0
175+
- _CullMode: 0
176+
- _CullModeForward: 2
177+
- _Cuticle_Tilt: 0.125
178+
- _Cutoff: 0.5
179+
- _DepthOffsetEnable: 0
180+
- _DetailAlbedoScale: 1
181+
- _DetailNormalScale: 1
182+
- _DetailSmoothnessScale: 1
183+
- _DiffusionProfile: 0
184+
- _DiffusionProfileID: 4
185+
- _DisplacementLockObjectScale: 1
186+
- _DisplacementLockTilingScale: 1
187+
- _DisplacementMode: 0
188+
- _DistortionBlendMode: 0
189+
- _DistortionBlurBlendMode: 0
190+
- _DistortionBlurDstBlend: 0
191+
- _DistortionBlurRemapMax: 1
192+
- _DistortionBlurRemapMin: 0
193+
- _DistortionBlurScale: 1
194+
- _DistortionBlurSrcBlend: 0
195+
- _DistortionDepthTest: 1
196+
- _DistortionDstBlend: 0
197+
- _DistortionEnable: 0
198+
- _DistortionScale: 1
199+
- _DistortionSrcBlend: 0
200+
- _DistortionVectorBias: -1
201+
- _DistortionVectorScale: 2
202+
- _DoubleSidedEnable: 1
203+
- _DoubleSidedGIMode: 0
204+
- _DoubleSidedNormalMode: 1
205+
- _Drag: 1
206+
- _DstBlend: 10
207+
- _EmissiveColorMode: 1
208+
- _EnableBlendModePreserveSpecularLighting: 0
209+
- _EnableFogOnTransparent: 1
210+
- _EnableGeometricSpecularAA: 0
211+
- _EnableMotionVectorForVertexAnimation: 0
212+
- _EnableSpecularOcclusion: 0
213+
- _EnableWind: 0
214+
- _EnergyConservingSpecularColor: 1
215+
- _HdrpVersion: 2
216+
- _HeightAmplitude: 0.02
217+
- _HeightCenter: 0.5
218+
- _HeightMapParametrization: 0
219+
- _HeightMax: 1
220+
- _HeightMin: -1
221+
- _HeightOffset: 0
222+
- _HeightPoMAmplitude: 2
223+
- _HeightTessAmplitude: 2
224+
- _HeightTessCenter: 0.5
225+
- _InitialBend: 1
226+
- _InvTilingScale: 1
227+
- _Ior: 1
228+
- _IridescenceMask: 1
229+
- _IridescenceThickness: 1
230+
- _LinkDetailsWithBase: 1
231+
- _MaterialID: 1
232+
- _Metallic: 0
233+
- _NormalMapSpace: 0
234+
- _NormalScale: 0.3
235+
- _OpaqueCullMode: 2
236+
- _PPDLodThreshold: 5
237+
- _PPDMaxSamples: 15
238+
- _PPDMinSamples: 5
239+
- _PPDPrimitiveLength: 1
240+
- _PPDPrimitiveWidth: 1
241+
- _PreRefractionPass: 0
242+
- _ReceivesSSR: 1
243+
- _ReceivesSSRTransparent: 0
244+
- _RefractionModel: 0
245+
- _RenderQueueType: 4
246+
- _RequireSplitLighting: 0
247+
- _RimTransmissionIntensity: 0
248+
- _SSRefractionProjectionModel: 0
249+
- _SecondarySpecularMultiplier: 1
250+
- _SecondarySpecularShift: 0
251+
- _ShiverDirectionality: 0.5
252+
- _ShiverDrag: 0.2
253+
- _Smoothness: 0.5
254+
- _SmoothnessRemapMax: 0.89
255+
- _SmoothnessRemapMin: 0.547
256+
- _SpecularAAScreenSpaceVariance: 0.1
257+
- _SpecularAAThreshold: 0.2
258+
- _SpecularMultiplier: 0.348
259+
- _SpecularShift: 0.125
260+
- _SrcBlend: 1
261+
- _StencilRef: 0
262+
- _StencilRefDepth: 0
263+
- _StencilRefDistortionVec: 4
264+
- _StencilRefGBuffer: 2
265+
- _StencilRefMV: 32
266+
- _StencilWriteMask: 6
267+
- _StencilWriteMaskDepth: 8
268+
- _StencilWriteMaskDistortionVec: 4
269+
- _StencilWriteMaskGBuffer: 14
270+
- _StencilWriteMaskMV: 40
271+
- _Stiffness: 1
272+
- _SubsurfaceMask: 1
273+
- _SupportDecals: 1
274+
- _SurfaceType: 1
275+
- _TexWorldScale: 1
276+
- _TexWorldScaleEmissive: 1
277+
- _Thickness: 1
278+
- _ThicknessMultiplier: 1
279+
- _ThicknessRemapMax: 0.001
280+
- _ThicknessRemapMin: 0
281+
- _TransmissionEnable: 1
282+
- _TransparentBackfaceEnable: 1
283+
- _TransparentCullMode: 2
284+
- _TransparentDepthPostpassEnable: 1
285+
- _TransparentDepthPrepassEnable: 1
286+
- _TransparentSortPriority: 0
287+
- _TransparentWritingMotionVec: 1
288+
- _TransparentZWrite: 0
289+
- _UVBase: 0
290+
- _UVDetail: 0
291+
- _UVEmissive: 0
292+
- _UseDetailMap: 0
293+
- _UseShadowThreshold: 1
294+
- _ZTestDepthEqualForOpaque: 4
295+
- _ZTestGBuffer: 3
296+
- _ZTestModeDistortion: 8
297+
- _ZTestTransparent: 4
298+
- _ZWrite: 0
299+
m_Colors:
300+
- Color_6FC6C3A4: {r: 0.29999998, g: 0.19499996, b: 0.089999996, a: 1}
301+
- _BaseColor: {r: 0.5, g: 0.34403664, b: 0.24770638, a: 1}
302+
- _Color: {r: 0.5, g: 0.3440366, b: 0.24770635, a: 1}
303+
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
304+
- _EmissionColor: {r: 1, g: 1, b: 1, a: 1}
305+
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
306+
- _InvPrimScale: {r: 1, g: 1, b: 0, a: 0}
307+
- _IridescenceThicknessRemap: {r: 0, g: 1, b: 0, a: 0}
308+
- _SpecularColor: {r: 0.8679245, g: 0.559068, b: 0.2251691, a: 1}
309+
- _ThicknessRemap: {r: 0, g: 1, b: 0, a: 0}
310+
- _TransmittanceColor: {r: 1, g: 1, b: 1, a: 1}
311+
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}
312+
- _UVMappingMask: {r: 1, g: 0, b: 0, a: 0}
313+
- _UVMappingMaskEmissive: {r: 1, g: 0, b: 0, a: 0}
314+
- _uvBaseMask: {r: 1, g: 0, b: 0, a: 0}
315+
- _uvBaseST: {r: 0.5, g: 0.5, b: 0, a: 0}
316+
- _uvDetailMask: {r: 1, g: 0, b: 0, a: 0}
317+
- _uvDetailST: {r: 1, g: 1, b: 0, a: 0}
318+
m_BuildTextureStacks: []

TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/1x_Materials/1401_HairGraph/HairTest Marschner Light Facing Normal.mat.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)