浏览代码

Moved includes to the top where it made sense.

Scale is now an optional parameter in SampleNormal function and has half precision.
_EmissionColor is now explicitly swizzled to .rgb
/tag-1.1.4-preview
Felipe Lira 7 年前
当前提交
59b51672
共有 10 个文件被更改,包括 19 次插入22 次删除
  1. 4
      ScriptableRenderPipeline/LightweightPipeline/LWRP/ShaderLibrary/InputSurfaceCommon.hlsl
  2. 7
      ScriptableRenderPipeline/LightweightPipeline/LWRP/ShaderLibrary/InputSurfacePBR.hlsl
  3. 5
      ScriptableRenderPipeline/LightweightPipeline/LWRP/ShaderLibrary/InputSurfaceSimple.hlsl
  4. 3
      ScriptableRenderPipeline/LightweightPipeline/LWRP/ShaderLibrary/InputSurfaceUnlit.hlsl
  5. 6
      ScriptableRenderPipeline/LightweightPipeline/LWRP/ShaderLibrary/LightweightPassLitSimple.hlsl
  6. 2
      ScriptableRenderPipeline/LightweightPipeline/LWRP/ShaderLibrary/Particles.hlsl
  7. 4
      ScriptableRenderPipeline/LightweightPipeline/LWRP/ShaderLibrary/ParticlesPBR.hlsl
  8. 4
      ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightStandardParticlesSimpleLighting.shader
  9. 2
      ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightStandardParticlesUnlit.shader
  10. 4
      ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightStandardSimpleLighting.shader

4
ScriptableRenderPipeline/LightweightPipeline/LWRP/ShaderLibrary/InputSurfaceCommon.hlsl


return SAMPLE_TEXTURE2D(albedoAlphaMap, sampler_albedoAlphaMap, uv);
}
half3 SampleNormal(float2 uv, float scale, TEXTURE2D_ARGS(bumpMap, sampler_bumpMap))
half3 SampleNormal(float2 uv, TEXTURE2D_ARGS(bumpMap, sampler_bumpMap), half scale = 1.0h)
{
#if _NORMALMAP
half4 n = SAMPLE_TEXTURE2D(bumpMap, sampler_bumpMap, uv);

#ifndef _EMISSION
return 0;
#else
return SAMPLE_TEXTURE2D(emissionMap, sampler_emissionMap, uv).rgb * emissionColor.rgb;
return SAMPLE_TEXTURE2D(emissionMap, sampler_emissionMap, uv).rgb * emissionColor;
#endif
}

7
ScriptableRenderPipeline/LightweightPipeline/LWRP/ShaderLibrary/InputSurfacePBR.hlsl


#include "Core.hlsl"
#include "CoreRP/ShaderLibrary/CommonMaterial.hlsl"
#include "InputSurfaceCommon.hlsl"
CBUFFER_START(UnityPerMaterial)
float4 _MainTex_ST;

#endif
}
#include "InputSurfaceCommon.hlsl"
inline void InitializeStandardLitSurfaceData(float2 uv, out SurfaceData outSurfaceData)
{
half4 albedoAlpha = SampleAlbedoAlpha(uv, TEXTURE2D_PARAM(_MainTex, sampler_MainTex));

#endif
outSurfaceData.smoothness = specGloss.a;
outSurfaceData.normalTS = SampleNormal(uv, _BumpScale, TEXTURE2D_PARAM(_BumpMap, sampler_BumpMap));
outSurfaceData.normalTS = SampleNormal(uv, TEXTURE2D_PARAM(_BumpMap, sampler_BumpMap), _BumpScale);
outSurfaceData.emission = SampleEmission(uv, _EmissionColor, TEXTURE2D_PARAM(_EmissionMap, sampler_EmissionMap));
outSurfaceData.emission = SampleEmission(uv, _EmissionColor.rgb, TEXTURE2D_PARAM(_EmissionMap, sampler_EmissionMap));
}
#endif // LIGHTWEIGHT_INPUT_SURFACE_PBR_INCLUDED

5
ScriptableRenderPipeline/LightweightPipeline/LWRP/ShaderLibrary/InputSurfaceSimple.hlsl


#define LIGHTWEIGHT_INPUT_SURFACE_SIMPLE_INCLUDED
#include "Core.hlsl"
#include "InputSurfaceCommon.hlsl"
CBUFFER_START(UnityPerMaterial)
float4 _MainTex_ST;

TEXTURE2D(_SpecGlossMap); SAMPLER(sampler_SpecGlossMap);
half4 SpecularGloss(half2 uv, half alpha)
half4 SampleSpecularGloss(half2 uv, half alpha)
{
half4 specularGloss = half4(0, 0, 0, 1);
#ifdef _SPECGLOSSMAP

#endif
return specularGloss;
}
#include "InputSurfaceCommon.hlsl"
#endif // LIGHTWEIGHT_INPUT_SURFACE_SIMPLE_INCLUDED

3
ScriptableRenderPipeline/LightweightPipeline/LWRP/ShaderLibrary/InputSurfaceUnlit.hlsl


#define LIGHTWEIGHT_INPUT_SURFACE_UNLIT_INCLUDED
#include "Core.hlsl"
#include "InputSurfaceCommon.hlsl"
CBUFFER_START(UnityPerMaterial)
float4 _MainTex_ST;

