浏览代码

Changed line endings to LF. Allow 8 splat textures per pass in TerrainList_Basemap_Gen.shader.

/main
Yao Xiaoling 6 年前
当前提交
93a66c4c
共有 3 个文件被更改,包括 92 次插入59 次删除
  1. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/TerrainLit/TerrainLit.shader
  2. 14
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/TerrainLit/TerrainLitData.hlsl
  3. 135
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/TerrainLit/TerrainLit_Basemap_Gen.shader

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/TerrainLit/TerrainLit.shader


#pragma shader_feature _DENSITY_MODE
#pragma shader_feature _TERRAINLIT_1_LAYER _TERRAINLIT_2_LAYERS _TERRAINLIT_3_LAYERS _TERRAINLIT_4_LAYERS _TERRAINLIT_5_LAYERS _TERRAINLIT_6_LAYERS _TERRAINLIT_7_LAYERS _TERRAINLIT_8_LAYERS
#pragma shader_feature _TERRAIN_1_SPLAT _TERRAIN_2_SPLATS _TERRAIN_3_SPLATS _TERRAIN_4_SPLATS _TERRAIN_5_SPLATS _TERRAIN_6_SPLATS _TERRAIN_7_SPLATS _TERRAIN_8_SPLATS
#pragma shader_feature _DISABLE_DBUFFER

14
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/TerrainLit/TerrainLitData.hlsl


#include "../Lit/LitBuiltinData.hlsl"
#include "../Decal/DecalUtilities.hlsl"
#if defined(_TERRAINLIT_8_LAYERS)
#if defined(_TERRAIN_8_SPLATS)
#elif defined(_TERRAINLIT_7_LAYERS)
#elif defined(_TERRAIN_7_SPLATS)
#elif defined(_TERRAINLIT_6_LAYERS)
#elif defined(_TERRAIN_6_SPLATS)
#elif defined(_TERRAINLIT_5_LAYERS)
#elif defined(_TERRAIN_5_SPLATS)
#elif defined(_TERRAINLIT_4_LAYERS)
#elif defined(_TERRAIN_4_SPLATS)
#elif defined(_TERRAINLIT_3_LAYERS)
#elif defined(_TERRAIN_3_SPLATS)
#elif defined(_TERRAINLIT_2_LAYERS)
#elif defined(_TERRAIN_2_SPLATS)
#define _LAYER_COUNT 2
#else
#define _LAYER_COUNT 1

135
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/TerrainLit/TerrainLit_Basemap_Gen.shader


