比较提交

...
此合并请求有变更与目标分支冲突。
/ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightStandardSimpleLighting.shader
/ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs
/ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightShaderLibrary/Input.hlsl
/ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightShaderLibrary/Lighting.hlsl

1 次代码提交

作者 SHA1 备注 提交日期
Tim Cooper cf875c87 No ligh list support 7 年前
共有 4 个文件被更改,包括 21 次插入23 次删除
  1. 8
      ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs
  2. 12
      ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightShaderLibrary/Input.hlsl
  3. 22
      ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightShaderLibrary/Lighting.hlsl
  4. 2
      ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightStandardSimpleLighting.shader

8
ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs


additionalLightIndex++;
}
}
m_CullResults.SetLightIndexMap(perObjectLightIndexMap);
//m_CullResults.SetLightIndexMap(perObjectLightIndexMap);
cmd.SetGlobalVector(PerCameraBuffer._AdditionalLightCount, new Vector4(lightData.pixelAdditionalLightsCount,
lightData.totalAdditionalLightsCount, 0.0f, 0.0f));

RendererConfiguration GetRendererSettings(ref LightData lightData)
{
RendererConfiguration settings = RendererConfiguration.PerObjectReflectionProbes | RendererConfiguration.PerObjectLightmaps | RendererConfiguration.PerObjectLightProbe;
if (lightData.totalAdditionalLightsCount > 0)
settings |= RendererConfiguration.PerObjectLightIndices8;
//if (lightData.totalAdditionalLightsCount > 0)
// settings |= RendererConfiguration.PerObjectLightIndices8;
settings |= RendererConfiguration.ProvideLightIndices;
settings |= RendererConfiguration.PerObjectLights8;
return settings;
}

12
ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightShaderLibrary/Input.hlsl


#ifndef LIGHTWEIGHT_INPUT_INCLUDED
#define LIGHTWEIGHT_INPUT_INCLUDED
#define MAX_VISIBLE_LIGHTS 16
#define MAX_VISIBLE_LIGHTS 8
///////////////////////////////////////////////////////////////////////////////
// Constant Buffers //

float4x4 _WorldToLight;
half4 _AdditionalLightCount;
float4 _AdditionalLightPosition[MAX_VISIBLE_LIGHTS];
half4 _AdditionalLightColor[MAX_VISIBLE_LIGHTS];
half4 _AdditionalLightDistanceAttenuation[MAX_VISIBLE_LIGHTS];
half4 _AdditionalLightSpotDir[MAX_VISIBLE_LIGHTS];
half4 _AdditionalLightSpotAttenuation[MAX_VISIBLE_LIGHTS];
float4 unity_LightColor[MAX_VISIBLE_LIGHTS];
half4 unity_LightPosition[MAX_VISIBLE_LIGHTS];
half4 unity_LightAtten[MAX_VISIBLE_LIGHTS];
half4 unity_SpotDirection[MAX_VISIBLE_LIGHTS];
half4 unity_SpotAtten[MAX_VISIBLE_LIGHTS];
CBUFFER_END
// These are set internally by the engine upon request by RendererConfiguration.

22
ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightShaderLibrary/Lighting.hlsl


LightInput GetLight(int i)
{
LightInput light;
half4 indices = (i < 4) ? unity_4LightIndices0 : unity_4LightIndices1;
int index = (i < 4) ? i : i - 4;
int lightIndex = indices[index];
light.position = _AdditionalLightPosition[lightIndex];
light.color = _AdditionalLightColor[lightIndex].rgb;
light.distanceAttenuation = _AdditionalLightDistanceAttenuation[lightIndex];
light.spotDirection = _AdditionalLightSpotDir[lightIndex];
light.spotAttenuation = _AdditionalLightSpotAttenuation[lightIndex];
light.position = unity_LightPosition[i];
light.color = unity_LightColor[i].rgb;
light.distanceAttenuation = unity_LightAtten[i];
light.spotDirection = unity_SpotDirection[i];
light.spotAttenuation = unity_SpotAtten[i];
return min(_AdditionalLightCount.x, unity_LightIndicesOffsetAndCount.y);
return unity_LightIndicesOffsetAndCount.y;
}
///////////////////////////////////////////////////////////////////////////////

half3 indirectDiffuse = DiffuseGI(diffuseGI, lambert, realtimeMainLightAtten, 1.0);
half mainLightAtten = MixRealtimeAndBakedOcclusion(realtimeMainLightAtten, bakedOcclusion, mainLight.distanceAttenuation);
half3 diffuseColor = lambert * mainLightAtten + indirectDiffuse;
half3 specularColor = LightingSpecular(mainLight.color * mainLightAtten, lightDirection, normalWS, viewDirectionWS, specularGloss, shininess);
half3 diffuseColor = 0;// lambert * mainLightAtten + indirectDiffuse;
half3 specularColor = 0;//LightingSpecular(mainLight.color * mainLightAtten, lightDirection, normalWS, viewDirectionWS, specularGloss, shininess);
#ifdef _ADDITIONAL_LIGHTS
int pixelLightCount = GetPixelLightCount();
for (int lightIter = 0; lightIter < pixelLightCount; ++lightIter)
{

diffuseColor += LightingLambert(attenuatedLightColor, lightDirection, normalWS);
specularColor += LightingSpecular(attenuatedLightColor, lightDirection, normalWS, viewDirectionWS, specularGloss, shininess);
}
#endif
half3 finalColor = diffuseColor * diffuse + emission;
finalColor += specularColor;

2
ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightStandardSimpleLighting.shader


// Required to compile gles 2.0 with standard srp library
#pragma prefer_hlslcc gles
#pragma target 3.0
#pragma enable_d3d11_debug_symbols
// -------------------------------------
// Material Keywords
#pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON

正在加载...
取消
保存