浏览代码

[PlanarReflection] Fixed light list for planar reflection

/main
Frédéric Vauchelles 7 年前
当前提交
95f0f6a5
共有 7 个文件被更改,包括 19 次插入32 次删除
  1. 3
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightDefinition.cs
  2. 10
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightDefinition.cs.hlsl
  3. 1
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/LightLoop.cs
  4. 1
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightUtilities.hlsl
  5. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/PlanarReflectionProbe.cs
  6. 20
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/ProbeWrapper.cs
  7. 14
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Volumes/InfluenceVolume.cs

3
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightDefinition.cs


public Vector3 influenceExtents; // extents of the env light
public float unused0;
public Vector3 offsetLS;
public float unused1;
public Vector3 blendDistancePositive; //+X,+Y,+Z
public float unused2;
public Vector3 blendDistanceNegative; //-X,-Y,-Z

10
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightDefinition.cs.hlsl


float minProjectionDistance;
float3 influenceExtents;
float unused0;
float3 offsetLS;
float unused1;
float3 blendDistancePositive;
float unused2;
float3 blendDistanceNegative;

float GetUnused0(EnvLightData value)
{
return value.unused0;
}
float3 GetOffsetLS(EnvLightData value)
{
return value.offsetLS;
}
float GetUnused1(EnvLightData value)
{
return value.unused1;
}
float3 GetBlendDistancePositive(EnvLightData value)
{

1
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/LightLoop.cs


envLightData.up = probe.influenceUp;
envLightData.forward = probe.influenceForward;
envLightData.capturePositionWS = probe.capturePosition;
envLightData.offsetLS = probe.centerOffsetCaptureSpace;
envLightData.positionWS = probe.influencePosition;
envLightData.envIndex = envIndex;

1
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightUtilities.hlsl


output.up = float3(0.0, 1.0, 0.0);
output.right = float3(1.0, 0.0, 0.0);
output.capturePositionWS = float3(0.0, 0.0, 0.0);
output.offsetLS = float3(0.0, 0.0, 0.0);
output.influenceExtents = float3(0.0, 0.0, 0.0);
output.blendDistancePositive = float3(0.0, 0.0, 0.0);
output.blendDistanceNegative = float3(0.0, 0.0, 0.0);

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/PlanarReflectionProbe.cs


{
get { return Quaternion.LookRotation(influencePosition - capturePosition, transform.up); }
}
public Vector3 influencePosition { get { return transform.TransformPoint(influenceVolume.boxBaseOffset); } }
public Vector3 influencePosition { get { return influenceVolume.GetWorldPosition(transform); } }
public Texture customTexture { get { return m_CustomTexture; } set { m_CustomTexture = value; } }
public Texture bakedTexture { get { return m_BakedTexture; } set { m_BakedTexture = value; }}
public RenderTexture realtimeTexture { get { return m_RealtimeTexture; } internal set { m_RealtimeTexture = value; } }

20
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/ProbeWrapper.cs


public abstract ReflectionProbeMode mode { get; }
public abstract Texture texture { get; }
// Position of the center of the probe in capture space
public abstract Vector3 centerOffsetCaptureSpace { get; }
public Vector3 influencePosition
{
get
{
return centerOffsetCaptureSpace.x * influenceRight
+ centerOffsetCaptureSpace.y * influenceUp
+ centerOffsetCaptureSpace.z * influenceForward
+ capturePosition;
}
}
public abstract Vector3 influencePosition { get; }
public abstract EnvShapeType influenceShapeType { get; }
public abstract Vector3 influenceExtents { get; }
public abstract Vector3 blendNormalDistancePositive { get; }

public override Vector3 influenceUp { get { return probe.localToWorld.GetColumn(1).normalized; } }
public override Vector3 influenceForward { get { return probe.localToWorld.GetColumn(2).normalized; } }
public override Vector3 capturePosition { get { return probe.localToWorld.GetColumn(3); } }
public override Vector3 influencePosition { get { return capturePosition + probe.center; } }
public override Vector3 centerOffsetCaptureSpace { get { return probe.center; } } // center is misnamed, it is the offset (in local space) from center of the bounding box to the cubemap capture point
public override EnvShapeType influenceShapeType { get { return ConvertShape(additional.influenceShape); } }
public override float dimmer { get { return additional.dimmer; } }
public override Vector3 influenceExtents

public override Vector3 influenceForward { get { return probe.influenceForward; } }
public override Vector3 capturePosition { get { return probe.capturePosition; } }
public override Texture texture { get { return probe.texture; } }
public override Vector3 centerOffsetCaptureSpace { get { return probe.captureLocalPosition; } }
public override EnvShapeType influenceShapeType { get { return ConvertShape(probe.influenceVolume.shapeType); } }
public override float dimmer { get { return probe.dimmer; } }
public override Vector3 influenceExtents

{
default:
case ShapeType.Box:
return probe.influenceVolume.boxBaseSize;
return probe.influenceVolume.boxBaseSize * 0.5f;
public override Vector3 influencePosition { get { return probe.influencePosition; } }
public override Vector3 blendNormalDistancePositive { get { return probe.influenceVolume.boxInfluenceNormalPositiveFade; } }
public override Vector3 blendNormalDistanceNegative { get { return probe.influenceVolume.boxInfluenceNormalNegativeFade; } }
public override Vector3 blendDistancePositive { get { return probe.influenceVolume.boxInfluencePositiveFade; } }

14
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Volumes/InfluenceVolume.cs


{
default:
case ShapeType.Sphere:
return new BoundingSphere(transform.position, sphereBaseRadius);
return new BoundingSphere(transform.TransformPoint(sphereBaseOffset), sphereBaseRadius);
case ShapeType.Box:
{
var position = transform.TransformPoint(boxBaseOffset);

// TODO: Return a proper AABB based on influence box volume
return new Bounds(position, boxBaseSize);
}
}
}
public Vector3 GetWorldPosition(Transform transform)
{
switch (shapeType)
{
default:
case ShapeType.Sphere:
return transform.TransformPoint(sphereBaseOffset);
case ShapeType.Box:
return transform.TransformPoint(boxBaseOffset);
}
}
}
正在加载...
取消
保存