浏览代码

Add real support to ontile

/main
sebastienlagarde 7 年前
当前提交
de305043
共有 5 个文件被更改,包括 91 次插入28 次删除
  1. 2
      TestbedPipelines/OnTileDeferredPipeline/Shaders/LightingTemplate.hlsl
  2. 29
      TestbedPipelines/OnTileDeferredPipeline/Shaders/Standard.shader
  3. 29
      TestbedPipelines/OnTileDeferredPipeline/Shaders/StandardSpecular.shader
  4. 50
      TestbedPipelines/OnTileDeferredPipeline/Shaders/OnTileCommon.hlsl
  5. 9
      TestbedPipelines/OnTileDeferredPipeline/Shaders/OnTileCommon.hlsl.meta

2
TestbedPipelines/OnTileDeferredPipeline/Shaders/LightingTemplate.hlsl


#define BOX_LIGHT (2)
#define DIRECTIONAL_LIGHT (3)
#include "OnTileCommon.hlsl"
#if defined(SHADER_API_D3D11)
# include "CoreRP/ShaderLibrary/API/D3D11.hlsl"
#elif defined(SHADER_API_PSSL)

29
TestbedPipelines/OnTileDeferredPipeline/Shaders/Standard.shader


{
_Color("Color", Color) = (1,1,1,1)
_MainTex("Albedo", 2D) = "white" {}
_Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
_Glossiness("Smoothness", Range(0.0, 1.0)) = 0.5

_EmissionColor("Color", Color) = (0,0,0)
_EmissionMap("Emission", 2D) = "white" {}
_DetailMask("Detail Mask", 2D) = "white" {}
_DetailAlbedoMap("Detail Albedo x2", 2D) = "grey" {}

}
CGINCLUDE
#include "OnTileCommon.hlsl"
#define UNITY_SETUP_BRDF_INPUT MetallicSetup
ENDCG

LOD 300
// ------------------------------------------------------------------
// Forward pass
Pass

