浏览代码

Surface lit started to work.

/HDRP_SurfaceShader
Remy 7 年前
当前提交
8bfdd505
共有 5 个文件被更改,包括 130 次插入33 次删除
  1. 3
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.shader
  2. 34
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/SurfaceLitData.hlsl
  3. 33
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/SurfaceLitDataIDX.hlsl
  4. 84
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/SurfaceLitInclude.hlsl
  5. 9
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/SurfaceLitInclude.hlsl.meta

3
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.shader


{
Properties
{
// Following set of parameters represent the parameters node inside the MaterialGraph.
// They are use to fill a SurfaceData. With a MaterialGraph this should not exist.
// Reminder. Color here are in linear but the UI (color picker) do the conversion sRGB to linear
_BaseColor("BaseColor", Color) = (1,1,1,1)
_BaseColorMap("BaseColorMap", 2D) = "white" {}

34
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/SurfaceLitData.hlsl


#include "../MaterialUtilities.hlsl"
#include "../Decal/DecalUtilities.hlsl"
#include "SurfaceLitInclude.hlsl"
// TODO: move this function to commonLighting.hlsl once validated it work correctly
float GetSpecularOcclusionFromBentAO(float3 V, float3 bentNormalWS, SurfaceData surfaceData)
{

surfaceData.metallic = 0;
}
#endif
// Generated from UnityEngine.Experimental.Rendering.HDPipeline.Lit+SurfaceData
// PackingRules = Exact
/*
struct SurfaceData
{
uint materialFeatures;
float3 baseColor;
float specularOcclusion;
float3 normalWS;
float perceptualSmoothness;
float ambientOcclusion;
float metallic;
float coatMask;
float3 specularColor;
uint diffusionProfile;
float subsurfaceMask;
float thickness;
float3 tangentWS;
float anisotropy;
float iridescenceThickness;
float iridescenceMask;
float ior;
float3 transmittanceColor;
float atDistance;
float transmittanceMask;
};
*/
// surfaceData = GetSurfaceLitData();
// surfaceData.baseColor = float3(1, 0, 0);
ModSurfaceLitData(surfaceData);
// Caution: surfaceData must be fully initialize before calling GetBuiltinData
GetBuiltinData(input, surfaceData, alpha, bentNormalWS, depthOffset, builtinData);

33
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/SurfaceLitDataIDX.hlsl


void ADD_IDX(ComputeLayerTexCoord)( // Uv related parameters
float2 texCoord0, float2 texCoord1, float2 texCoord2, float2 texCoord3, float4 uvMappingMask, float4 uvMappingMaskDetails,
// scale and bias for base and detail + global tiling factor (for layered lit only)

#endif // #if !defined(LAYERED_LIT_SHADER)
// Generated from UnityEngine.Experimental.Rendering.HDPipeline.Lit+SurfaceData
// PackingRules = Exact
/*
struct SurfaceData
{
uint materialFeatures;
float3 baseColor;
float specularOcclusion;
float3 normalWS;
float perceptualSmoothness;
float ambientOcclusion;
float metallic;
float coatMask;
float3 specularColor;
uint diffusionProfile;
float subsurfaceMask;
float thickness;
float3 tangentWS;
float anisotropy;
float iridescenceThickness;
float iridescenceMask;
float ior;
float3 transmittanceColor;
float atDistance;
float transmittanceMask;
};
*/
surfaceData.baseColor = float3(1, 0, 0);
surfaceData.normalWS = float3(1, 0, 0);
return alpha;
}

84
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/SurfaceLitInclude.hlsl


#include "HDRP/Material/Lit/Lit.cs.hlsl"
// Generated from UnityEngine.Experimental.Rendering.HDPipeline.Lit+SurfaceData
// PackingRules = Exact
/*
struct SurfaceData
{
uint materialFeatures;
float3 baseColor;
float specularOcclusion;
float3 normalWS;
float perceptualSmoothness;
float ambientOcclusion;
float metallic;
float coatMask;
float3 specularColor;
uint diffusionProfile;
float subsurfaceMask;
float thickness;
float3 tangentWS;
float anisotropy;
float iridescenceThickness;
float iridescenceMask;
float ior;
float3 transmittanceColor;
float atDistance;
float transmittanceMask;
};
*/
SurfaceData GetSurfaceLitData()
{
SurfaceData s;
ZERO_INITIALIZE(SurfaceData, s);
//s.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD;
s.baseColor = float3(1, 0, 0);
s.specularOcclusion = 0;
s.normalWS = float3(0, 0, 1);
s.perceptualSmoothness = 0.5;
s.ambientOcclusion = 0;
s.metallic = 0;
s.coatMask = 0;
s.specularColor = float3(0, 0, 0);
s.diffusionProfile = 0;
s.subsurfaceMask = 0;
s.thickness = 0;
s.tangentWS = float3(1, 0, 0);
s.anisotropy = 0;
s.iridescenceThickness = 0;
s.iridescenceMask = 0;
s.ior = 1;
s.transmittanceColor = float3(0, 0, 0);
s.atDistance = 0;
s.transmittanceMask = 0;
return s;
}
void ModSurfaceLitData(inout SurfaceData s)
{
//s.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD;
s.baseColor = float3(1, 0, 0);
//s.specularOcclusion = 0;
//s.normalWS = float3(0, 0, 1);
s.perceptualSmoothness = 0.5;
//s.ambientOcclusion = 0;
//s.metallic = 0;
//s.coatMask = 0;
//s.specularColor = float3(0, 0, 0);
//s.diffusionProfile = 0;
//s.subsurfaceMask = 0;
//s.thickness = 0;
//s.tangentWS = float3(1, 0, 0);
//s.anisotropy = 0;
//s.iridescenceThickness = 0;
//s.iridescenceMask = 0;
//s.ior = 1;
//s.transmittanceColor = float3(0, 0, 0);
//s.atDistance = 0;
//s.transmittanceMask = 0;
}

9
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/SurfaceLitInclude.hlsl.meta


fileFormatVersion: 2
guid: b4af743d383efc441a501cffd13c71bd
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存