浏览代码

[PlanarReflection] (wip) box projection issue

/main
Frédéric Vauchelles 7 年前
当前提交
a8f2aaf5
共有 3 个文件被更改,包括 18 次插入22 次删除
  1. 20
      SampleScenes/HDTest/PlanarReflectionTests.unity
  2. 8
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/VolumeProjection.hlsl
  3. 12
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.hlsl

20
SampleScenes/HDTest/PlanarReflectionTests.unity


m_Version: 1
influenceShape: 0
dimmer: 1
influenceSphereRadius: 3
influenceSphereRadius: 30
sphereReprojectionVolumeRadius: 1
useSeparateProjectionVolume: 0
boxReprojectionVolumeSize: {x: 1, y: 1, z: 1}

m_Enabled: 1
serializedVersion: 2
m_Type: 0
m_Mode: 0
m_RefreshMode: 0
m_Mode: 1
m_RefreshMode: 1
m_BoxSize: {x: 20, y: 10, z: 20}
m_BoxSize: {x: 21, y: 11, z: 21}
m_BoxOffset: {x: 0, y: 0, z: 0}
m_NearClip: 0.3
m_FarClip: 1000

m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1561776757}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a4ee7c3a3b205a14a94094d01ff91d6b, type: 3}
m_Name:

m_SphereBaseOffset: {x: 0, y: 0, z: 0}
m_SphereInfluenceFade: 0.14740431
m_SphereInfluenceNormalFade: 0.18656206
m_CaptureOffset: {x: 0, y: 0, z: 0}
m_CenterOffset: {x: 0, y: 0, z: 0}
m_Dimmer: 1
m_Mode: 0
--- !u!1 &1562837666

m_Script: {fileID: 11500000, guid: 86d2527ad2205af4b9326464d02c7642, type: 3}
m_Name:
m_EditorClassIdentifier:
m_ProjectionVolume:
m_ShapeType: 0
m_BoxSize: {x: 20, y: 10, z: 20}
m_BoxOffset: {x: 0, y: 5, z: 0}
m_BoxInfiniteProjection: 0
m_SphereRadius: 12.3
m_SphereOffset: {x: 0, y: 0, z: 0}
m_SphereInfiniteProjection: 0
--- !u!1 &1662809620
GameObject:
m_ObjectHideFlags: 0

8
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/VolumeProjection.hlsl


return transpose(float3x3(proxyData.right, proxyData.up, proxyData.forward)); // worldToLocal assume no scaling
}
float3 WorldToProjectionPosition(EnvProxyData proxyData, float3x3 worldToLS, float3 positionWS)
float3 WorldToProxyPosition(EnvProxyData proxyData, float3x3 worldToPS, float3 positionWS)
float3 positionLS = positionWS - proxyData.positionWS;
positionLS = mul(positionLS, worldToLS).xyz;
return positionLS;
float3 positionPS = positionWS - proxyData.positionWS;
positionPS = mul(positionPS, worldToPS).xyz;
return positionPS;
}
float IntersectSphereProxy(EnvProxyData proxyData, float3 dirPS, float3 positionPS)

12
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.hlsl


float3 dirLS = mul(R, worldToLS); // Projection and influence share the space
// Projection and influence share the space
float3x3 worldToPS = worldToLS;
/*float3x3 worldToPS = worldToLS;
float3 dirPS = dirLS;
float3 dirPS = dirLS;*/
float3x3 worldToPS = WorldToProxySpace(proxyData);
float3 positionPS = WorldToProxyPosition(proxyData, worldToPS, positionWS);
float3 dirPS = mul(R, worldToPS);
// 1. First process the projection
// Note: using influenceShapeType and projectionShapeType instead of (lightData|proxyData).shapeType allow to make compiler optimization in case the type is know (like for sky)

}
// 2. Process the influence
if (influenceShapeType == ENVSHAPETYPE_SPHERE)
/*if (influenceShapeType == ENVSHAPETYPE_SPHERE)
weight = InfluenceBoxWeight(lightData, bsdfData, positionWS, positionLS, dirLS);
weight = InfluenceBoxWeight(lightData, bsdfData, positionWS, positionLS, dirLS);*/
weight = 1;
// Smooth weighting
weight = Smoothstep01(weight);

正在加载...
取消
保存