浏览代码

Moved SurfaceData to InputSrufaceCommon.

Merged CBs for particles.
/main
Aleksandr Kirillov 7 年前
当前提交
0983d198
共有 8 个文件被更改,包括 28 次插入46 次删除
  1. 14
      ScriptableRenderPipeline/LightweightPipeline/LWRP/ShaderLibrary/InputSurfaceCommon.hlsl
  2. 6
      ScriptableRenderPipeline/LightweightPipeline/LWRP/ShaderLibrary/InputSurfacePBR.hlsl
  3. 10
      ScriptableRenderPipeline/LightweightPipeline/LWRP/ShaderLibrary/Particles.hlsl
  4. 14
      ScriptableRenderPipeline/LightweightPipeline/LWRP/ShaderLibrary/ParticlesPBR.hlsl
  5. 2
      ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightStandardParticlesSimpleLighting.shader
  6. 2
      ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightStandardParticlesUnlit.shader
  7. 17
      ScriptableRenderPipeline/LightweightPipeline/LWRP/ShaderLibrary/SurfaceData.hlsl
  8. 9
      ScriptableRenderPipeline/LightweightPipeline/LWRP/ShaderLibrary/SurfaceData.hlsl.meta

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


#include "Core.hlsl"
#include "CoreRP/ShaderLibrary/Packing.hlsl"
#include "CoreRP/ShaderLibrary/CommonMaterial.hlsl"
#include "SurfaceData.hlsl"
// Must match Lightweigth ShaderGraph master node
struct SurfaceData
{
half3 albedo;
half3 specular;
half metallic;
half smoothness;
half3 normalTS;
half3 emission;
half occlusion;
half alpha;
};
///////////////////////////////////////////////////////////////////////////////
// Material Property Helpers //

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


#ifndef LIGHTWEIGHT_INPUT_SURFACE_PBS_INCLUDED
#define LIGHTWEIGHT_INPUT_SURFACE_PBS_INCLUDED
#ifndef LIGHTWEIGHT_INPUT_SURFACE_PBR_INCLUDED
#define LIGHTWEIGHT_INPUT_SURFACE_PBR_INCLUDED
#include "Core.hlsl"

outSurfaceData.alpha = Alpha(albedoAlpha.a);
}
#endif // LIGHTWEIGHT_INPUT_SURFACE_PBS_INCLUDED
#endif // LIGHTWEIGHT_INPUT_SURFACE_PBR_INCLUDED

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


#include "Core.hlsl"
#include "CoreRP/ShaderLibrary/Color.hlsl"
CBUFFER_START(UnityPerMaterial_Particle)
CBUFFER_START(UnityPerMaterial)
float4 _SoftParticleFadeParams;
float4 _CameraFadeParams;
float4 _MainTex_ST;

half _Cutoff;
half _Shininess;
half _Metallic;
half _Glossiness;
TEXTURE2D(_MainTex); SAMPLER(sampler_MainTex);
#include "InputSurfaceCommon.hlsl"
TEXTURE2D(_CameraDepthTexture);
SAMPLER(sampler_CameraDepthTexture);

return specularGloss;
}
half AlphaBlendAndTest(half alpha)
half AlphaBlendAndTest(half alpha, half cutoff)
{
#if defined(_ALPHABLEND_ON) || defined(_ALPHAPREMULTIPLY_ON) || defined(_ALPHAOVERLAY_ON)
half result = alpha;

AlphaDiscard(result, (half)_Cutoff, 0.0001h);
AlphaDiscard(result, cutoff, 0.0001h);
return result;
}

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


#ifndef LIGHTWEIGHT_PARTICLES_PBS_INCLUDED
#define LIGHTWEIGHT_PARTICLES_PBS_INCLUDED
#ifndef LIGHTWEIGHT_PARTICLES_PBR_INCLUDED
#define LIGHTWEIGHT_PARTICLES_PBR_INCLUDED
#include "SurfaceData.hlsl"
CBUFFER_START(UnityPerMaterial_ParticlePBS)
half _Metallic;
half _Glossiness;
CBUFFER_END
void InitializeSurfaceData(VertexOutputLit IN, out SurfaceData surfaceData)
{

surfaceData.smoothness = metallicGloss.g;
surfaceData.occlusion = 1.0;
surfaceData.alpha = AlphaBlendAndTest(albedo.a);
surfaceData.alpha = AlphaBlendAndTest(albedo.a, _Cutoff);
#endif // LIGHTWEIGHT_PARTICLES_PBS_INCLUDED
#endif // LIGHTWEIGHT_PARTICLES_PBR_INCLUDED

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


half4 ParticlesLitFragment(VertexOutputLit IN) : SV_Target
{
half4 albedo = Albedo(IN);
half alpha = AlphaBlendAndTest(albedo.a);
half alpha = AlphaBlendAndTest(albedo.a, _Cutoff);
half3 diffuse = AlphaModulate(albedo.rgb, alpha);
half3 normalTS = NormalTS(IN);
half3 emission = Emission(IN);

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


half4 fragParticleUnlit(VertexOutputLit IN) : SV_Target
{
half4 albedo = Albedo(IN);
half alpha = AlphaBlendAndTest(albedo.a);
half alpha = AlphaBlendAndTest(albedo.a, _Cutoff);
half3 emission = Emission(IN);
half3 diffuse = AlphaModulate(albedo.rgb, alpha);

17
ScriptableRenderPipeline/LightweightPipeline/LWRP/ShaderLibrary/SurfaceData.hlsl


#ifndef LIGHTWEIGHT_SURFACE_DATA_INCLUDED
#define LIGHTWEIGHT_SURFACE_DATA_INCLUDED
// Must match Lightweigth ShaderGraph master node
struct SurfaceData
{
half3 albedo;
half3 specular;
half metallic;
half smoothness;
half3 normalTS;
half3 emission;
half occlusion;
half alpha;
};
#endif // LIGHTWEIGHT_SURFACE_DATA_INCLUDED

9
ScriptableRenderPipeline/LightweightPipeline/LWRP/ShaderLibrary/SurfaceData.hlsl.meta


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