浏览代码

push not compiling code

/RenderPassXR_Sandbox
sebastienlagarde 8 年前
当前提交
e6e216f8
共有 3 个文件被更改,包括 29 次插入27 次删除
  1. 2
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightDefinition.cs
  2. 4
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePassLoop.hlsl
  3. 50
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl

2
Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightDefinition.cs


public struct DirectionalLightData
{
public Vector3 positionWS;
public float unused;
public bool tileCookie;
public Vector3 color;
public int shadowIndex; // -1 if unused

4
Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePassLoop.hlsl


float3 localDiffuseLighting, localSpecularLighting;
EvaluateBSDF_Directional(context, V, posInput, prelightData,
GPULIGHTTYPE_DIRECTIONAL, _DirectionalLightDatas[i], bsdfData,
_DirectionalLightDatas[i], bsdfData,
localDiffuseLighting, localSpecularLighting);
diffuseLighting += localDiffuseLighting;

float3 localDiffuseLighting, localSpecularLighting;
EvaluateBSDF_Directional(context, V, posInput, prelightData,
GPULIGHTTYPE_DIRECTIONAL, _DirectionalLightDatas[i], bsdfData,
_DirectionalLightDatas[i], bsdfData,
localDiffuseLighting, localSpecularLighting);
diffuseLighting += localDiffuseLighting;

50
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl


void EvaluateBSDF_Directional(LightLoopContext lightLoopContext,
float3 V, PositionInputs posInput, PreLightData preLightData,
int lightType, DirectionalLightData lightData, BSDFData bsdfData,
DirectionalLightData lightData, BSDFData bsdfData,
// Compute the NDC position (in [-1, 1]^2) by projecting 'positionWS' onto the near plane.
// 'lightData.right' and 'lightData.up' are pre-scaled on CPU.
float3 lightToSurface = positionWS - lightData.positionWS;
float3x3 lightToWorld = float3x3(lightData.right, lightData.up, lightData.forward);
float3 positionLS = mul(lightToSurface, transpose(lightToWorld));
float2 positionNDC = positionLS.xy;
// Clip only box projector lights.
float clipFactor = 1;
// Static branch.
if (lightType == GPULIGHTTYPE_PROJECTOR_BOX)
{
// bool isInBounds = max(abs(positionNDC.x), abs(positionNDC.y)) <= 1 && positionLS.z >= 0;
// float clipFactor = isInBounds ? 1 : 0;
// This version is slightly more efficient:
float clipFactor = saturate(FLT_MAX - FLT_MAX * Max3(abs(positionNDC.x), abs(positionNDC.y), positionLS.z >= 0 ? 0 : 1));
}
float attenuation = clipFactor;
float illuminance = saturate(NdotL * attenuation);
float illuminance = saturate(NdotL);
diffuseLighting = float3(0, 0, 0); // TODO: check whether using 'out' instead of 'inout' increases the VGPR pressure
specularLighting = float3(0, 0, 0); // TODO: check whether using 'out' instead of 'inout' increases the VGPR pressure

[branch] if (lightData.cookieIndex >= 0)
{
// Compute the NDC position (in [-1, 1]^2) by projecting 'positionWS' onto the near plane.
// 'lightData.right' and 'lightData.up' are pre-scaled on CPU.
float3 lightToSurface = positionWS - lightData.positionWS;
float3x3 lightToWorld = float3x3(lightData.right, lightData.up, lightData.forward);
float3 positionLS = mul(lightToSurface, transpose(lightToWorld));
float2 positionNDC = positionLS.xy;
float clipFactor = 1.0f;
if (lightData.tileCookie)
{
// Tile the texture if the 'repeat' wrap mode is enabled.
coord = frac(coord);
}
else
{
// bool isInBounds = max(abs(positionNDC.x), abs(positionNDC.y)) <= 1 && positionLS.z >= 0;
// float clipFactor = isInBounds ? 1 : 0;
// This version is slightly more efficient:
clipFactor = saturate(FLT_MAX - FLT_MAX * Max3(abs(positionNDC.x), abs(positionNDC.y), positionLS.z >= 0 ? 0 : 1));
}
cookie = c.rgb * c.a;
cookie = c.rgb * c.a * clipFactor;
}
[branch] if (illuminance > 0.0)

正在加载...
取消
保存