浏览代码

Make the Shader Library less real

/feature-ReflectionProbeFit
Evgenii Golubev 7 年前
当前提交
b2d2386b
共有 15 个文件被更改,包括 158 次插入169 次删除
  1. 4
      ScriptableRenderPipeline/Core/ShaderLibrary/AreaLighting.hlsl
  2. 10
      ScriptableRenderPipeline/Core/ShaderLibrary/BSDF.hlsl
  3. 2
      ScriptableRenderPipeline/Core/ShaderLibrary/CommonLighting.hlsl
  4. 42
      ScriptableRenderPipeline/Core/ShaderLibrary/EntityLighting.hlsl
  5. 3
      ScriptableRenderPipeline/Core/ShaderLibrary/ImageBasedLighting.hlsl
  6. 14
      ScriptableRenderPipeline/Core/ShaderLibrary/Macros.hlsl
  7. 38
      ScriptableRenderPipeline/Core/ShaderLibrary/Random.hlsl
  8. 18
      ScriptableRenderPipeline/Core/ShaderLibrary/Refraction.hlsl
  9. 2
      ScriptableRenderPipeline/Core/ShaderLibrary/Sampling/Hammersley.hlsl
  10. 16
      ScriptableRenderPipeline/Core/ShaderLibrary/Sampling/SampleUVMapping.hlsl
  11. 80
      ScriptableRenderPipeline/Core/ShaderLibrary/Sampling/Sampling.hlsl
  12. 84
      ScriptableRenderPipeline/Core/ShaderLibrary/Wind.hlsl
  13. 2
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl
  14. 4
      ScriptableRenderPipeline/Core/ShaderLibrary/SHMath.hlsl
  15. 8
      ScriptableRenderPipeline/Core/ShaderLibrary/SHMath.hlsl.meta

4
ScriptableRenderPipeline/Core/ShaderLibrary/AreaLighting.hlsl


// Take into account that m12 = m21 = m23 = m32 = 0 and m33 = 1.
real det = invM._11 * invM._22 - invM._22 * invM._31 * invM._13;
real3x3 cof = {invM._22, 0.0, -invM._22 * invM._31,
0.0, invM._11 - invM._13 * invM._31, 0.0,
-invM._13 * invM._22, 0.0, invM._11 * invM._22};
0.0, invM._11 - invM._13 * invM._31, 0.0,
-invM._13 * invM._22, 0.0, invM._11 * invM._22};
// 1.0 / length(mul(V, (1.0 / s * M))) = abs(s) / length(mul(V, M)).
return abs(det) / length(mul(ortho, cof));

10
ScriptableRenderPipeline/Core/ShaderLibrary/BSDF.hlsl


