Skip to content

Commit

Permalink
Add BCSDF Approximation for Second Hair Material Type (#4935)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
johnpars authored Jul 21, 2021
1 parent 99d91a1 commit 8383ca2
Show file tree
Hide file tree
Showing 57 changed files with 32,890 additions and 1,357 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
version: 12
hdPluginSubTargetMaterialVersions:
m_Keys: []
m_Values:
--- !u!21 &2100000
Material:
serializedVersion: 6
Expand Down Expand Up @@ -135,6 +138,18 @@ Material:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- AlphaCutoff: 0.564
Expand All @@ -158,6 +173,7 @@ Material:
- _Anisotropy: 0
- _BlendMode: 0
- _CoatMask: 0
- _ConservativeDepthOffsetEnable: 0
- _CullMode: 0
- _CullModeForward: 0
- _Cutoff: 0.5
Expand Down Expand Up @@ -185,6 +201,7 @@ Material:
- _DistortionVectorBias: -1
- _DistortionVectorScale: 2
- _DoubleSidedEnable: 1
- _DoubleSidedGIMode: 0
- _DoubleSidedNormalMode: 1
- _Drag: 1
- _DstBlend: 0
Expand Down Expand Up @@ -226,7 +243,7 @@ Material:
- _ReceivesSSR: 1
- _ReceivesSSRTransparent: 0
- _RefractionModel: 0
- _RenderQueueType: 4
- _RenderQueueType: 1
- _RequireSplitLighting: 0
- _RimTransmissionIntensity: 0
- _SSRefractionProjectionModel: 0
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,318 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-4727822957753971342
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 12
hdPluginSubTargetMaterialVersions:
m_Keys: []
m_Values:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: HairTest Marschner Light Facing Normal
m_Shader: {fileID: -6465566751694194690, guid: 84386fd8e1506df4fb7fb982c2ed9ec2,
type: 3}
m_ShaderKeywords: _ALPHATEST_ON _BLENDMODE_ALPHA _DISABLE_SSR_TRANSPARENT _DOUBLESIDED_ON
_ENABLE_FOG_ON_TRANSPARENT _SURFACE_TYPE_TRANSPARENT _TRANSPARENT_WRITES_MOTION_VEC
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 1
m_CustomRenderQueue: 3000
stringTagMap:
MotionVector: User
RenderType: Transparent
disabledShaderPasses:
- MOTIONVECTORS
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- Texture2D_189C8E90:
m_Texture: {fileID: 2800000, guid: e0d86873105ce774d8fa34942fc1e8fc, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- Texture2D_6C0DA6CC:
m_Texture: {fileID: 2800000, guid: 66171ce41a2b74140b03d4b2781a85bf, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- Texture2D_9D58E1D1:
m_Texture: {fileID: 2800000, guid: f71a4355f2f772b4b99ed08b8d564c3c, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _AnisotropyMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BaseColorMap:
m_Texture: {fileID: 2800000, guid: f71a4355f2f772b4b99ed08b8d564c3c, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BentNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BentNormalMapOS:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _CoatMaskMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DistortionVectorMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissiveColorMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _HeightMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _IridescenceMaskMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _IridescenceThicknessMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: f71a4355f2f772b4b99ed08b8d564c3c, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MaskMap:
m_Texture: {fileID: 2800000, guid: cbd88c0d1d791c044950d2a6b99b7db5, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _NormalMap:
m_Texture: {fileID: 2800000, guid: f75fdfd95ada34844997dda9b91794b8, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _NormalMapOS:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecularColorMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SubsurfaceMaskMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _TangentMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _TangentMapOS:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ThicknessMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _TransmittanceColorMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- AlphaCutoff: 0
- Boolean_F987B642: 0
- Vector1_7D9AC3D3: 0.36
- Vector1_901E5FC2: 1
- _AORemapMax: 1
- _AORemapMin: 0
- _ATDistance: 1
- _AddPrecomputedVelocity: 0
- _AlbedoAffectEmissive: 0
- _AlphaCutoff: 0.5
- _AlphaCutoffEnable: 1
- _AlphaCutoffPostpass: 0.25
- _AlphaCutoffPrepass: 0.96
- _AlphaCutoffShadows: 0.75
- _AlphaDstBlend: 10
- _AlphaSrcBlend: 1
- _AlphaToMask: 0
- _AlphaToMaskInspectorValue: 0
- _Anisotropy: 0
- _BlendMode: 0
- _CoatMask: 0
- _ConservativeDepthOffsetEnable: 0
- _CullMode: 0
- _CullModeForward: 2
- _Cuticle_Tilt: 0.125
- _Cutoff: 0.5
- _DepthOffsetEnable: 0
- _DetailAlbedoScale: 1
- _DetailNormalScale: 1
- _DetailSmoothnessScale: 1
- _DiffusionProfile: 0
- _DiffusionProfileID: 4
- _DisplacementLockObjectScale: 1
- _DisplacementLockTilingScale: 1
- _DisplacementMode: 0
- _DistortionBlendMode: 0
- _DistortionBlurBlendMode: 0
- _DistortionBlurDstBlend: 0
- _DistortionBlurRemapMax: 1
- _DistortionBlurRemapMin: 0
- _DistortionBlurScale: 1
- _DistortionBlurSrcBlend: 0
- _DistortionDepthTest: 1
- _DistortionDstBlend: 0
- _DistortionEnable: 0
- _DistortionScale: 1
- _DistortionSrcBlend: 0
- _DistortionVectorBias: -1
- _DistortionVectorScale: 2
- _DoubleSidedEnable: 1
- _DoubleSidedGIMode: 0
- _DoubleSidedNormalMode: 1
- _Drag: 1
- _DstBlend: 10
- _EmissiveColorMode: 1
- _EnableBlendModePreserveSpecularLighting: 0
- _EnableFogOnTransparent: 1
- _EnableGeometricSpecularAA: 0
- _EnableMotionVectorForVertexAnimation: 0
- _EnableSpecularOcclusion: 0
- _EnableWind: 0
- _EnergyConservingSpecularColor: 1
- _HdrpVersion: 2
- _HeightAmplitude: 0.02
- _HeightCenter: 0.5
- _HeightMapParametrization: 0
- _HeightMax: 1
- _HeightMin: -1
- _HeightOffset: 0
- _HeightPoMAmplitude: 2
- _HeightTessAmplitude: 2
- _HeightTessCenter: 0.5
- _InitialBend: 1
- _InvTilingScale: 1
- _Ior: 1
- _IridescenceMask: 1
- _IridescenceThickness: 1
- _LinkDetailsWithBase: 1
- _MaterialID: 1
- _Metallic: 0
- _NormalMapSpace: 0
- _NormalScale: 0.3
- _OpaqueCullMode: 2
- _PPDLodThreshold: 5
- _PPDMaxSamples: 15
- _PPDMinSamples: 5
- _PPDPrimitiveLength: 1
- _PPDPrimitiveWidth: 1
- _PreRefractionPass: 0
- _ReceivesSSR: 1
- _ReceivesSSRTransparent: 0
- _RefractionModel: 0
- _RenderQueueType: 4
- _RequireSplitLighting: 0
- _RimTransmissionIntensity: 0
- _SSRefractionProjectionModel: 0
- _SecondarySpecularMultiplier: 1
- _SecondarySpecularShift: 0
- _ShiverDirectionality: 0.5
- _ShiverDrag: 0.2
- _Smoothness: 0.5
- _SmoothnessRemapMax: 0.89
- _SmoothnessRemapMin: 0.547
- _SpecularAAScreenSpaceVariance: 0.1
- _SpecularAAThreshold: 0.2
- _SpecularMultiplier: 0.348
- _SpecularShift: 0.125
- _SrcBlend: 1
- _StencilRef: 0
- _StencilRefDepth: 0
- _StencilRefDistortionVec: 4
- _StencilRefGBuffer: 2
- _StencilRefMV: 32
- _StencilWriteMask: 6
- _StencilWriteMaskDepth: 8
- _StencilWriteMaskDistortionVec: 4
- _StencilWriteMaskGBuffer: 14
- _StencilWriteMaskMV: 40
- _Stiffness: 1
- _SubsurfaceMask: 1
- _SupportDecals: 1
- _SurfaceType: 1
- _TexWorldScale: 1
- _TexWorldScaleEmissive: 1
- _Thickness: 1
- _ThicknessMultiplier: 1
- _ThicknessRemapMax: 0.001
- _ThicknessRemapMin: 0
- _TransmissionEnable: 1
- _TransparentBackfaceEnable: 1
- _TransparentCullMode: 2
- _TransparentDepthPostpassEnable: 1
- _TransparentDepthPrepassEnable: 1
- _TransparentSortPriority: 0
- _TransparentWritingMotionVec: 1
- _TransparentZWrite: 0
- _UVBase: 0
- _UVDetail: 0
- _UVEmissive: 0
- _UseDetailMap: 0
- _UseShadowThreshold: 1
- _ZTestDepthEqualForOpaque: 4
- _ZTestGBuffer: 3
- _ZTestModeDistortion: 8
- _ZTestTransparent: 4
- _ZWrite: 0
m_Colors:
- Color_6FC6C3A4: {r: 0.29999998, g: 0.19499996, b: 0.089999996, a: 1}
- _BaseColor: {r: 0.5, g: 0.34403664, b: 0.24770638, a: 1}
- _Color: {r: 0.5, g: 0.3440366, b: 0.24770635, a: 1}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 1, g: 1, b: 1, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _InvPrimScale: {r: 1, g: 1, b: 0, a: 0}
- _IridescenceThicknessRemap: {r: 0, g: 1, b: 0, a: 0}
- _SpecularColor: {r: 0.8679245, g: 0.559068, b: 0.2251691, a: 1}
- _ThicknessRemap: {r: 0, g: 1, b: 0, a: 0}
- _TransmittanceColor: {r: 1, g: 1, b: 1, a: 1}
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}
- _UVMappingMask: {r: 1, g: 0, b: 0, a: 0}
- _UVMappingMaskEmissive: {r: 1, g: 0, b: 0, a: 0}
- _uvBaseMask: {r: 1, g: 0, b: 0, a: 0}
- _uvBaseST: {r: 0.5, g: 0.5, b: 0, a: 0}
- _uvDetailMask: {r: 1, g: 0, b: 0, a: 0}
- _uvDetailST: {r: 1, g: 1, b: 0, a: 0}
m_BuildTextureStacks: []

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8383ca2

Please sign in to comment.