浏览代码

increase number of MAX lights to 100 for demo and remove unused shadow constants

/main
Filip Iliescu 7 年前
当前提交
57b33e99
共有 3 个文件被更改,包括 7 次插入41 次删除
  1. 11
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/OnTileDeferredRenderPipeline.cs
  2. 17
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/Shaders/LightingTemplate.hlsl
  3. 20
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/Shaders/UnityStandardForwardMobile.cginc

11
Assets/ScriptableRenderPipeline/MobileRenderPipeline/OnTileDeferredRenderPipeline.cs


}
}
const int k_MaxLights = 10;
const int k_MaxShadowmapPerLights = 6;
const int k_MaxDirectionalSplit = 4;
// This must match MAX_LIGHTS in UnityStandardForwardMobile
const int k_MaxLights = 100;
// arrays for shader data
private Vector4[] m_LightData = new Vector4[k_MaxLights]; // x:Light_type, y:ShadowIndex z:w:UNUSED

private void InitializeLightData()
{
for (int i = 0; i < k_MaxLights; ++i)
for (int i = 0; i < k_MaxLights; i++)
{
m_LightData [i] = new Vector4(0.0f, -1.0f, -1.0f, 0.0f);
m_LightColors[i] = Vector4.zero;

m_LightMatrix[i] = temp2 * temp1 * temp3 * worldToLight;
if (light.light.cookie != null)
m_LightData [i].z = m_CookieTexArray.FetchSlice (light.light.cookie);
m_LightData[i].z = m_CookieTexArray.FetchSlice (light.light.cookie);
else
m_LightData [i].z = m_CookieTexArray.FetchSlice (m_DefaultSpotCookie);

m_LightMatrix[i] = temp2 * temp1 * worldToLight;
if (light.light.cookie != null)
m_LightData [i].z = m_CookieTexArray.FetchSlice (light.light.cookie);
m_LightData[i].z = m_CookieTexArray.FetchSlice (light.light.cookie);
}
}

17
Assets/ScriptableRenderPipeline/MobileRenderPipeline/Shaders/LightingTemplate.hlsl


#include "UnityStandardUtils.cginc"
#include "UnityPBSLighting.cginc"
#define MAX_SHADOW_LIGHTS 10
#define MAX_SHADOWMAP_PER_LIGHT 6
#define MAX_DIRECTIONAL_SPLIT 4
#define CUBEMAPFACE_POSITIVE_X 0
#define CUBEMAPFACE_NEGATIVE_X 1
#define CUBEMAPFACE_POSITIVE_Y 2

# include "../../ShaderLibrary/API/Validate.hlsl"
# include "../../ShaderLibrary/Shadow/Shadow.hlsl"
#undef SHADOW_FPTL
CBUFFER_START(ShadowLightData)
float4 g_vShadow3x3PCFTerms0;
float4 g_vShadow3x3PCFTerms1;
float4 g_vShadow3x3PCFTerms2;
float4 g_vShadow3x3PCFTerms3;
float4 g_vDirShadowSplitSpheres[MAX_DIRECTIONAL_SPLIT];
float4x4 g_matWorldToShadow[MAX_SHADOW_LIGHTS * MAX_SHADOWMAP_PER_LIGHT];
CBUFFER_END
//---------------------------------------------------------------------------------------------------------------------------------------------------------
UNITY_DECLARE_DEPTH_TEXTURE(_CameraGBufferZ);

20
Assets/ScriptableRenderPipeline/MobileRenderPipeline/Shaders/UnityStandardForwardMobile.cginc


#include "OnTileShaderBase.h"
#include "../../fptl/LightDefinitions.cs.hlsl"
#define MAX_SHADOW_LIGHTS 10
#define MAX_SHADOWMAP_PER_LIGHT 6
#define MAX_DIRECTIONAL_SPLIT 4
// todo: put this is LightDefinitions common file
#define MAX_LIGHTS 100
#define CUBEMAPFACE_POSITIVE_X 0
#define CUBEMAPFACE_NEGATIVE_X 1

# include "../../ShaderLibrary/API/Validate.hlsl"
# include "../../ShaderLibrary/Shadow/Shadow.hlsl"
#undef SHADOW_FPTL
CBUFFER_START(ShadowLightData)
float4 g_vShadow3x3PCFTerms0;
float4 g_vShadow3x3PCFTerms1;
float4 g_vShadow3x3PCFTerms2;
float4 g_vShadow3x3PCFTerms3;
float4 g_vDirShadowSplitSpheres[MAX_DIRECTIONAL_SPLIT];
float4x4 g_matWorldToShadow[MAX_SHADOW_LIGHTS * MAX_SHADOWMAP_PER_LIGHT];
CBUFFER_END
struct VertexOutputForwardNew
{

return o;
}
// todo: put this is LightDefinitions common file
#define MAX_LIGHTS 10
#define USE_LEFTHAND_CAMERASPACE (0)
#define DIRECT_LIGHT (0)

正在加载...
取消
保存