// Inline D_GGXAniso() * V_SmithJointGGXAniso() together for better code generation.
real DV_SmithJointGGXAniso(real TdotH, real BdotH, real NdotH, real NdotV,
real TdotL, real BdotL, real NdotL,
real roughnessT, real roughnessB, real partLambdaV)
real TdotL, real BdotL, real NdotL,
real roughnessT, real roughnessB, real partLambdaV)
{
real a2 = roughnessT * roughnessB;
real3 v = real3(roughnessB * TdotH, roughnessT * BdotH, a2 * NdotH);

}
real DV_SmithJointGGXAniso(real TdotH, real BdotH, real NdotH,
real TdotV, real BdotV, real NdotV,
real TdotL, real BdotL, real NdotL,
real roughnessT, real roughnessB)
real TdotV, real BdotV, real NdotV,
real TdotL, real BdotL, real NdotL,
real roughnessT, real roughnessB)
{
real partLambdaV = GetSmithJointGGXAnisoPartLambdaV(TdotV, BdotV, NdotV, roughnessT, roughnessB);
return DV_SmithJointGGXAniso(TdotH, BdotH, NdotH, NdotV, TdotL, BdotL, NdotL,

2
ScriptableRenderPipeline/Core/ShaderLibrary/CommonLighting.hlsl


// Both the ellipsoid (e.i. 'axis') and 'unL' should be in the same coordinate system.
// 'unL' should be computed from the center of the ellipsoid.
real GetEllipsoidalDistanceAttenuation(real3 unL, real invSqRadius,
real3 axis, real invAspectRatio)
real3 axis, real invAspectRatio)
{
// Project the unnormalized light vector onto the axis.
real projL = dot(unL, axis);

42
ScriptableRenderPipeline/Core/ShaderLibrary/EntityLighting.hlsl


// TODO: the packing here is inefficient as we will fetch values far away from each other and they may not fit into the cache - Suggest we pack RGB continuously
// TODO: The calcul of texcoord could be perform with a single matrix multicplication calcualted on C++ side that will fold probeVolumeMin and probeVolumeSizeInv into it and handle the identity case, no reasons to do it in C++ (ask Ionut about it)
// It should also handle the camera relative path (if the render pipeline use it)
real3 SampleProbeVolumeSH4(TEXTURE3D_ARGS(SHVolumeTexture, SHVolumeSampler), real3 positionWS, real3 normalWS, real4x4 WorldToTexture,
real transformToLocal, real texelSizeX, real3 probeVolumeMin, real3 probeVolumeSizeInv)
float3 SampleProbeVolumeSH4(TEXTURE3D_ARGS(SHVolumeTexture, SHVolumeSampler), float3 positionWS, float3 normalWS, float4x4 WorldToTexture,
float transformToLocal, float texelSizeX, float3 probeVolumeMin, float3 probeVolumeSizeInv)
real3 position = (transformToLocal == 1.0) ? mul(WorldToTexture, real4(positionWS, 1.0)).xyz : positionWS;
real3 texCoord = (position - probeVolumeMin) * probeVolumeSizeInv.xyz;
float3 position = (transformToLocal == 1.0) ? mul(WorldToTexture, float4(positionWS, 1.0)).xyz : positionWS;
float3 texCoord = (position - probeVolumeMin) * probeVolumeSizeInv.xyz;
// Clamp to edge of the "internal" texture, as R is from real texel to size of R texture minus real texel.
// Clamp to edge of the "internal" texture, as R is from half texel to size of R texture minus half texel.
real4 shAr = SAMPLE_TEXTURE3D(SHVolumeTexture, SHVolumeSampler, texCoord);
float4 shAr = SAMPLE_TEXTURE3D(SHVolumeTexture, SHVolumeSampler, texCoord);
real4 shAg = SAMPLE_TEXTURE3D(SHVolumeTexture, SHVolumeSampler, texCoord);
float4 shAg = SAMPLE_TEXTURE3D(SHVolumeTexture, SHVolumeSampler, texCoord);
real4 shAb = SAMPLE_TEXTURE3D(SHVolumeTexture, SHVolumeSampler, texCoord);
float4 shAb = SAMPLE_TEXTURE3D(SHVolumeTexture, SHVolumeSampler, texCoord);
real4 SampleProbeOcclusion(TEXTURE3D_ARGS(SHVolumeTexture, SHVolumeSampler), real3 positionWS, real4x4 WorldToTexture,
real transformToLocal, real texelSizeX, real3 probeVolumeMin, real3 probeVolumeSizeInv)
float4 SampleProbeOcclusion(TEXTURE3D_ARGS(SHVolumeTexture, SHVolumeSampler), float3 positionWS, float4x4 WorldToTexture,
float transformToLocal, float texelSizeX, float3 probeVolumeMin, float3 probeVolumeSizeInv)
real3 position = (transformToLocal == 1.0) ? mul(WorldToTexture, real4(positionWS, 1.0)).xyz : positionWS;
real3 texCoord = (position - probeVolumeMin) * probeVolumeSizeInv.xyz;
float3 position = (transformToLocal == 1.0) ? mul(WorldToTexture, float4(positionWS, 1.0)).xyz : positionWS;
float3 texCoord = (position - probeVolumeMin) * probeVolumeSizeInv.xyz;
// Sample fourth texture in the atlas
// We need to compute proper U coordinate to sample.

return (decodeInstructions.x * pow(alpha, decodeInstructions.y)) * encodedIrradiance.rgb;
}
real3 SampleSingleLightmap(TEXTURE2D_ARGS(lightmapTex, lightmapSampler), real2 uv, real4 transform, bool encodedLightmap)
float3 SampleSingleLightmap(TEXTURE2D_ARGS(lightmapTex, lightmapSampler), float2 uv, float4 transform, bool encodedLightmap)
real3 illuminance = real3(0.0, 0.0, 0.0);
float3 illuminance = float3(0.0, 0.0, 0.0);
real4 encodedIlluminance = SAMPLE_TEXTURE2D(lightmapTex, lightmapSampler, uv).rgba;
float4 encodedIlluminance = SAMPLE_TEXTURE2D(lightmapTex, lightmapSampler, uv).rgba;
illuminance = DecodeLightmap(encodedIlluminance);
}
else