// Base forward pass (directional light, emission, lightmaps, ...)
Pass
{
Name "FORWARD_BASE"
Name "FORWARD_BASE"
Tags { "LightMode" = "ForwardBase" }
Blend [_SrcBlend] [_DstBlend]

// This pass it not used during regular rendering.
Pass
{
Name "META"
Name "META"
Tags { "LightMode"="Meta" }
Cull Off

// Base forward pass (directional light, emission, lightmaps, ...)
Pass
{
Name "FORWARD"
Name "FORWARD"
Tags { "LightMode" = "ForwardBase" }
Blend [_SrcBlend] [_DstBlend]

#pragma target 2.0
#pragma shader_feature _EMISSION
#pragma shader_feature _METALLICGLOSSMAP
#pragma shader_feature _EMISSION
#pragma shader_feature _METALLICGLOSSMAP
#pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
#pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF
#pragma shader_feature _ _GLOSSYREFLECTIONS_OFF

Fog { Color (0,0,0,0) } // in additive pass fog should be black
ZWrite Off
ZTest LEqual
CGPROGRAM
#pragma target 2.0

#pragma shader_feature ___ _DETAIL_MULX2
// SM2.0: NOT SUPPORTED shader_feature _PARALLAXMAP
#pragma skip_variants SHADOWS_SOFT
#pragma vertex vertAdd
#pragma fragment fragAdd
#include "UnityStandardCoreForward.cginc"

Pass {
Name "ShadowCaster"
Tags { "LightMode" = "ShadowCaster" }
ZWrite On ZTest LEqual
CGPROGRAM

// This pass it not used during regular rendering.
Pass
{
Name "META"
Name "META"
Tags { "LightMode"="Meta" }
Cull Off

29
TestbedPipelines/OnTileDeferredPipeline/Shaders/StandardSpecular.shader


{
_Color("Color", Color) = (1,1,1,1)
_MainTex("Albedo", 2D) = "white" {}
_Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
_Glossiness("Smoothness", Range(0.0, 1.0)) = 0.5

_EmissionColor("Color", Color) = (0,0,0)
_EmissionMap("Emission", 2D) = "white" {}
_DetailMask("Detail Mask", 2D) = "white" {}
_DetailAlbedoMap("Detail Albedo x2", 2D) = "grey" {}

}
CGINCLUDE
#include "OnTileCommon.hlsl"
#define UNITY_SETUP_BRDF_INPUT SpecularSetup
ENDCG

LOD 300
Pass
{
Name "FORWARD"

// Base forward pass (directional light, emission, lightmaps, ...)
Pass
{
Name "FORWARD"
Name "FORWARD"
Tags { "LightMode" = "ForwardBase" }
Blend [_SrcBlend] [_DstBlend]

// This pass it not used during regular rendering.
Pass
{
Name "META"
Name "META"
Tags { "LightMode"="Meta" }
Cull Off

// Base forward pass (directional light, emission, lightmaps, ...)
Pass
{
Name "FORWARD"
Name "FORWARD"
Tags { "LightMode" = "ForwardBase" }
Blend [_SrcBlend] [_DstBlend]

#pragma target 2.0
#pragma shader_feature _EMISSION
#pragma shader_feature _EMISSION
#pragma shader_feature _SPECGLOSSMAP
#pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
#pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF

#pragma skip_variants SHADOWS_SOFT DYNAMICLIGHTMAP_ON DIRLIGHTMAP_COMBINED
#pragma multi_compile_fwdbase
#pragma multi_compile_fog

Fog { Color (0,0,0,0) } // in additive pass fog should be black
ZWrite Off
ZTest LEqual
CGPROGRAM
#pragma target 2.0

#pragma shader_feature ___ _DETAIL_MULX2
// SM2.0: NOT SUPPORTED shader_feature _PARALLAXMAP
#pragma skip_variants SHADOWS_SOFT
#pragma vertex vertAdd
#pragma fragment fragAdd
#include "UnityStandardCoreForward.cginc"

Pass {
Name "ShadowCaster"
Tags { "LightMode" = "ShadowCaster" }
ZWrite On ZTest LEqual
CGPROGRAM

// This pass it not used during regular rendering.
Pass
{
Name "META"
Name "META"
Tags { "LightMode"="Meta" }
Cull Off

50
TestbedPipelines/OnTileDeferredPipeline/Shaders/OnTileCommon.hlsl


// The function of the shader library are stateless, no uniform decalare in it.
// Any function that require an explicit precision, use float or half qualifier, when the function can support both, it use real (see below)
// If a function require to have both a half and a float version, then both need to be explicitly define
#ifndef real
#ifdef SHADER_API_MOBILE
#define real half
#define real2 half2
#define real3 half3
#define real4 half4
#define real2x2 half2x2
#define real2x3 half2x3
#define real3x2 half3x2
#define real3x3 half3x3
#define real3x4 half3x4
#define real4x3 half4x3
#define real4x4 half4x4
#define REAL_MIN HALF_MIN
#define REAL_MAX HALF_MAX
#define TEMPLATE_1_REAL TEMPLATE_1_HALF
#define TEMPLATE_2_REAL TEMPLATE_2_HALF
#define TEMPLATE_3_REAL TEMPLATE_3_HALF
#else
#define real float
#define real2 float2
#define real3 float3
#define real4 float4
#define real2x2 float2x2
#define real2x3 float2x3
#define real3x2 float3x2
#define real3x3 float3x3
#define real3x4 float3x4
#define real4x3 float4x3
#define real4x4 float4x4
#define REAL_MIN FLT_MIN
#define REAL_MAX FLT_MAX
#define TEMPLATE_1_REAL TEMPLATE_1_FLT
#define TEMPLATE_2_REAL TEMPLATE_2_FLT
#define TEMPLATE_3_REAL TEMPLATE_3_FLT
#endif // SHADER_API_MOBILE
#endif // #ifndef real

9
TestbedPipelines/OnTileDeferredPipeline/Shaders/OnTileCommon.hlsl.meta


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