half _Metallic;
CBUFFER_END
#include "InputSurfaceCommon.hlsl"
#endif // LIGHTWEIGHT_INPUT_SURFACE_UNLIT_INCLUDED

6
ScriptableRenderPipeline/LightweightPipeline/LWRP/ShaderLibrary/LightweightPassLitSimple.hlsl


diffuse *= alpha;
#endif
half3 normalTS = SampleNormal(uv, 1.0, TEXTURE2D_PARAM(_BumpMap, sampler_BumpMap));
half3 emission = SampleEmission(uv, _EmissionColor, TEXTURE2D_PARAM(_EmissionMap, sampler_EmissionMap));
half4 specularGloss = SpecularGloss(uv, diffuseAlpha.a);
half3 normalTS = SampleNormal(uv, TEXTURE2D_PARAM(_BumpMap, sampler_BumpMap));
half3 emission = SampleEmission(uv, _EmissionColor.rgb, TEXTURE2D_PARAM(_EmissionMap, sampler_EmissionMap));
half4 specularGloss = SampleSpecularGloss(uv, diffuseAlpha.a);
half shininess = IN.posWSShininess.w;
InputData inputData;

2
ScriptableRenderPipeline/LightweightPipeline/LWRP/ShaderLibrary/Particles.hlsl


return color;
}
half3 SampleNormalTS(VertexOutputLit IN, float scale, TEXTURE2D_ARGS(bumpMap, sampler_bumpMap))
half3 SampleNormalTS(VertexOutputLit IN, TEXTURE2D_ARGS(bumpMap, sampler_bumpMap), half scale = 1.0h)
{
#if defined(_NORMALMAP)
half4 n = readTexture(TEXTURE2D_PARAM(bumpMap, sampler_bumpMap), IN);

4
ScriptableRenderPipeline/LightweightPipeline/LWRP/ShaderLibrary/ParticlesPBR.hlsl


half2 metallicGloss = half2(_Metallic, _Glossiness);
#endif
half3 normalTS = SampleNormalTS(IN, _BumpScale, TEXTURE2D_PARAM(_BumpMap, sampler_BumpMap));
half3 emission = SampleEmission(IN, _EmissionColor, TEXTURE2D_PARAM(_EmissionMap, sampler_EmissionMap));
half3 normalTS = SampleNormalTS(IN, TEXTURE2D_PARAM(_BumpMap, sampler_BumpMap), _BumpScale);
half3 emission = SampleEmission(IN, _EmissionColor.rgb, TEXTURE2D_PARAM(_EmissionMap, sampler_EmissionMap));
surfaceData.albedo = albedo.rgb;
surfaceData.specular = half3(0.0h, 0.0h, 0.0h);

4
ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightStandardParticlesSimpleLighting.shader


half4 albedo = SampleAlbedo(IN, TEXTURE2D_PARAM(_MainTex, sampler_MainTex));
half alpha = AlphaBlendAndTest(albedo.a, _Cutoff);
half3 diffuse = AlphaModulate(albedo.rgb, alpha);
half3 normalTS = SampleNormalTS(IN, 1.0, TEXTURE2D_PARAM(_BumpMap, sampler_BumpMap));
half3 emission = SampleEmission(IN, _EmissionColor, TEXTURE2D_PARAM(_EmissionMap, sampler_EmissionMap));
half3 normalTS = SampleNormalTS(IN, TEXTURE2D_PARAM(_BumpMap, sampler_BumpMap));
half3 emission = SampleEmission(IN, _EmissionColor.rgb, TEXTURE2D_PARAM(_EmissionMap, sampler_EmissionMap));
half4 specularGloss = SampleSpecularGloss(IN, albedo.a, _SpecColor, TEXTURE2D_PARAM(_SpecGlossMap, sampler_SpecGlossMap));
half shininess = IN.viewDirShininess.w;

2
ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightStandardParticlesUnlit.shader


{
half4 albedo = SampleAlbedo(IN, TEXTURE2D_PARAM(_MainTex, sampler_MainTex));
half alpha = AlphaBlendAndTest(albedo.a, _Cutoff);
half3 emission = SampleEmission(IN, _EmissionColor, TEXTURE2D_PARAM(_EmissionMap, sampler_EmissionMap));
half3 emission = SampleEmission(IN, _EmissionColor.rgb, TEXTURE2D_PARAM(_EmissionMap, sampler_EmissionMap));
half3 diffuse = AlphaModulate(albedo.rgb, alpha);
half3 result = diffuse + emission;

4
ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightStandardSimpleLighting.shader


float2 uv = i.uv;
MetaInput o;
o.Albedo = _Color.rgb * SampleAlbedoAlpha(uv, TEXTURE2D_PARAM(_MainTex, sampler_MainTex)).rgb;
o.SpecularColor = SpecularGloss(uv, 1.0).xyz;
o.Emission = SampleEmission(uv, _EmissionColor, TEXTURE2D_PARAM(_EmissionMap, sampler_EmissionMap));
o.SpecularColor = SampleSpecularGloss(uv, 1.0).xyz;
o.Emission = SampleEmission(uv, _EmissionColor.rgb, TEXTURE2D_PARAM(_EmissionMap, sampler_EmissionMap));
return MetaFragment(o);
}

正在加载...
取消
保存