return illuminance;
}
real3 SampleDirectionalLightmap(TEXTURE2D_ARGS(lightmapTex, lightmapSampler), TEXTURE2D_ARGS(lightmapDirTex, lightmapDirSampler), real2 uv, real4 transform, real3 normalWS, bool encodedLightmap)
float3 SampleDirectionalLightmap(TEXTURE2D_ARGS(lightmapTex, lightmapSampler), TEXTURE2D_ARGS(lightmapDirTex, lightmapDirSampler), float2 uv, float4 transform, float3 normalWS, bool encodedLightmap)
// in a way, that using it for real Lambert and then dividing by a "rebalancing coefficient"
// in a way, that using it for half Lambert and then dividing by a "rebalancing coefficient"
// gives a result close to plain diffuse response lightmaps, but normalmapped.
// Note that dir is not unit length on purpose. Its length is "directionality", like

uv = uv * transform.xy + transform.zw;
real4 direction = SAMPLE_TEXTURE2D(lightmapDirTex, lightmapDirSampler, uv);
float4 direction = SAMPLE_TEXTURE2D(lightmapDirTex, lightmapDirSampler, uv);
real3 illuminance = real3(0.0, 0.0, 0.0);
float3 illuminance = float3(0.0, 0.0, 0.0);
real4 encodedIlluminance = SAMPLE_TEXTURE2D(lightmapTex, lightmapSampler, uv).rgba;
float4 encodedIlluminance = SAMPLE_TEXTURE2D(lightmapTex, lightmapSampler, uv).rgba;
illuminance = DecodeLightmap(encodedIlluminance);
}
else

real halfLambert = dot(normalWS, direction.xyz - 0.5) + 0.5;
float halfLambert = dot(normalWS, direction.xyz - 0.5) + 0.5;
return illuminance * halfLambert / max(1e-4, direction.w);
}

3
ScriptableRenderPipeline/Core/ShaderLibrary/ImageBasedLighting.hlsl


#include "CommonLighting.hlsl"
#include "CommonMaterial.hlsl"
#include "BSDF.hlsl"
#include "Random.hlsl"
#include "Sampling/Sampling.hlsl"
#ifndef UNITY_SPECCUBE_LOD_STEPS

