Prechádzať zdrojové kódy

Ongoing fiddling with correcting the forward render behavior.

Areloch 6 rokov pred
rodič
commit
65fb8bc5f3

+ 2 - 2
Engine/source/gfx/gl/gfxGLCubemap.cpp

@@ -357,7 +357,7 @@ void GFXGLCubemapArray::init(GFXCubemapHandle *cubemaps, const U32 cubemapCount)
             if (isCompressed)
             {
                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
             {
@@ -418,7 +418,7 @@ void GFXGLCubemapArray::updateTexture(const GFXCubemapHandle &cubemap, const U32
          if (isCompressed)
          {
             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
          {                                          

+ 2 - 3
Engine/source/renderInstance/renderProbeMgr.cpp

@@ -673,7 +673,7 @@ void RenderProbeMgr::_update4ProbeConsts(const SceneData &sgData,
                continue;
             }
          }*/
-         if(!curEntry.mIsSkylight)
+         if (!curEntry.mIsSkylight)
          {
             /*probePositions[effectiveProbeCount] = curEntry.getPosition();
             probeRefPositions[effectiveProbeCount] = curEntry.mProbeRefOffset;
@@ -707,8 +707,7 @@ void RenderProbeMgr::_update4ProbeConsts(const SceneData &sgData,
    }
 
    //check for skylight action
-   if (probeShaderConsts->mHasSkylight->isValid()
-      && probeShaderConsts->mSkylightIrradMap->isValid() 
+   if (probeShaderConsts->mSkylightIrradMap->isValid()
       && probeShaderConsts->mSkylightSpecularMap->isValid())
    {
       //Array rendering

+ 10 - 9
Templates/Full/game/shaders/common/lighting.hlsl

@@ -387,27 +387,28 @@ float4 computeForwardProbes(Surface surface,
       }
    }*/
 
-   if (hasSkylight && alpha > 0.001)
-   {
-      irradiance += TORQUE_TEXCUBELOD(skylightIrradMap, float4(surface.R, 0)).xyz * alpha;
-      specular += TORQUE_TEXCUBELOD(skylightSpecularMap, float4(surface.R, lod)).xyz * alpha;
-   }
+   //if (hasSkylight && alpha > 0.001)
+   //{
+      irradiance += TORQUE_TEXCUBELOD(skylightIrradMap, float4(surface.R, 0)).xyz;
+      specular = TORQUE_TEXCUBELOD(skylightSpecularMap, float4(surface.R, lod)).xyz;
+   //}
 
    float3 F = FresnelSchlickRoughness(surface.NdotV, surface.f0, surface.roughness);
 
    //energy conservation
    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
    //Do it once to save on texture samples
    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
    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;
 }