Search the Community
Showing results for tags 'esm'.
-
I recently upgrade my shader code from pixi v7 to pixi v8 and after some issues with shader not compiling I manged to get it where there are no errors thrown. But I don't see it working either. My code should create a black screen with alpha 0.8 and somewhere on that rect I should see a cut out circle with faded edges: But instead I don't get anything, not even an error. But I see my uniforms filled in correctly (I think): v7 code: tutorialShaderFrag.txt shaders.ts.txt In my view I do following (uses pixi default vertex shader): private filterShader: TutorialFilter = new TutorialFilter(); //... Apply this.backgroundGraphic = new Pixi.Graphics(); this.backgroundGraphic.pivot.set(0.5, 0.5); this.backgroundGraphic.beginFill(0xffffff); this.backgroundGraphic.drawRect(-2000, -2000, 5000, 5000); this.backgroundGraphic.endFill(); this.backgroundGraphic.filters = [this.filterShader]; // ... Update this.filterShader.uniforms.uResolution = [appResolution.w, appResolution.h]; const rNormalized = transform.r / actualGameResolution.w; this.filterShader.uniforms.uCirclePosition = [xNormalized, yNormalized]; this.filterShader.uniforms.uCircleRadius = rNormalized; this.filterShader.uniforms.uSquashFactorY = transform.sy; v8 code: shaders.mts.txt private filterShader: TutorialFilter = new TutorialFilter(); //... Apply this.backgroundGraphic = new Pixi.Graphics(); this.backgroundGraphic.rect(-2000, -2000, 5000, 5000); this.backgroundGraphic.fill({ color: 0xffffff }); this.backgroundGraphic.filters = [this.filterShader]; // ... Update this.filterShader?.update({ resolution: new Float32Array([appResolution.w, appResolution.h]), circlePosition: new Float32Array([xNormalized, yNormalized]), circleRadius: rNormalized, squashFactorY: transform.sy ?? 1.0, alpha: 0.8, }); We also upgraded the project to ESM, but I don't think that is the issue. WebGL only, no WebGPU (yet). The pixi version we use at the moment is v8.7.2. I don't have a clue what I might have missed. Thanks in advance!
-
I am having trouble with my shadows. Everything that receives shadows but is not occluded is covered with what I think is elsewhere referred to as "shadow acne". 1 blender exported ESM shadows do not work at all. Why? Are they for a later version of Babylon? 2 I am not clear on how the shadows are being mapped. My first approach was to try to minimize field of illumination to increase the apparent resolution by pointing spot lights at my model and setting the camera clipping plane (which apparently is mapped in the blender exporter to the shadowMinZ/MaxZ) to conservative levels. I have had inconsistent results with this, so I really would like to understand clearly what it does. Is there in fact a Z axis resolution of the shadow map? 3 Of course I toyed with the shadow bias settings as well. However, when I set the map resolution to 512, by the time I get rid of the problems, the shadows begin well, well below the overhangs that create them. Much further than the apparent resolution of the shadow map would suggest is necessary. Then I decided to turn up the shadow map resolution to 4096, but then, even adding .00001 to the default bias setting offsets the shadow map by a huge amount, rendering the setting essentially useless. This makes no sense to me. Also, what does the shadow map "resolution" mean for the directional lights, which have an infinite projection field? Is it somehow using the camera's FOV? In my use case, I don't actually need the shadows to be dynamic, so I can set their resolution high and their refresh rate to 0. Clearly I do not understand the shadows system, and am sorry to load so many questions at once. Any help is welcome! I can't give you the actual file I am working on due to non-disclosure issues, but I tried to recreate it with a simple model that has similar scale, thickness, light position, etc. Thanks! experiments.babylon
-
I have a large model exported from a software with a lot of nested instances. I added a shadow generator with defaults and added most meshes to its renderList. The console recommends to use Exponential Shadow Maps (ESM) which look also a lot nicer ("VSM are now replaced by ESM. Please use useExponentialShadowMap instead"). With ESM enabled, the scene turns mostly black because shadows are rendered also on top of those meshes that cast that part of the shadow. The issue only disappears when the shadow generator has only a single mesh in the renderList. See here: http://www.babylonjs-playground.com/#7CPG3X Is this a bug? Is ESM not yet stable (although the console recommends using it)? Is there a work-around? --- Another question: My model is mostly static. Are shadow maps regenerated at every frame or only when something (lights, meshes) changes?