out real NdotL,
out real NdotH,
out real VdotH,
bool VeqN = false)
bool VeqN = false)
{
real3 localV = mul(V, transpose(localToWorld));

14
ScriptableRenderPipeline/Core/ShaderLibrary/Macros.hlsl


#define HALF_PI 1.57079632679489661923
#define INV_HALF_PI 0.63661977236758134308
#define LOG2_E 1.44269504088896340736
#define INFINITY asfloat(0x7F800000)
#define MILLIMETERS_PER_METER 1000
#define METERS_PER_MILLIMETER rcp(MILLIMETERS_PER_METER)

#define FLT_EPS 5.960464478e-8 // 2^-24, machine epsilon: 1 + EPS = 1 (real of the ULP for 1)
#define FLT_MIN 1.175494351e-38 // Minimum representable positive floating-point number
#define FLT_MAX 3.402823466e+38 // Maximum representable floating-point number
#define HALF_MIN 6.103515625e-5 // 2^-14, the same value for 10, 11 and 16-bit: https://www.khronos.org/opengl/wiki/Small_Float_Formats
#define HALF_MAX 65504.0
#define UINT_MAX 0xFFFFFFFFu
#define FLT_INF asfloat(0x7F800000)
#define FLT_EPS 5.960464478e-8 // 2^-24, machine epsilon: 1 + EPS = 1 (half of the ULP for 1.0f)
#define FLT_MIN 1.175494351e-38 // Minimum representable positive floating-point number
#define FLT_MAX 3.402823466e+38 // Maximum representable floating-point number
#define HALF_MIN 6.103515625e-5 // 2^-14, the same value for 10, 11 and 16-bit: https://www.khronos.org/opengl/wiki/Small_Float_Formats
#define HALF_MAX 65504.0
#define UINT_MAX 0xFFFFFFFFu
#define TEMPLATE_1_FLT(FunctionName, Parameter1, FunctionBody) \
real FunctionName(real Parameter1) { FunctionBody; } \

38
ScriptableRenderPipeline/Core/ShaderLibrary/Random.hlsl


return JenkinsHash(v.x ^ JenkinsHash(v.y) ^ JenkinsHash(v.z) ^ JenkinsHash(v.w));
}
// Construct a real with real-open range [0, 1) using low 23 bits.
// Construct a float with float-open range [0, 1) using low 23 bits.
real ConstructFloat(int m) {
float ConstructFloat(int m) {
const int ieeeMantissa = 0x007FFFFF; // Binary FP32 mantissa bitmask
const int ieeeOne = 0x3F800000; // 1.0 in FP32 IEEE

real f = asfloat(m); // Range [1, 2)
float f = asfloat(m); // Range [1, 2)
real ConstructFloat(uint m)
float ConstructFloat(uint m)
// Pseudo-random value in real-open range [0, 1). The distribution is reasonably uniform.
// Pseudo-random value in float-open range [0, 1). The distribution is reasonably uniform.
real GenerateHashedRandomFloat(uint x)
float GenerateHashedRandomFloat(uint x)
real GenerateHashedRandomFloat(uint2 v)
float GenerateHashedRandomFloat(uint2 v)
real GenerateHashedRandomFloat(uint3 v)
float GenerateHashedRandomFloat(uint3 v)
real GenerateHashedRandomFloat(uint4 v)
float GenerateHashedRandomFloat(uint4 v)
}
float Hash(uint s)
{
s = s ^ 2747636419u;
s = s * 2654435769u;
s = s ^ (s >> 16);
s = s * 2654435769u;
s = s ^ (s >> 16);
s = s * 2654435769u;
return float(s) * rcp(4294967296.0); // 2^-32
}
float2 InitRandom(float2 input)
{
float2 r;
r.x = Hash(uint(input.x * UINT_MAX));
r.y = Hash(uint(input.y * UINT_MAX));
return r;
}
#endif // SHADER_API_GLES

18
ScriptableRenderPipeline/Core/ShaderLibrary/Refraction.hlsl


struct RefractionModelResult
{
real distance; // length of the transmission during refraction through the shape
real3 positionWS; // out ray position
real3 rayWS; // out ray direction
real dist; // length of the transmission during refraction through the shape
real3 positionWS; // out ray position
real3 rayWS; // out ray direction
};
RefractionModelResult RefractionModelSphere(real3 V, real3 positionWS, real3 normalWS, real ior, real thickness)

// Second refraction (tangent sphere out)
real NoR1 = dot(normalWS, R1);
// Optical depth within the sphere
real distance = -NoR1 * thickness;
real dist = -NoR1 * thickness;
real3 P1 = positionWS + R1 * distance;
real3 P1 = positionWS + R1 * dist;
// Out normal
real3 N1 = normalize(C - P1);
// Out refracted ray

RefractionModelResult result;
result.distance = distance;
result.dist = dist;
result.positionWS = P1;
result.rayWS = R2;

real3 R = refract(-V, normalWS, 1.0 / ior);
// Optical depth within the thin plane
real distance = thickness / dot(R, -normalWS);
real dist = thickness / dot(R, -normalWS);
result.distance = distance;
result.positionWS = positionWS + R * distance;
result.dist = dist;
result.positionWS = positionWS + R * dist;
result.rayWS = -V;
return result;

2
ScriptableRenderPipeline/Core/ShaderLibrary/Sampling/Hammersley.hlsl


real VanDerCorputBase2(uint i)
{
return ReverseBits32(i) * rcp(4294967296.0); // 0x100000000
return ReverseBits32(i) * rcp(4294967296.0); // 2^-32
}
real2 Hammersley2dSeq(uint i, uint sequenceLength)

16
ScriptableRenderPipeline/Core/ShaderLibrary/Sampling/SampleUVMapping.hlsl


struct UVMapping
{
int mappingType;
real2 uv; // Current uv or planar uv
float2 uv; // Current uv or planar uv
real2 uvZY;
real2 uvXZ;
real2 uvXY;
float2 uvZY;
float2 uvXZ;
float2 uvXY;
real3 normalWS; // vertex normal
real3 triplanarWeights;
float3 normalWS; // vertex normal
float3 triplanarWeights;
real3 tangentWS;
real3 bitangentWS;
float3 tangentWS;
float3 bitangentWS;
// TODO: store also object normal map for object triplanar
#endif
};

80
ScriptableRenderPipeline/Core/ShaderLibrary/Sampling/Sampling.hlsl


#include "Fibonacci.hlsl"
#include "Hammersley.hlsl"
real Hash(uint s)
{
s = s ^ 2747636419u;
s = s * 2654435769u;
s = s ^ (s >> 16);
s = s * 2654435769u;
s = s ^ (s >> 16);
s = s * 2654435769u;
return real(s) / 4294967295.0;
}
real2 InitRandom(real2 input)
{
real2 r;
r.x = Hash(uint(input.x * 4294967295.0));
r.y = Hash(uint(input.y * 4294967295.0));
return r;
}
//-----------------------------------------------------------------------------
// Coordinate system conversion
//-----------------------------------------------------------------------------

return SphericalToCartesian(phi, cosTheta);
}
void SampleSphere( real2 u,
real4x4 localToWorld,
real radius,
out real lightPdf,
out real3 P,
out real3 Ns)
void SampleSphere(real2 u,
real4x4 localToWorld,
real radius,
out real lightPdf,
out real3 P,
out real3 Ns)
{
real u1 = u.x;
real u2 = u.y;

lightPdf = 1.0 / (FOUR_PI * radius * radius);
}
void SampleHemisphere( real2 u,
real4x4 localToWorld,
real radius,
out real lightPdf,
out real3 P,
out real3 Ns)
void SampleHemisphere(real2 u,
real4x4 localToWorld,
real radius,
out real lightPdf,
out real3 P,
out real3 Ns)
{
real u1 = u.x;
real u2 = u.y;

}
// Note: The cylinder has no end caps (i.e. no disk on the side)
void SampleCylinder(real2 u,
void SampleCylinder(real2 u,
real radius,
real width,
out real lightPdf,
out real3 P,
out real3 Ns)
real radius,
real width,
out real lightPdf,
out real3 P,
out real3 Ns)
{
real u1 = u.x;
real u2 = u.y;

lightPdf = 1.0 / (TWO_PI * radius * width);
}
void SampleRectangle( real2 u,
real4x4 localToWorld,
real width,
real height,
out real lightPdf,
out real3 P,
out real3 Ns)
void SampleRectangle(real2 u,
real4x4 localToWorld,
real width,
real height,
out real lightPdf,
out real3 P,
out real3 Ns)
{
// Random point at rectangle surface
P = real3((u.x - 0.5) * width, (u.y - 0.5) * height, 0);

lightPdf = 1.0 / (width * height);
}
void SampleDisk(real2 u,
void SampleDisk(real2 u,
real radius,
out real lightPdf,
out real3 P,
out real3 Ns)
real radius,
out real lightPdf,
out real3 P,
out real3 Ns)
{
// Random point at disk surface
P = real3(radius * SampleDiskUniform(u.x, u.y), 0);

84
ScriptableRenderPipeline/Core/ShaderLibrary/Wind.hlsl


// Globals
// TODO: no global variable or resource declarations in the Shader Library. Functions and macros only!
real4 WIND_SETTINGS_WorldDirectionAndSpeed;
real WIND_SETTINGS_FlexNoiseScale;
real WIND_SETTINGS_ShiverNoiseScale;
real WIND_SETTINGS_Turbulence;
real WIND_SETTINGS_GustSpeed;
real WIND_SETTINGS_GustScale;
real WIND_SETTINGS_GustWorldScale;
float4 WIND_SETTINGS_WorldDirectionAndSpeed;
float WIND_SETTINGS_FlexNoiseScale;
float WIND_SETTINGS_ShiverNoiseScale;
float WIND_SETTINGS_Turbulence;
float WIND_SETTINGS_GustSpeed;
float WIND_SETTINGS_GustScale;
float WIND_SETTINGS_GustWorldScale;
real AttenuateTrunk(real x, real s)
float AttenuateTrunk(float x, float s)
real r = (x / s);
float r = (x / s);
real3 Rotate(real3 pivot, real3 position, real3 rotationAxis, real angle)
float3 Rotate(float3 pivot, float3 position, float3 rotationAxis, float angle)
real3 cpa = pivot + rotationAxis * dot(rotationAxis, position - pivot);
float3 cpa = pivot + rotationAxis * dot(rotationAxis, position - pivot);
real3 Direction;
real Strength;
real3 ShiverStrength;
real3 ShiverDirection;
float3 Direction;
float Strength;
float3 ShiverStrength;
float3 ShiverDirection;
real3 texNoise(real3 worldPos, real LOD)
float3 texNoise(float3 worldPos, float LOD)
real texGust(real3 worldPos, real LOD)
float texGust(float3 worldPos, float LOD)
WindData GetAnalyticalWind(real3 WorldPosition, real3 PivotPosition, real drag, real shiverDrag, real initialBend, real4 time)
WindData GetAnalyticalWind(float3 WorldPosition, float3 PivotPosition, float drag, float shiverDrag, float initialBend, float4 time)
real3 normalizedDir = normalize(WIND_SETTINGS_WorldDirectionAndSpeed.xyz);
float3 normalizedDir = normalize(WIND_SETTINGS_WorldDirectionAndSpeed.xyz);
real3 worldOffset = normalizedDir * WIND_SETTINGS_WorldDirectionAndSpeed.w * time.y;
real3 gustWorldOffset = normalizedDir * WIND_SETTINGS_GustSpeed * time.y;
float3 worldOffset = normalizedDir * WIND_SETTINGS_WorldDirectionAndSpeed.w * time.y;
float3 gustWorldOffset = normalizedDir * WIND_SETTINGS_GustSpeed * time.y;
real3 trunk = real3(0,0,0);
float3 trunk = float3(0,0,0);
if(WIND_SETTINGS_WorldDirectionAndSpeed.w > 0.0 || WIND_SETTINGS_Turbulence > 0.0)
{

real gust = 0.0;
float gust = 0.0;
if(WIND_SETTINGS_GustSpeed > 0.0)
{

real3 trunkNoise =
float3 trunkNoise =
(
(normalizedDir * WIND_SETTINGS_WorldDirectionAndSpeed.w)
+ (gust * normalizedDir * WIND_SETTINGS_GustSpeed)

// Shiver Noise
real3 shiverNoise = texNoise((WorldPosition - worldOffset)*WIND_SETTINGS_ShiverNoiseScale,0) * shiverDrag * WIND_SETTINGS_Turbulence;
float3 shiverNoise = texNoise((WorldPosition - worldOffset)*WIND_SETTINGS_ShiverNoiseScale,0) * shiverDrag * WIND_SETTINGS_Turbulence;
real3 dir = trunkNoise;
real flex = length(trunkNoise) + initialBend;
real shiver = length(shiverNoise);
float3 dir = trunkNoise;
float flex = length(trunkNoise) + initialBend;
float shiver = length(shiverNoise);
result.Direction = dir;
result.ShiverDirection = shiverNoise;

void ApplyWindDisplacement( inout real3 positionWS,
real3 normalWS,
real3 rootWP,
real stiffness,
real drag,
real shiverDrag,
real shiverDirectionality,
real initialBend,
real shiverMask,
real4 time)
void ApplyWindDisplacement( inout float3 positionWS,
float3 normalWS,
float3 rootWP,
float stiffness,
float drag,
float shiverDrag,
float shiverDirectionality,
float initialBend,
float shiverMask,
float4 time)
real att = AttenuateTrunk(distance(positionWS, rootWP), stiffness);
real3 rotAxis = cross(real3(0, 1, 0), wind.Direction);
float att = AttenuateTrunk(distance(positionWS, rootWP), stiffness);
float3 rotAxis = cross(float3(0, 1, 0), wind.Direction);
real3 shiverDirection = normalize(lerp(normalWS, normalize(wind.Direction + wind.ShiverDirection), shiverDirectionality));
float3 shiverDirection = normalize(lerp(normalWS, normalize(wind.Direction + wind.ShiverDirection), shiverDirectionality));
positionWS += wind.ShiverStrength * shiverDirection * shiverMask;
}

2
ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl


RefractionModelResult refraction = REFRACTION_MODEL(V, posInput, bsdfData);
preLightData.transmissionRefractV = refraction.rayWS;
preLightData.transmissionPositionWS = refraction.positionWS;
preLightData.transmissionTransmittance = exp(-bsdfData.absorptionCoefficient * refraction.distance);
preLightData.transmissionTransmittance = exp(-bsdfData.absorptionCoefficient * refraction.dist);
// Empirical remap to try to match a bit the refractio probe blurring for the fallback
preLightData.transmissionSSMipLevel = sqrt(bsdfData.perceptualRoughness) * uint(_GaussianPyramidColorMipSize.z);
#else

4
ScriptableRenderPipeline/Core/ShaderLibrary/SHMath.hlsl


#ifndef UNITY_SHMATH_INCLUDED
#define UNITY_SHMATH_INCLUDED
#endif // UNITY_SHMATH_INCLUDED

8
ScriptableRenderPipeline/Core/ShaderLibrary/SHMath.hlsl.meta


fileFormatVersion: 2
guid: 6c7ed7ec061ae2243bb560c39b451a15
timeCreated: 1472140530
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存