浏览代码

[PlanarReflectionProbe] Added frustrum calculation for capture camera

/main
Frédéric Vauchelles 7 年前
当前提交
8b7e311c
共有 4 个文件被更改,包括 35 次插入7 次删除
  1. 3
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/PlanarReflectionProbeUI.Handles.cs
  2. 3
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/PlanarReflectionProbe.cs
  3. 5
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/ReflectionSystem.cs
  4. 31
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/ReflectionSystemInternal.cs

3
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/PlanarReflectionProbeUI.Handles.cs


static void DrawGizmos_CaptureFrustrum(PlanarReflectionProbeUI s, PlanarReflectionProbe d)
{
var fov = ReflectionSystem.GetCaptureCameraFOVFor(d);
90, 1);
fov, 1);
var near = new Vector3[4];
var far = new Vector3[4];

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


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

}
}
public bool infiniteProjection { get { return m_ProxyVolumeReference != null && m_ProxyVolumeReference.proxyVolume.infiniteProjection; } }
#endregion
public void RequestRealtimeRender()

5
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/ReflectionSystem.cs


{
s_Instance.Render(probe, target);
}
public static float GetCaptureCameraFOVFor(PlanarReflectionProbe probe)
{
return s_Instance.GetCaptureCameraFOVFor(probe);
}
}
}

31
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/ReflectionSystemInternal.cs


using System;
using System;
using System.Collections.Generic;
using UnityEngine.Rendering;

return rt;
}
public float GetCaptureCameraFOVFor(PlanarReflectionProbe probe)
{
switch (probe.influenceVolume.shapeType)
{
case ShapeType.Box:
{
var captureToWorld = Matrix4x4.TRS(probe.capturePosition, probe.captureRotation, Vector3.one);
var influenceToWorld = Matrix4x4.TRS(probe.transform.TransformPoint(probe.influenceVolume.boxBaseOffset), probe.transform.rotation, Vector3.one);
var influenceToCapture = captureToWorld.inverse * influenceToWorld;
var min = influenceToCapture.MultiplyPoint(-probe.influenceVolume.boxBaseSize * 0.5f);
var max = influenceToCapture.MultiplyPoint(probe.influenceVolume.boxBaseSize * 0.5f);
var minAngle = Mathf.Atan2(Mathf.Sqrt(min.x * min.x + min.y * min.y), min.z) * Mathf.Rad2Deg;
var maxAngle = Mathf.Atan2(Mathf.Sqrt(max.x * max.x + max.y * max.y), max.z) * Mathf.Rad2Deg;
return Mathf.Max(minAngle, maxAngle) * 2;
}
default:
throw new NotImplementedException();
}
}
bool IsRealtimeTextureValid(RenderTexture renderTexture, HDCamera hdCamera)
{
return renderTexture != null

m_PlanarReflectionProbeBounds[planarReflectionProbe] = planarReflectionProbe.boundingSphere;
}
static void SetupCameraForRender(Camera camera, PlanarReflectionProbe probe)
void SetupCameraForRender(Camera camera, PlanarReflectionProbe probe)
camera.transform.position = probe.capturePosition;
var ctr = camera.transform;
ctr.position = probe.capturePosition;
ctr.rotation = probe.captureRotation;
throw new NotImplementedException();
camera.fieldOfView = GetCaptureCameraFOVFor(probe);
camera.aspect = 1;
}
static HDCamera GetRenderHDCamera(PlanarReflectionProbe probe)

正在加载...
取消
保存