浏览代码

[PlanarReflection] Fixed reflection probe

/main
Frédéric Vauchelles 7 年前
当前提交
878fe6d0
共有 5 个文件被更改,包括 72 次插入29 次删除
  1. 47
      SampleScenes/HDTest/PlanarReflectionTests.unity
  2. 4
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/HDReflectionProbeUI.Drawers.cs
  3. 4
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/SerializedHDReflectionProbe.cs
  4. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/HDAdditionalReflectionData.cs
  5. 44
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/ProbeWrapper.cs

47
SampleScenes/HDTest/PlanarReflectionTests.unity


serializedVersion: 5
m_Component:
- component: {fileID: 241156469}
m_Layer: 0
m_Layer: 8
m_Name: Pillars
m_TagString: Untagged
m_Icon: {fileID: 0}

- component: {fileID: 271321843}
- component: {fileID: 271321845}
- component: {fileID: 271321844}
m_Layer: 0
m_Layer: 8
m_Name: GFX
m_TagString: Untagged
m_Icon: {fileID: 0}

serializedVersion: 5
m_Component:
- component: {fileID: 489703757}
m_Layer: 0
m_Layer: 8
m_Name: Pillar Box
m_TagString: Untagged
m_Icon: {fileID: 0}

serializedVersion: 5
m_Component:
- component: {fileID: 519373190}
m_Layer: 0
m_Layer: 8
m_Name: Pillar Cylindrical
m_TagString: Untagged
m_Icon: {fileID: 0}

blendNormalDistanceNegative: {x: 0, y: 0, z: 0}
boxSideFadePositive: {x: 1, y: 1, z: 1}
boxSideFadeNegative: {x: 1, y: 1, z: 1}
proxyVolumeComponent: {fileID: 1654939277}
--- !u!23 &547467868
MeshRenderer:
m_ObjectHideFlags: 2

m_Enabled: 1
m_Enabled: 0
m_CastShadows: 0
m_ReceiveShadows: 1
m_DynamicOccludee: 1

m_Enabled: 1
serializedVersion: 2
m_Type: 0
m_Mode: 0
m_Mode: 1
m_Resolution: 128
m_Resolution: 512
m_UpdateFrequency: 0
m_BoxSize: {x: 20.1, y: 10.1, z: 20.1}
m_BoxOffset: {x: 0, y: 2, z: 0}

m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_Bits: 4294967039
m_IntensityMultiplier: 1
m_BlendDistance: 0
m_HDR: 1

- component: {fileID: 556113918}
- component: {fileID: 556113920}
- component: {fileID: 556113919}
m_Layer: 0
m_Layer: 8
m_Name: Mirror (2)
m_TagString: Untagged
m_Icon: {fileID: 0}

- component: {fileID: 599505013}
- component: {fileID: 599505015}
- component: {fileID: 599505014}
m_Layer: 0
m_Layer: 8
m_Name: Mirror (4) Sphere
m_TagString: Untagged
m_Icon: {fileID: 0}

- component: {fileID: 605786283}
- component: {fileID: 605786285}
- component: {fileID: 605786284}
m_Layer: 0
m_Layer: 8
m_Name: GFX
m_TagString: Untagged
m_Icon: {fileID: 0}

- component: {fileID: 743933948}
- component: {fileID: 743933950}
- component: {fileID: 743933949}
m_Layer: 0
m_Layer: 8
m_Name: Mirror (2)
m_TagString: Untagged
m_Icon: {fileID: 0}

- component: {fileID: 1207854011}
- component: {fileID: 1207854013}
- component: {fileID: 1207854012}
m_Layer: 0
m_Layer: 8
m_Name: Mirror (4)
m_TagString: Untagged
m_Icon: {fileID: 0}

serializedVersion: 5
m_Component:
- component: {fileID: 1233674353}
m_Layer: 0
m_Layer: 8
m_Name: Pillar Box
m_TagString: Untagged
m_Icon: {fileID: 0}

- component: {fileID: 1250450217}
- component: {fileID: 1250450219}
- component: {fileID: 1250450218}
m_Layer: 0
m_Layer: 8
m_Name: Mirror (3)
m_TagString: Untagged
m_Icon: {fileID: 0}

- component: {fileID: 1534211091}
- component: {fileID: 1534211093}
- component: {fileID: 1534211092}
m_Layer: 0
m_Layer: 8
m_Name: GFX
m_TagString: Untagged
m_Icon: {fileID: 0}

m_Component:
- component: {fileID: 1561776758}
- component: {fileID: 1561776759}
m_Layer: 0
m_Layer: 8
m_Name: Planar Reflection Probe
m_TagString: Untagged
m_Icon: {fileID: 0}

- component: {fileID: 1562837667}
- component: {fileID: 1562837669}
- component: {fileID: 1562837668}
m_Layer: 0
m_Layer: 8
m_Name: Mirror (3)
m_TagString: Untagged
m_Icon: {fileID: 0}