{
Properties
{
[HideInInspector] _Control ("AlphaMap", 2D) = "" {}
[HideInInspector] _Control0 ("AlphaMap", 2D) = "" {}
[HideInInspector] _Control1 ("AlphaMap", 2D) = "" {}
[HideInInspector] _Splat4 ("Layer 0 (R)", 2D) = "white" {}
[HideInInspector] _Splat5 ("Layer 1 (G)", 2D) = "white" {}
[HideInInspector] _Splat6 ("Layer 2 (B)", 2D) = "white" {}
[HideInInspector] _Splat7 ("Layer 3 (A)", 2D) = "white" {}
[HideInInspector] _Smoothness0("Smoothness0", Range(0.0, 1.0)) = 1.0
[HideInInspector] _Smoothness1("Smoothness1", Range(0.0, 1.0)) = 1.0
[HideInInspector] _Smoothness2("Smoothness2", Range(0.0, 1.0)) = 1.0
[HideInInspector] _Smoothness3("Smoothness3", Range(0.0, 1.0)) = 1.0
[HideInInspector] _Metallic0("Metallic0", Range(0.0, 1.0)) = 1.0
[HideInInspector] _Metallic1("Metallic1", Range(0.0, 1.0)) = 1.0
[HideInInspector] _Metallic2("Metallic2", Range(0.0, 1.0)) = 1.0
[HideInInspector] _Metallic3("Metallic3", Range(0.0, 1.0)) = 1.0
[HideInInspector] _Smoothness0 ("Smoothness0", Range(0.0, 1.0)) = 0.0
[HideInInspector] _Smoothness1 ("Smoothness1", Range(0.0, 1.0)) = 0.0
[HideInInspector] _Smoothness2 ("Smoothness2", Range(0.0, 1.0)) = 0.0
[HideInInspector] _Smoothness3 ("Smoothness3", Range(0.0, 1.0)) = 0.0
[HideInInspector] _Smoothness4 ("Smoothness0", Range(0.0, 1.0)) = 0.0
[HideInInspector] _Smoothness5 ("Smoothness1", Range(0.0, 1.0)) = 0.0
[HideInInspector] _Smoothness6 ("Smoothness2", Range(0.0, 1.0)) = 0.0
[HideInInspector] _Smoothness7 ("Smoothness3", Range(0.0, 1.0)) = 0.0
[HideInInspector] _DstBlend("DstBlend", Float) = 0.0
[HideInInspector] _Metallic0 ("Metallic0", Range(0.0, 1.0)) = 0.0
[HideInInspector] _Metallic1 ("Metallic1", Range(0.0, 1.0)) = 0.0
[HideInInspector] _Metallic2 ("Metallic2", Range(0.0, 1.0)) = 0.0
[HideInInspector] _Metallic3 ("Metallic3", Range(0.0, 1.0)) = 0.0
[HideInInspector] _Metallic4 ("Metallic0", Range(0.0, 1.0)) = 0.0
[HideInInspector] _Metallic5 ("Metallic1", Range(0.0, 1.0)) = 0.0
[HideInInspector] _Metallic6 ("Metallic2", Range(0.0, 1.0)) = 0.0
[HideInInspector] _Metallic7 ("Metallic3", Range(0.0, 1.0)) = 0.0
Tags { "SplatCount" = "8" }
HLSLINCLUDE
#define USE_LEGACY_UNITY_MATRIX_VARIABLES

TEXTURE2D(_Control);
SAMPLER(sampler_Control);
TEXTURE2D(_Control0);
TEXTURE2D(_Control1);
SAMPLER(sampler_Control0);
struct appdata_t {
float3 vertex : POSITION;

struct v2f
{
float4 vertex : SV_POSITION;
float2 texcoord : TEXCOORD0;
};
ENDHLSL
Pass

"Name" = "_MainTex"
"Format" = "ARGB32"
"Size" = "1"
"EmptyColor" = "FFFFFFFF"
}
ZTest Always Cull Off ZWrite Off

TEXTURE2D(_Splat1);
TEXTURE2D(_Splat2);
TEXTURE2D(_Splat3);
TEXTURE2D(_Splat4);
TEXTURE2D(_Splat5);
TEXTURE2D(_Splat6);
TEXTURE2D(_Splat7);
SAMPLER(sampler_Splat0);
float _Smoothness0;

float _Smoothness4;
float _Smoothness5;
float _Smoothness6;
float _Smoothness7;
float4 _Splat4_ST;
float4 _Splat5_ST;
float4 _Splat6_ST;
float4 _Splat7_ST;
struct v2f
{
float4 vertex : SV_POSITION;
float2 texcoord0 : TEXCOORD0;
float2 texcoord1 : TEXCOORD1;
float2 texcoord2 : TEXCOORD2;
float2 texcoord3 : TEXCOORD3;
float2 texcoord4 : TEXCOORD4;
};
o.texcoord0 = v.texcoord;
o.texcoord1 = v.texcoord * _Splat0_ST.xy + _Splat0_ST.zw;
o.texcoord2 = v.texcoord * _Splat1_ST.xy + _Splat1_ST.zw;
o.texcoord3 = v.texcoord * _Splat2_ST.xy + _Splat2_ST.zw;
o.texcoord4 = v.texcoord * _Splat3_ST.xy + _Splat3_ST.zw;
o.texcoord = v.texcoord;
float4 weights = SAMPLE_TEXTURE2D(_Control, sampler_Control, i.texcoord0);
float4 splat0 = SAMPLE_TEXTURE2D(_Splat0, sampler_Splat0, i.texcoord1);
float4 splat1 = SAMPLE_TEXTURE2D(_Splat1, sampler_Splat0, i.texcoord2);
float4 splat2 = SAMPLE_TEXTURE2D(_Splat2, sampler_Splat0, i.texcoord3);
float4 splat3 = SAMPLE_TEXTURE2D(_Splat3, sampler_Splat0, i.texcoord4);
float4 weights0 = SAMPLE_TEXTURE2D(_Control0, sampler_Control0, i.texcoord);
float4 weights1 = SAMPLE_TEXTURE2D(_Control1, sampler_Control0, i.texcoord);
float4 splat0 = SAMPLE_TEXTURE2D(_Splat0, sampler_Splat0, TRANSFORM_TEX(i.texcoord, _Splat0));
float4 splat1 = SAMPLE_TEXTURE2D(_Splat1, sampler_Splat0, TRANSFORM_TEX(i.texcoord, _Splat1));
float4 splat2 = SAMPLE_TEXTURE2D(_Splat2, sampler_Splat0, TRANSFORM_TEX(i.texcoord, _Splat2));
float4 splat3 = SAMPLE_TEXTURE2D(_Splat3, sampler_Splat0, TRANSFORM_TEX(i.texcoord, _Splat3));
float4 splat4 = SAMPLE_TEXTURE2D(_Splat4, sampler_Splat0, TRANSFORM_TEX(i.texcoord, _Splat4));
float4 splat5 = SAMPLE_TEXTURE2D(_Splat5, sampler_Splat0, TRANSFORM_TEX(i.texcoord, _Splat5));
float4 splat6 = SAMPLE_TEXTURE2D(_Splat6, sampler_Splat0, TRANSFORM_TEX(i.texcoord, _Splat6));
float4 splat7 = SAMPLE_TEXTURE2D(_Splat7, sampler_Splat0, TRANSFORM_TEX(i.texcoord, _Splat7));
splat4.a *= _Smoothness4;
splat5.a *= _Smoothness5;
splat6.a *= _Smoothness6;
splat7.a *= _Smoothness7;
float4 albedoSmoothness = splat0 * weights.x;
albedoSmoothness += splat1 * weights.y;
albedoSmoothness += splat2 * weights.z;
albedoSmoothness += splat3 * weights.w;
float4 albedoSmoothness = splat0 * weights0.x;
albedoSmoothness += splat1 * weights0.y;
albedoSmoothness += splat2 * weights0.z;
albedoSmoothness += splat3 * weights0.w;
albedoSmoothness += splat4 * weights1.x;
albedoSmoothness += splat5 * weights1.y;
albedoSmoothness += splat6 * weights1.z;
albedoSmoothness += splat7 * weights1.w;
return albedoSmoothness;
}

"Name" = "_MetallicTex"
"Format" = "R8"
"Size" = "1/4"
"EmptyColor" = "00000000"
}
ZTest Always Cull Off ZWrite Off

