ソースを参照

Fixing omnidirectional shadow maps

BearishSun 8 年 前
コミット
c0eb880ca6

+ 4 - 4
Data/Raw/Engine/Shaders/ShadowProjectOmni.bsl

@@ -154,13 +154,13 @@ technique ShadowProjectOmni
 			
 			float occlusion = 0.0f;
 			#if SHADOW_QUALITY <= 1
-				occlusion = gShadowCubeTex.SampleCmpLevelZero(gShadowCubeSampler, lightDir, receiverDepth - shadowBias);
+				occlusion = gShadowCubeTex.SampleCmp(gShadowCubeSampler, lightDir, receiverDepth - shadowBias);
 			#elif SHADOW_QUALITY == 2
 				[unroll]
 				for(int i = 0; i < 4; ++i)
 				{
 					float3 sampleDir = lightDir + side * discSamples4[i].x + up * discSamples4[i].y;
-					occlusion += gShadowCubeTex.SampleCmpLevelZero(gShadowCubeSampler, sampleDir, receiverDepth - shadowBias);
+					occlusion += gShadowCubeTex.SampleCmp(gShadowCubeSampler, sampleDir, receiverDepth - shadowBias);
 				}
 				
 				occlusion /= 4;
@@ -169,7 +169,7 @@ technique ShadowProjectOmni
 				for(int i = 0; i < 12; ++i)
 				{
 					float3 sampleDir = lightDir + side * discSamples12[i].x + up * discSamples12[i].y;
-					occlusion += gShadowCubeTex.SampleCmpLevelZero(gShadowCubeSampler, sampleDir, receiverDepth - shadowBias);
+					occlusion += gShadowCubeTex.SampleCmp(gShadowCubeSampler, sampleDir, receiverDepth - shadowBias);
 				}
 				
 				occlusion /= 12;
@@ -178,7 +178,7 @@ technique ShadowProjectOmni
 				for(int i = 0; i < 32; ++i)
 				{
 					float3 sampleDir = lightDir + side * discSamples32[i].x + up * discSamples32[i].y;
-					occlusion += gShadowCubeTex.SampleCmpLevelZero(gShadowCubeSampler, sampleDir, receiverDepth - shadowBias);
+					occlusion += gShadowCubeTex.SampleCmp(gShadowCubeSampler, sampleDir, receiverDepth - shadowBias);
 				}
 				
 				occlusion /= 32;

+ 1 - 1
Source/BansheeCore/Source/BsRenderTexture.cpp

@@ -210,7 +210,7 @@ namespace bs
 				BS_EXCEPT(InvalidParametersException, "Provided texture is not created with depth stencil usage.");
 
 			mDepthStencilSurface = texture->requestView(mDesc.depthStencilSurface.mipLevel, 1,
-				mDesc.depthStencilSurface.face, 1, GVU_DEPTHSTENCIL);
+				mDesc.depthStencilSurface.face, mDesc.depthStencilSurface.numFaces, GVU_DEPTHSTENCIL);
 		}
 
 		throwIfBuffersDontMatch();

+ 1 - 0
Source/RenderBeast/Source/BsRenderTargets.cpp

@@ -226,6 +226,7 @@ namespace bs { namespace ct
 			texPool.release(mSceneColorTex);
 			texPool.release(mAlbedoTex);
 			texPool.release(mNormalTex);
+			texPool.release(mRoughMetalTex);
 		}
 		else if(type == RTT_SceneColor)
 		{