- component: {fileID: 1694442297}
- component: {fileID: 1694442299}
- component: {fileID: 1694442298}
m_Layer: 0
m_Layer: 8
m_Name: GFX
m_TagString: Untagged
m_Icon: {fileID: 0}

- component: {fileID: 1927838485}
- component: {fileID: 1927838487}
- component: {fileID: 1927838486}
m_Layer: 0
m_Layer: 8
m_Name: Mirror (1)
m_TagString: Untagged
m_Icon: {fileID: 0}

- component: {fileID: 2037444866}
- component: {fileID: 2037444868}
- component: {fileID: 2037444867}
m_Layer: 0
m_Layer: 8
m_Name: Mirror
m_TagString: Untagged
m_Icon: {fileID: 0}

- component: {fileID: 2077996853}
- component: {fileID: 2077996855}
- component: {fileID: 2077996854}
m_Layer: 0
m_Layer: 8
m_Name: Mirror (1)
m_TagString: Untagged
m_Icon: {fileID: 0}

serializedVersion: 5
m_Component:
- component: {fileID: 2141715014}
m_Layer: 0
m_Layer: 8
m_Name: Pillar Cylindrical
m_TagString: Untagged
m_Icon: {fileID: 0}

4
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/HDReflectionProbeUI.Drawers.cs


namespace UnityEditor.Experimental.Rendering
{
using CED = CoreEditorDrawer<HDReflectionProbeUI, SerializedHDReflectionProbe>;
using _ = CoreEditorUtils;
public partial class HDReflectionProbeUI
{

//CED.Action(Drawer_IntensityMultiplier),
CED.space,
CED.Action(Drawer_Toolbar),
CED.space
CED.space,
CED.Action((s, d, o) => EditorGUILayout.PropertyField(d.proxyVolumeComponent, _.GetContent("Proxy Volume")))
);
public static readonly CED.IDrawer SectionInfluenceVolumeSettings = CED.FoldoutGroup(

4
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/SerializedHDReflectionProbe.cs


internal SerializedProperty boxSideFadeNegative;
internal SerializedProperty dimmer;
internal SerializedProperty proxyVolumeComponent;
public SerializedHDReflectionProbe(SerializedObject so, SerializedObject addso)
{
this.so = so;

blendNormalDistanceNegative = addso.Find((HDAdditionalReflectionData d) => d.blendNormalDistanceNegative);
boxSideFadePositive = addso.Find((HDAdditionalReflectionData d) => d.boxSideFadePositive);
boxSideFadeNegative = addso.Find((HDAdditionalReflectionData d) => d.boxSideFadeNegative);
proxyVolumeComponent = addso.Find((HDAdditionalReflectionData d) => d.proxyVolumeComponent);
}
public void Update()

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


public Vector3 boxSideFadePositive = Vector3.one;
public Vector3 boxSideFadeNegative = Vector3.one;
public ProxyVolumeComponent proxyVolumeComponent;
public Vector3 boxBlendCenterOffset { get { return (blendDistanceNegative - blendDistancePositive) * 0.5f; } }
public Vector3 boxBlendSizeOffset { get { return -(blendDistancePositive + blendDistanceNegative); } }
public Vector3 boxBlendNormalCenterOffset { get { return (blendNormalDistanceNegative - blendNormalDistancePositive) * 0.5f; } }

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


get
{
return Matrix4x4.TRS(
(Vector3)probe.localToWorld.GetColumn(3) + probe.center,
(Vector3)probe.localToWorld.GetColumn(3) - probe.center,
probe.localToWorld.rotation,
Vector3.one
);

public override Vector3 boxSideFadePositive { get { return additional.boxSideFadePositive; } }
public override Vector3 boxSideFadeNegative { get { return additional.boxSideFadeNegative; } }
public override EnvShapeType proxyShapeType { get { return influenceShapeType; } }
public override Vector3 proxyExtents { get { return influenceExtents; } }
public override bool infiniteProjection { get { return probe.boxProjection == 0; } }
public override Matrix4x4 proxyToWorld { get { return influenceToWorld; } }
public override EnvShapeType proxyShapeType
{
get
{
return additional.proxyVolumeComponent != null
? ConvertShape(additional.proxyVolumeComponent.proxyVolume.shapeType)
: influenceShapeType;
}
}
public override Vector3 proxyExtents
{
get
{
return additional.proxyVolumeComponent != null
? additional.proxyVolumeComponent.proxyVolume.boxSize * 0.5f
: influenceExtents;
}
}
public override bool infiniteProjection
{
get
{
return additional.proxyVolumeComponent != null
? additional.proxyVolumeComponent.proxyVolume.infiniteProjection
: probe.boxProjection == 0;
}
}
public override Matrix4x4 proxyToWorld
{
get
{
return additional.proxyVolumeComponent != null
? additional.proxyVolumeComponent.transform.localToWorldMatrix
: influenceToWorld;
}
}
}
class PlanarReflectionProbeWrapper : ProbeWrapper

正在加载...
取消
保存