浏览代码

Addressed Evgenii and Richard's comments.

/main
Felipe Lira 7 年前
当前提交
eff2ed49
共有 7 个文件被更改,包括 19 次插入44 次删除
  1. 2
      ScriptableRenderPipeline/Core/ShaderLibrary/API/GLCore.hlsl
  2. 29
      ScriptableRenderPipeline/Core/ShaderLibrary/API/GLES2.hlsl
  3. 2
      ScriptableRenderPipeline/Core/ShaderLibrary/API/GLES3.hlsl
  4. 9
      ScriptableRenderPipeline/Core/ShaderLibrary/Common.hlsl
  5. 14
      ScriptableRenderPipeline/Core/ShaderLibrary/EntityLighting.hlsl
  6. 2
      ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightShaderLibrary/Core.hlsl
  7. 5
      ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightStandardParticles.shader

2
ScriptableRenderPipeline/Core/ShaderLibrary/API/GLCore.hlsl


// This value will not go through any matrix projection convertion
#define UNITY_RAW_FAR_CLIP_VALUE (1.0)
#define FRONT_FACE_SEMATIC VFACE
#define FRONT_FACE_SEMANTIC VFACE
#define FRONT_FACE_TYPE float
#define IS_FRONT_VFACE(VAL, FRONT, BACK) ((VAL > 0.0) ? (FRONT) : (BACK))

29
ScriptableRenderPipeline/Core/ShaderLibrary/API/GLES2.hlsl


// This value will not go through any matrix projection convertion
#define UNITY_RAW_FAR_CLIP_VALUE (1.0)
#define FRONT_FACE_SEMATIC VFACE
#define FRONT_FACE_SEMANTIC VFACE
#define FRONT_FACE_TYPE float
#define IS_FRONT_VFACE(VAL, FRONT, BACK) ((VAL > 0.0) ? (FRONT) : (BACK))

#define uint int
#define uint1 int1
#define uint2 int2
#define uint3 int3
#define uint4 int4
#define min16uint int
#define min16uint1 int1
#define min16uint2 int2
#define min16uint3 int3
#define min16uint4 int4
#define uint1x1 int1x1
#define uint1x2 int1x2
#define uint1x3 int1x3
#define uint1x4 int1x4
#define uint2x1 int2x1
#define uint2x2 int2x2
#define uint2x3 int2x3
#define uint2x4 int2x4
#define uint3x1 int3x1
#define uint3x2 int3x2
#define uint3x3 int3x3
#define uint3x4 int3x4
#define uint4x1 int4x1
#define uint4x2 int4x2
#define uint4x3 int4x3
#define uint4x4 int4x4
#define rcp(x) 1.0 / x
#define ddx_fine ddx

2
ScriptableRenderPipeline/Core/ShaderLibrary/API/GLES3.hlsl


// This value will not go through any matrix projection convertion
#define UNITY_RAW_FAR_CLIP_VALUE (1.0)
#define FRONT_FACE_SEMATIC VFACE
#define FRONT_FACE_SEMANTIC VFACE
#define FRONT_FACE_TYPE float
#define IS_FRONT_VFACE(VAL, FRONT, BACK) ((VAL > 0.0) ? (FRONT) : (BACK))

9
ScriptableRenderPipeline/Core/ShaderLibrary/Common.hlsl


// ----------------------------------------------------------------------------
// Normalize that account for vectors with zero length
float3 SafeNormalize(float3 inVec)
{
float dp3 = max(FLT_MIN, dot(inVec, inVec));
return inVec * rsqrt(dp3);
}
// Normalize that account for vectors with zero length
half dp3 = max(1.e-4h, dot(inVec, inVec));
half dp3 = max(HALF_MIN, dot(inVec, inVec));
return inVec * rsqrt(dp3);
}

14
ScriptableRenderPipeline/Core/ShaderLibrary/EntityLighting.hlsl