float _Metallic1;
float _Metallic2;
float _Metallic3;
float _Metallic4;
float _Metallic5;
float _Metallic6;
float _Metallic7;
struct v2f
{
float4 vertex : SV_POSITION;
float2 texcoord0 : TEXCOORD0;
};
o.texcoord0 = v.texcoord;
o.texcoord = v.texcoord;
float4 weights = SAMPLE_TEXTURE2D(_Control, sampler_Control, i.texcoord0);
float4 weights0 = SAMPLE_TEXTURE2D(_Control0, sampler_Control0, i.texcoord);
float4 weights1 = SAMPLE_TEXTURE2D(_Control1, sampler_Control0, i.texcoord);
float4 metallic = { _Metallic0 * weights.x, 0, 0, 0 };
metallic.r += _Metallic1 * weights.y;
metallic.r += _Metallic2 * weights.z;
metallic.r += _Metallic3 * weights.w;
float4 metallic = { _Metallic0 * weights0.x, 0, 0, 0 };
metallic.r += _Metallic1 * weights0.y;
metallic.r += _Metallic2 * weights0.z;
metallic.r += _Metallic3 * weights0.w;
metallic.r += _Metallic4 * weights1.x;
metallic.r += _Metallic5 * weights1.y;
metallic.r += _Metallic6 * weights1.z;
metallic.r += _Metallic7 * weights1.w;
return metallic;
}

正在加载...
取消
保存