浏览代码

add support to forward shader for rendering to emission buffer on iOS and implement specular version of forward shader and add soem tests

/main
Filip Iliescu 8 年前
当前提交
12136e13
共有 6 个文件被更改,包括 55 次插入8 次删除
  1. 1
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/Standard.shader
  2. 35
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/StandardSpecular.shader
  3. 9
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/UnityStandardForwardMobile.cginc
  4. 4
      Assets/TestScenes/MobileDeferredTest/2DirLightTest/2DirLightTest.unity
  5. 7
      Assets/TestScenes/MobileDeferredTest/2DirLightTest/op2Dir.mat
  6. 7
      Assets/TestScenes/MobileDeferredTest/2DirLightTest/trans2Dir.mat

1
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/Standard.shader


#pragma multi_compile DIRLIGHTMAP_OFF DIRLIGHTMAP_COMBINED DIRLIGHTMAP_SEPARATE
#pragma multi_compile DYNAMICLIGHTMAP_OFF DYNAMICLIGHTMAP_ON
#pragma multi_compile_fog
//#pragma multi_compile TILED_FORWARD REGULAR_FORWARD
#pragma vertex vertForward
#pragma fragment fragForward

35
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/StandardSpecular.shader


Tags { "RenderType"="Opaque" "PerformanceChecks"="False" }
LOD 300
Pass
{
Name "FORWARD"
Tags { "LightMode" = "ForwardSinglePass" }
Blend [_SrcBlend] [_DstBlend]
ZWrite [_ZWrite]
CGPROGRAM
#pragma target 4.5
// -------------------------------------
#pragma shader_feature _NORMALMAP
#pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
#pragma shader_feature _EMISSION
#pragma shader_feature _SPECGLOSSMAP
#pragma shader_feature ___ _DETAIL_MULX2
#pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
#pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF
#pragma shader_feature _ _GLOSSYREFLECTIONS_OFF
#pragma shader_feature _PARALLAXMAP
#pragma multi_compile LIGHTMAP_OFF LIGHTMAP_ON
#pragma multi_compile DIRLIGHTMAP_OFF DIRLIGHTMAP_COMBINED DIRLIGHTMAP_SEPARATE
#pragma multi_compile DYNAMICLIGHTMAP_OFF DYNAMICLIGHTMAP_ON
#pragma multi_compile_fog
#pragma vertex vertForward
#pragma fragment fragForward
#include "UnityStandardForwardMobile.cginc"
ENDCG
}
// ------------------------------------------------------------------
// Base forward pass (directional light, emission, lightmaps, ...)

9
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/UnityStandardForwardMobile.cginc


#include "UnityStandardConfig.cginc"
#include "UnityStandardCore.cginc"
#include "ShaderBase.h"
#include "OnTileShaderBase.h"
#include "../../fptl/LightDefinitions.cs.hlsl"
#define MAX_SHADOW_LIGHTS 10

}
// fragment shader main
half4 fragForward(VertexOutputForwardNew i) : SV_Target
#ifdef UNITY_FRAMEBUFFER_FETCH_AVAILABLE
half4 fragForward(VertexOutputForwardNew i) : SV_Target3
#else
half4 fragForward(VertexOutputForwardNew i) : SV_Target
#endif
{
//float linZ = GetLinearZFromSVPosW(i.pos.w); // matching script side where camera space is right handed.
//float3 vP = GetViewPosFromLinDepth(i.pos.xy, linZ);

4
Assets/TestScenes/MobileDeferredTest/2DirLightTest/2DirLightTest.unity


m_SpotAngle: 30
m_CookieSize: 10
m_Shadows:
m_Type: 1
m_Type: 0
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1

m_SpotAngle: 30
m_CookieSize: 10
m_Shadows:
m_Type: 1
m_Type: 0
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1

7
Assets/TestScenes/MobileDeferredTest/2DirLightTest/op2Dir.mat


m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: op2Dir
m_Shader: {fileID: 4800000, guid: b262af00aeb504b0a8eba68d77150908, type: 3}
m_Shader: {fileID: 4800000, guid: 078f6d0e0964240c28f6acc911996f11, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0

m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5

m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 1, g: 1, b: 1, a: 1}

7
Assets/TestScenes/MobileDeferredTest/2DirLightTest/trans2Dir.mat


m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: trans2Dir
m_Shader: {fileID: 4800000, guid: b262af00aeb504b0a8eba68d77150908, type: 3}
m_Shader: {fileID: 4800000, guid: 078f6d0e0964240c28f6acc911996f11, type: 3}
m_ShaderKeywords: _ALPHAPREMULTIPLY_ON
m_LightmapFlags: 4
m_EnableInstancingVariants: 0

m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5

m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 1, g: 1, b: 1, a: 1}
正在加载...
取消
保存