// RGBM lightmaps are currently always gamma encoded, so we use a constant of range^2.2 = 5^2.2
#define LIGHTMAP_RGBM_RANGE 34.493242f
// DLRD lightmaps are currently alwasy gamma encoded, so we use a constant of 2.0^2.2 = 4.59
// DLRD lightmaps are currently always gamma encoded, so we use a constant of 2.0^2.2 = 4.59
#define LIGHTMAP_DLDR_RANGE 4.59f
// TODO: This is the max value allowed for emissive (bad name - but keep for now to retrieve it) (It is 8^2.2 (gamma) and 8 is the limit of punctual light slider...), comme from UnityCg.cginc. Fix it!

return rgbm;
}
half3 UnpackLightmapRGBM(half4 rgbmInput)
float3 UnpackLightmapRGBM(float4 rgbmInput)
half3 UnpackLightmapDoubleLDR(half4 encodedColor)
float3 UnpackLightmapDoubleLDR(float4 encodedColor)
half3 DecodeLightmap(half4 encodedIlluminance)
float3 DecodeLightmap(float4 encodedIlluminance)
{
#if defined(UNITY_LIGHTMAP_RGBM_ENCODING)
return UnpackLightmapRGBM(encodedIlluminance);

}
half3 DecodeHDREnvironment(half4 encodedIrradiance, half4 decodeInstructions)
float3 DecodeHDREnvironment(float4 encodedIrradiance, float4 decodeInstructions)
half alpha = max(decodeInstructions.w * (encodedIrradiance.a - 1.0) + 1.0, 0.0);
float alpha = max(decodeInstructions.w * (encodedIrradiance.a - 1.0) + 1.0, 0.0);
// If Linear mode is not supported we can skip exponent part
return (decodeInstructions.x * pow(alpha, decodeInstructions.y)) * encodedIrradiance.rgb;

// Remark: baked lightmap is RGBM for now, dynamic lightmap is RGB9E5
if (encodedLightmap)
{
half4 encodedIlluminance = SAMPLE_TEXTURE2D(lightmapTex, lightmapSampler, uv).rgba;
float4 encodedIlluminance = SAMPLE_TEXTURE2D(lightmapTex, lightmapSampler, uv).rgba;
illuminance = DecodeLightmap(encodedIlluminance);
}
else

2
ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightShaderLibrary/Core.hlsl


half Pow4(half x)
{
return x * x * x * x;
return (x * x) * (x * x);
}
void AlphaDiscard(half alpha, half cutoff)

5
ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightStandardParticles.shader


_EmissionColor("Color", Color) = (0,0,0)
_EmissionMap("Emission", 2D) = "white" {}
_DistortionStrength("Strength", Float) = 1.0
_DistortionBlend("Blend", Range(0.0, 1.0)) = 0.5
_SoftParticlesNearFadeDistance("Soft Particles Near Fade", Float) = 0.0
_SoftParticlesFarFadeDistance("Soft Particles Far Fade", Float) = 1.0
_CameraNearFadeDistance("Camera Near Fade", Float) = 1.0

[HideInInspector] _Mode("__mode", Float) = 0.0
[HideInInspector] _FlipbookMode("__flipbookmode", Float) = 0.0
[HideInInspector] _LightingEnabled("__lightingenabled", Float) = 1.0
[HideInInspector] _DistortionEnabled("__distortionenabled", Float) = 0.0
[HideInInspector] _EmissionEnabled("__emissionenabled", Float) = 0.0
[HideInInspector] _BlendOp("__blendop", Float) = 0.0
[HideInInspector] _SrcBlend("__src", Float) = 1.0

[HideInInspector] _CameraFadingEnabled("__camerafadingenabled", Float) = 0.0
[HideInInspector] _SoftParticleFadeParams("__softparticlefadeparams", Vector) = (0,0,0,0)
[HideInInspector] _CameraFadeParams("__camerafadeparams", Vector) = (0,0,0,0)
[HideInInspector] _DistortionStrengthScaled("__distortionstrengthscaled", Float) = 0.0
}
SubShader

正在加载...
取消
保存