浏览代码

Work around the bug with sending a boolean to a shader

/asmdef
Evgenii Golubev 7 年前
当前提交
6b7a58d1
共有 3 个文件被更改,包括 14 次插入14 次删除
  1. 6
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightDefinition.cs
  2. 12
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightDefinition.cs.hlsl
  3. 10
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/LightLoop.cs

6
ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightDefinition.cs


public struct DirectionalLightData
{
public Vector3 positionWS;
public bool tileCookie;
public int tileCookie; // TODO: make it a bool
public Vector3 color;
public int shadowIndex; // -1 if unused

public Vector2 fadeDistanceScaleAndBias; // Use with ShadowMask feature
public float unused0;
public bool dynamicShadowCasterOnly; // Use with ShadowMask feature
public int dynamicShadowCasterOnly; // Use with ShadowMask feature // TODO: make it a bool
public Vector4 shadowMaskSelector; // Use with ShadowMask feature
};

public float angleScale; // Spot light
public float angleOffset; // Spot light
public float shadowDimmer;
public bool dynamicShadowCasterOnly; // Use with ShadowMask feature
public int dynamicShadowCasterOnly; // Use with ShadowMask feature // TODO: make it a bool
public Vector4 shadowMaskSelector; // Use with ShadowMask feature

12
ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightDefinition.cs.hlsl


struct DirectionalLightData
{
float3 positionWS;
bool tileCookie;
int tileCookie;
float3 color;
int shadowIndex;
float3 forward;

float diffuseScale;
float2 fadeDistanceScaleAndBias;
float unused0;
bool dynamicShadowCasterOnly;
int dynamicShadowCasterOnly;
float4 shadowMaskSelector;
};

float angleScale;
float angleOffset;
float shadowDimmer;
bool dynamicShadowCasterOnly;
int dynamicShadowCasterOnly;
float4 shadowMaskSelector;
float2 size;
int lightType;

{
return value.positionWS;
}
bool GetTileCookie(DirectionalLightData value)
int GetTileCookie(DirectionalLightData value)
{
return value.tileCookie;
}

{
return value.unused0;
}
bool GetDynamicShadowCasterOnly(DirectionalLightData value)
int GetDynamicShadowCasterOnly(DirectionalLightData value)
{
return value.dynamicShadowCasterOnly;
}

{
return value.shadowDimmer;
}
bool GetDynamicShadowCasterOnly(LightData value)
int GetDynamicShadowCasterOnly(LightData value)
{
return value.dynamicShadowCasterOnly;
}

10
ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/LightLoop.cs


if (light.light.cookie != null)
{
directionalLightData.tileCookie = light.light.cookie.wrapMode == TextureWrapMode.Repeat;
directionalLightData.tileCookie = light.light.cookie.wrapMode == TextureWrapMode.Repeat ? 1 : 0;
directionalLightData.cookieIndex = m_CookieTexArray.FetchSlice(cmd, light.light.cookie);
}
// fix up shadow information

{
directionalLightData.shadowMaskSelector[light.light.bakingOutput.occlusionMaskChannel] = 1.0f;
// TODO: make this option per light, not global
directionalLightData.dynamicShadowCasterOnly = QualitySettings.shadowmaskMode == ShadowmaskMode.Shadowmask;
directionalLightData.dynamicShadowCasterOnly = QualitySettings.shadowmaskMode == ShadowmaskMode.Shadowmask ? 1 : 0;
directionalLightData.dynamicShadowCasterOnly = false;
directionalLightData.dynamicShadowCasterOnly = 0;
}
m_CurrentSunLight = m_CurrentSunLight == null ? light.light : m_CurrentSunLight;

{
lightData.shadowMaskSelector[light.light.bakingOutput.occlusionMaskChannel] = 1.0f;
// TODO: make this option per light, not global
lightData.dynamicShadowCasterOnly = QualitySettings.shadowmaskMode == ShadowmaskMode.Shadowmask;
lightData.dynamicShadowCasterOnly = QualitySettings.shadowmaskMode == ShadowmaskMode.Shadowmask ? 1 : 0;
lightData.dynamicShadowCasterOnly = false;
lightData.dynamicShadowCasterOnly = 0;
}
m_lightList.lights.Add(lightData);

正在加载...
取消
保存