mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 07:04:36 +00:00
Ongoing fiddling with correcting the forward render behavior.
This commit is contained in:
parent
240e940572
commit
19a1237dcb
3 changed files with 14 additions and 14 deletions
|
|
@ -357,7 +357,7 @@ void GFXGLCubemapArray::init(GFXCubemapHandle *cubemaps, const U32 cubemapCount)
|
||||||
if (isCompressed)
|
if (isCompressed)
|
||||||
{
|
{
|
||||||
const U32 mipDataSize = getCompressedSurfaceSize(mFormat, mSize, mSize, currentMip);
|
const U32 mipDataSize = getCompressedSurfaceSize(mFormat, mSize, mSize, currentMip);
|
||||||
glCompressedTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, currentMip, GFXGLTextureInternalFormat[mFormat], 0, 0, i * 6 + face, 0, mipDataSize, pixelData);
|
glCompressedTexSubImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, currentMip, 0, 0, i * 6 + face, mipSize, mipSize, 1, GFXGLTextureFormat[mFormat], GFXGLTextureType[mFormat], pixelData);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -418,7 +418,7 @@ void GFXGLCubemapArray::updateTexture(const GFXCubemapHandle &cubemap, const U32
|
||||||
if (isCompressed)
|
if (isCompressed)
|
||||||
{
|
{
|
||||||
const U32 mipDataSize = getCompressedSurfaceSize(mFormat, mSize, mSize, currentMip);
|
const U32 mipDataSize = getCompressedSurfaceSize(mFormat, mSize, mSize, currentMip);
|
||||||
glCompressedTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, currentMip, GFXGLTextureInternalFormat[mFormat], 0, 0, slot * 6 + face, 0, mipDataSize, pixelData);
|
glCompressedTexSubImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, currentMip, 0, 0, slot * 6 + face, mipSize, mipSize, 1, GFXGLTextureFormat[mFormat], GFXGLTextureType[mFormat], pixelData);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -673,7 +673,7 @@ void RenderProbeMgr::_update4ProbeConsts(const SceneData &sgData,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
if(!curEntry.mIsSkylight)
|
if (!curEntry.mIsSkylight)
|
||||||
{
|
{
|
||||||
/*probePositions[effectiveProbeCount] = curEntry.getPosition();
|
/*probePositions[effectiveProbeCount] = curEntry.getPosition();
|
||||||
probeRefPositions[effectiveProbeCount] = curEntry.mProbeRefOffset;
|
probeRefPositions[effectiveProbeCount] = curEntry.mProbeRefOffset;
|
||||||
|
|
@ -707,8 +707,7 @@ void RenderProbeMgr::_update4ProbeConsts(const SceneData &sgData,
|
||||||
}
|
}
|
||||||
|
|
||||||
//check for skylight action
|
//check for skylight action
|
||||||
if (probeShaderConsts->mHasSkylight->isValid()
|
if (probeShaderConsts->mSkylightIrradMap->isValid()
|
||||||
&& probeShaderConsts->mSkylightIrradMap->isValid()
|
|
||||||
&& probeShaderConsts->mSkylightSpecularMap->isValid())
|
&& probeShaderConsts->mSkylightSpecularMap->isValid())
|
||||||
{
|
{
|
||||||
//Array rendering
|
//Array rendering
|
||||||
|
|
|
||||||
|
|
@ -387,27 +387,28 @@ float4 computeForwardProbes(Surface surface,
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
if (hasSkylight && alpha > 0.001)
|
//if (hasSkylight && alpha > 0.001)
|
||||||
{
|
//{
|
||||||
irradiance += TORQUE_TEXCUBELOD(skylightIrradMap, float4(surface.R, 0)).xyz * alpha;
|
irradiance += TORQUE_TEXCUBELOD(skylightIrradMap, float4(surface.R, 0)).xyz;
|
||||||
specular += TORQUE_TEXCUBELOD(skylightSpecularMap, float4(surface.R, lod)).xyz * alpha;
|
specular = TORQUE_TEXCUBELOD(skylightSpecularMap, float4(surface.R, lod)).xyz;
|
||||||
}
|
//}
|
||||||
|
|
||||||
float3 F = FresnelSchlickRoughness(surface.NdotV, surface.f0, surface.roughness);
|
float3 F = FresnelSchlickRoughness(surface.NdotV, surface.f0, surface.roughness);
|
||||||
|
|
||||||
//energy conservation
|
//energy conservation
|
||||||
float3 kD = 1.0.xxx - F;
|
float3 kD = 1.0.xxx - F;
|
||||||
kD *= clamp(1.0 - surface.metalness, 0.1, 1);
|
kD *= clamp(1.0 - surface.metalness, 0.2, 1);
|
||||||
|
|
||||||
//apply brdf
|
//apply brdf
|
||||||
//Do it once to save on texture samples
|
//Do it once to save on texture samples
|
||||||
float2 brdf = TORQUE_TEX2DLOD(BRDFTexture,float4(surface.roughness, surface.NdotV, 0.0, 0.0)).xy;
|
float2 brdf = TORQUE_TEX2DLOD(BRDFTexture,float4(surface.roughness, surface.NdotV, 0.0, 0.0)).xy;
|
||||||
specular *= brdf.x * F + brdf.y;
|
//specular *= brdf.x * F + brdf.y;
|
||||||
|
|
||||||
//final diffuse color
|
//final diffuse color
|
||||||
float3 diffuse = kD * irradiance * surface.baseColor.rgb;
|
float3 diffuse = kD * irradiance * surface.baseColor.rgb;
|
||||||
float4 finalColor = float4(diffuse + specular * surface.ao, 1.0);
|
float4 finalColor = float4(diffuse + specular, 1.0);
|
||||||
|
|
||||||
|
//finalColor = float4(max(diffuse, specular),1);
|
||||||
|
|
||||||
finalColor = float4(specular,1);
|
|
||||||
return finalColor;
|
return finalColor;
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue