mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 14:44:36 +00:00
nomenclature shift for clarity: bunch of stuff tagged as probe that refferenced things properly tied conceptually to the reflection refrence box.
This commit is contained in:
parent
261bcd9a45
commit
01f6938746
8 changed files with 45 additions and 48 deletions
|
|
@ -398,12 +398,12 @@ float defineBoxSpaceInfluence(float3 wsPosition, float4x4 worldToObj, float atte
|
|||
// Box Projected IBL Lighting
|
||||
// Based on: http://www.gamedev.net/topic/568829-box-projected-cubemap-environment-mapping/
|
||||
// and https://seblagarde.wordpress.com/2012/09/29/image-based-lighting-approaches-and-parallax-corrected-cubemap/
|
||||
float3 boxProject(float3 wsPosition, float3 wsReflectVec, float4x4 worldToObj, float3 bbMin, float3 bbMax, float3 refPosition)
|
||||
float3 boxProject(float3 wsPosition, float3 wsReflectVec, float4x4 worldToObj, float3 refBoxMin, float3 refBoxMax, float3 refPosition)
|
||||
{
|
||||
float3 RayLS = mul(worldToObj, float4(wsReflectVec, 0.0)).xyz;
|
||||
float3 PositionLS = mul(worldToObj, float4(wsPosition, 1.0)).xyz;
|
||||
|
||||
float3 unit = bbMax.xyz - bbMin.xyz;
|
||||
float3 unit = refBoxMax.xyz - refBoxMin.xyz;
|
||||
float3 plane1vec = (unit / 2 - PositionLS) / RayLS;
|
||||
float3 plane2vec = (-unit / 2 - PositionLS) / RayLS;
|
||||
float3 furthestPlane = max(plane1vec, plane2vec);
|
||||
|
|
@ -415,7 +415,7 @@ float3 boxProject(float3 wsPosition, float3 wsReflectVec, float4x4 worldToObj, f
|
|||
|
||||
float4 computeForwardProbes(Surface surface,
|
||||
float cubeMips, int numProbes, float4x4 worldToObjArray[MAX_FORWARD_PROBES], float4 probeConfigData[MAX_FORWARD_PROBES],
|
||||
float4 inProbePosArray[MAX_FORWARD_PROBES], float4 bbMinArray[MAX_FORWARD_PROBES], float4 bbMaxArray[MAX_FORWARD_PROBES], float4 inRefPosArray[MAX_FORWARD_PROBES],
|
||||
float4 inProbePosArray[MAX_FORWARD_PROBES], float4 refBoxMinArray[MAX_FORWARD_PROBES], float4 refBoxMaxArray[MAX_FORWARD_PROBES], float4 inRefPosArray[MAX_FORWARD_PROBES],
|
||||
float skylightCubemapIdx, TORQUE_SAMPLER2D(BRDFTexture),
|
||||
TORQUE_SAMPLERCUBEARRAY(irradianceCubemapAR), TORQUE_SAMPLERCUBEARRAY(specularCubemapAR))
|
||||
{
|
||||
|
|
@ -524,7 +524,7 @@ float4 computeForwardProbes(Surface surface,
|
|||
if (contrib != 0)
|
||||
{
|
||||
int cubemapIdx = probeConfigData[i].a;
|
||||
float3 dir = boxProject(surface.P, surface.R, worldToObjArray[i], bbMinArray[i].xyz, bbMaxArray[i].xyz, inRefPosArray[i].xyz);
|
||||
float3 dir = boxProject(surface.P, surface.R, worldToObjArray[i], refBoxArray[i].xyz, refBoxMaxArray[i].xyz, inRefPosArray[i].xyz);
|
||||
|
||||
irradiance += TORQUE_TEXCUBEARRAYLOD(irradianceCubemapAR, dir, cubemapIdx, 0).xyz * contrib;
|
||||
specular += TORQUE_TEXCUBEARRAYLOD(specularCubemapAR, dir, cubemapIdx, lod).xyz * contrib;
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ TORQUE_UNIFORM_SAMPLERCUBEARRAY(irradianceCubemapAR, 5);
|
|||
uniform float4 inProbePosArray[MAX_PROBES];
|
||||
uniform float4 inRefPosArray[MAX_PROBES];
|
||||
uniform float4x4 worldToObjArray[MAX_PROBES];
|
||||
uniform float4 bbMinArray[MAX_PROBES];
|
||||
uniform float4 bbMaxArray[MAX_PROBES];
|
||||
uniform float4 refBoxMinArray[MAX_PROBES];
|
||||
uniform float4 refBoxArray[MAX_PROBES];
|
||||
uniform float4 probeConfigData[MAX_PROBES]; //r,g,b/mode,radius,atten
|
||||
|
||||
#if DEBUGVIZ_CONTRIB
|
||||
|
|
@ -167,7 +167,7 @@ float4 main(PFXVertToPix IN) : SV_TARGET
|
|||
if (contrib != 0)
|
||||
{
|
||||
int cubemapIdx = probeConfigData[i].a;
|
||||
float3 dir = boxProject(surface.P, surface.R, worldToObjArray[i], bbMinArray[i].xyz, bbMaxArray[i].xyz, inRefPosArray[i].xyz);
|
||||
float3 dir = boxProject(surface.P, surface.R, worldToObjArray[i], refBoxMinArray[i].xyz, refBoxMaxArray[i].xyz, inRefPosArray[i].xyz);
|
||||
|
||||
irradiance += TORQUE_TEXCUBEARRAYLOD(irradianceCubemapAR, dir, cubemapIdx, 0).xyz * contrib;
|
||||
specular += TORQUE_TEXCUBEARRAYLOD(specularCubemapAR, dir, cubemapIdx, lod).xyz * contrib;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue