Ver código fonte

Quick Fix Directional

Sebastien Vandenberghe 8 anos atrás
pai
commit
5a4e2d7654

+ 3 - 2
Tools/Gulp/config.json

@@ -27,8 +27,9 @@
         "minimalWithBuilder": ["meshBuilder", "standardMaterial", "freeCamera", "hemisphericLight"],
         "minimalViewer": [
                 "meshBuilder", "animations", "arcRotateCamera", "additionalTextures", "textureFormats", "debug",
-                "multiMaterial", "pbrMaterial", "pointLight", "directionalLight", "spotLight", "additionalPostProcess_blur", "additionalPostProcess_fxaa", "additionalPostProcess_highlights", "additionalPostProcess_imageProcessing",
-                "colorCurves", "defaultRenderingPipeline"
+                "shadows", "pointLight", "directionalLight", "spotLight",
+                "multiMaterial", "pbrMaterial",
+                "additionalPostProcess_blur", "additionalPostProcess_fxaa", "additionalPostProcess_highlights", "additionalPostProcess_imageProcessing", "colorCurves", "defaultRenderingPipeline"
         ],
         "distributed": ["minimalViewer"]
     },

+ 2 - 0
src/Lights/Shadows/babylon.shadowGenerator.ts

@@ -4,11 +4,13 @@
      */
     export interface IShadowGenerator {
         getShadowMap(): RenderTargetTexture;
+        getShadowMapForRendering(): RenderTargetTexture;
  
         isReady(subMesh: SubMesh, useInstances: boolean): boolean;
 
         prepareDefines(defines: MaterialDefines, lightIndex: number): void;
         bindShadowLight(lightIndex: string, effect: Effect): void;
+        getTransformMatrix(): Matrix;
 
         recreateShadowMap(): void;
 

+ 4 - 4
src/Lights/babylon.directionalLight.ts

@@ -169,22 +169,22 @@ module BABYLON {
          * Gets the minZ used for shadow according to both the scene and the light.
          * 
          * Values are fixed on directional lights as it relies on an ortho projection hence the need to convert being
-         * -1 and 1 to 0 and 1 doing (depth + min) / (min + max) -> (depth + 0.5) / (0.5 + 5) -> (depth + 0.5) * 0.5.
+         * -1 and 1 to 0 and 1 doing (depth + min) / (min + max) -> (depth + 1) / (1 + 1) -> (depth * 0.5) + 0.5.
          * @param activeCamera 
          */
         public getDepthMinZ(activeCamera: Camera): number {
-            return 0.5;
+            return 1;
         }
 
         /**
          * Gets the maxZ used for shadow according to both the scene and the light.
          * 
          * Values are fixed on directional lights as it relies on an ortho projection hence the need to convert being
-         * -1 and 1 to 0 and 1 doing (depth + min) / (min + max) -> (depth + 0.5) / (0.5 + 5) -> (depth + 0.5) * 0.5.
+         * -1 and 1 to 0 and 1 doing (depth + min) / (min + max) -> (depth + 1) / (1 + 1) -> (depth * 0.5) + 0.5.
          * @param activeCamera 
          */
         public getDepthMaxZ(activeCamera: Camera): number {
-             return 1.5;
+             return 1;
         }
     }
 }