Shifted to the static-list arrangement for probe instance tracking to help performance as well as drastically streamline the data submission/material instance flow for probe rendering.

This commit is contained in:
Areloch 2018-10-07 17:32:23 -05:00
parent 4efcb567b0
commit 1966d348e4
22 changed files with 901 additions and 1250 deletions

Binary file not shown.

View file

@ -0,0 +1,32 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
singleton CubemapData( HdrSkyCubemap )
{
cubeMap = "./hdrSky.dds";
};
singleton Material( HdrSky )
{
cubemap = HdrSkyCubemap;
materialTag0 = "Skies";
};

View file

@ -0,0 +1,32 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
singleton CubemapData( SkyNightHDRCubemap )
{
cubeMap = "./sky_night_hdr.dds";
};
singleton Material( SkyNightHDR )
{
cubemap = SkyNightHDRCubemap;
materialTag0 = "Skies";
};

View file

@ -0,0 +1,32 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
singleton CubemapData( sky_day_hdr_cubemap )
{
cubeMap = "./sky_day_hdr.dds";
};
singleton Material( sky_day_hdr )
{
cubemap = sky_day_hdr_cubemap;
materialTag0 = "Skies";
};

View file

@ -32,6 +32,12 @@ singleton Material( Grid512_Blue_Mat )
mapTo = "Grid512_Blue_Mat";
diffuseMap[0] = "512_blue";
materialTag0 = "TestMaterial";
smoothness[0] = "1";
metalness[0] = "0.803922";
translucent = "1";
translucentBlendOp = "Add";
diffuseColor[0] = "1 1 1 1";
effectColor[1] = "InvisibleBlack";
};
singleton Material( Grid512_ForestGreen_Mat )

View file

@ -119,18 +119,18 @@ float defineSphereSpaceInfluence(vec3 centroidPosVS, float rad, vec2 atten, vec3
float defineBoxSpaceInfluence(vec3 surfPosWS, vec3 probePos, float rad, vec2 atten) //atten currently unused
{
vec3 boxMin = probePos-(vec3(0.5,0.5,0.5)*rad);
vec3 boxMax = probePos+(vec3(0.5,0.5,0.5)*rad);
//Try to clip anything that falls outside our box as well
//TODO: Make it support rotated boxes as well
if(surfPosWS.x > boxMax.x || surfPosWS.y > boxMax.y || surfPosWS.z > boxMax.z ||
surfPosWS.x < boxMin.x || surfPosWS.y < boxMin.y || surfPosWS.z < boxMin.z)
return -1;
float blendVal = 1;
//vec3 atten = min(boxMax-surfPosWS,surfPosWS-boxMin);
//blendVal = min(min(atten.x,atten.y),atten.z);
return blendVal;
vec3 surfPosLS = mul( worldToObj, vec4(surfPosWS,1.0)).xyz;
vec3 lsBoxMin = mul(worldToObj, vec4(boxMin,1)).xyz;
vec3 lsBoxMax = mul(worldToObj, vec4(boxMax,1)).xyz;
float boxOuterRange = length(lsBoxMax - lsBoxMin);
float boxInnerRange = boxOuterRange / 3.5;
vec3 localDir = vec3(abs(surfPosLS.x), abs(surfPosLS.y), abs(surfPosLS.z));
localDir = (localDir - boxInnerRange) / (boxOuterRange - boxInnerRange);
return max(localDir.x, max(localDir.y, localDir.z));
}
float defineDepthInfluence(vec3 probePosWS, vec3 surfPosWS, samplerCube radianceCube)
@ -190,7 +190,18 @@ void main()
}
else
{
blendVal = defineBoxSpaceInfluence(worldPos, probeWSPos, radius*2, attenuation);
if(worldPos.x > bbMax.x || worldPos.y > bbMax.y || worldPos.z > bbMax.z ||
worldPos.x < bbMin.x || worldPos.y < bbMin.y || worldPos.z < bbMin.z)
{
OUT_col = vec4(0.0);
OUT_col1 = vec4(0.0);
return;
}
blendVal = defineBoxSpaceInfluence(worldPos, probeWSPos, bbMin, bbMax, attenuation);
//flip it around
blendVal *= -1;
}
if (blendVal<0)
{

View file

@ -125,24 +125,20 @@ float defineSphereSpaceInfluence(float3 centroidPosVS, float rad, float2 atten,
return saturate( nDotL * attn );
}
float defineBoxSpaceInfluence(float3 surfPosWS, float3 probePos, float rad, float2 atten) //atten currently unused
float defineBoxSpaceInfluence(float3 surfPosWS, float3 probePos, float3 boxMin, float3 boxMax, float2 atten)
{
float3 boxMin = probePos-(float3(0.5,0.5,0.5)*rad);
float3 boxMax = probePos+(float3(0.5,0.5,0.5)*rad);
//rotated boxes
float3 surfPosLS = mul( worldToObj, float4(surfPosWS,1.0)).xyz;
//Try to clip anything that falls outside our box as well
//was surfPosWS
if(surfPosLS.x > boxMax.x || surfPosLS.y > boxMax.y || surfPosLS.z > boxMax.z ||
surfPosLS.x < boxMin.x || surfPosLS.y < boxMin.y || surfPosLS.z < boxMin.z)
return -1;
float blendVal = 1;
//float3 atten = min(boxMax-surfPosWS,surfPosWS-boxMin);
//blendVal = min(min(atten.x,atten.y),atten.z);
return blendVal;
float3 surfPosLS = mul( worldToObj, float4(surfPosWS,1.0)).xyz;
float3 lsBoxMin = mul(worldToObj, float4(boxMin,1)).xyz;
float3 lsBoxMax = mul(worldToObj, float4(boxMax,1)).xyz;
float boxOuterRange = length(lsBoxMax - lsBoxMin);
float boxInnerRange = boxOuterRange / 3.5;
float3 localDir = float3(abs(surfPosLS.x), abs(surfPosLS.y), abs(surfPosLS.z));
localDir = (localDir - boxInnerRange) / (boxOuterRange - boxInnerRange);
return max(localDir.x, max(localDir.y, localDir.z));
}
float defineDepthInfluence(float3 probePosWS, float3 surfPosWS, TORQUE_SAMPLERCUBE(radianceCube))
@ -196,7 +192,15 @@ PS_OUTPUT main( ConvexConnectP IN )
}
else
{
blendVal = defineBoxSpaceInfluence(worldPos, probeWSPos, radius*2, attenuation);
if(worldPos.x > bbMax.x || worldPos.y > bbMax.y || worldPos.z > bbMax.z ||
worldPos.x < bbMin.x || worldPos.y < bbMin.y || worldPos.z < bbMin.z)
clip(-1);
blendVal = defineBoxSpaceInfluence(worldPos, probeWSPos, bbMin, bbMax, attenuation);
//flip it around
blendVal *= -1;
//blendVal = defineBoxSpaceInfluence(worldPos, probeWSPos, radius*2, attenuation);
}
clip(blendVal);