Search the Community

Showing results for tags 'shadowmap'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • HTML5 Game Coding
    • News
    • Game Showcase
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Found 5 results

  1. Hello! I have an issue I hope you can help me with. I'll put you in context and hope I can give you enough information. Let's say I have a PBR floor exported with diffuse, rough, metal and normal from 3DSMax with the Babylon plugin, as well as the environment texture for reflections. I would like to put a ball on this floor that casts a shadow over it, but for some reason it isn't working. It does work with a standard material, but not the PBR. Does this have to do with the 3DSMax export? Am I missing something in code? Should I tweak the shader somehow? Thank you for the help in advance!
  2. 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: 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?
  3. While trying to make my own shader I seem to get stuck in getting shadows to work for a directional light. I copy/pasted what I believe are all the relevant parts from the babylon standard shaders into my own vertex and fragment shaders, and while it compiles and light/textures work just fine, shadows do not appear. Could anyone point me to the issue? gl throws a warning about lack of textures, but I don't believe that affects the outcome as my complete shader with textures has the same issue.; Uncomment line 124 to apply the shader to the ground mesh. Thanks again as usual PS. the playground seems to hang quite a lot trying to run this code, out of the playground it works fine.
  4. Hi ! I am having an issue with shadow maps, it seems pretty random, but from time to time the shadow map seems to "degenerate" meaning that the shadow map's resolution progressively lowers until the shadow is not visible anymore. I don't know what could cause that, I am not running any scene optimiser and not touching my shadow map during the renderloop so there is no reason its resolution suddently start to lower by itself... I am running the (v2.5.-beta) version. I will try and pose a screenshot of the scene as I can't seem to be able to reproduce it in the playground. Thanks in advance for your time and answer !
  5. Hi everybody ! This week I faced with a strange behaviour. I generally lose time looking for a solution on my own, I did it again, but today I have the unpleasant feeling to be powerless. I'm trying to precompute kind of PCSS map (soft shadows) to get nice-looking shadows in static scenes. For this purpose, I use renderTargetTextures with refreshRate = RENDER_ONCE. And I use three shaders, called in this order : The one of shadowGenerator which gives me the shadowMap of the blockers. The PCSS one, which uses the shadowMap and gives me a PCSSMap. The material's shader, which simply display the PCSSMap in real time. After each renderTargetTexture created, I call scene.customTargets() to order the calls. Okay : This works great ! Now, I would like to correct small artifacts and I need to repeat step 1 & 2 for each blocker separatly. And here comes the drama. Let's take a look at the new call order : 1. ShadowGenerator creates blockerMap with the first blocker. 2. PCSSGenerator creates PCSSMap for the first blocker. 1bis. ShadowGenerator creates blockerMap with the second blocker. 2bis. PCSSGenerator creates PCSSMap for the second blocker AND mix it with last PCSSMap (the first one). 1ter. ShadowGenerator creates blockerMap with the third blocker. 2ter. PCSSGenerator creates PCSSMap for the third blocker AND mix it with last PCSSMap (the second one). 3. Display result. My issue is : I can't grab the last PCSSMap. After a few tests, I highlighted when my issue appears and when it doesn't. So here is a big simplification of my PCSS fragment shader (it only outputs one of the two textures it takes in uniform) : uniform samplerCube blockerMap; uniform samplerCube previousPCSSMap; // This function samples the blockerMap. We don't mind about the result. float sampleFunction() { for (int i = 0.0; i < POISSON_COUNT; i++) { vec4 sample = textureCube(blockerMap, direction); } return 1.0; } void main(void) { // To fill } And here are 4 usecases : 1. It returns blockerMap, everything is OK. void main(void) { //sampleFunction(); gl_FragColor = textureCube(blockerMap, direction); //gl_FragColor = textureCube(previousPCSSMap, direction); } 2. It returns the previous PCSSMap, everything is OK. void main(void) { //sampleFunction(); //gl_FragColor = textureCube(blockerMap, direction); gl_FragColor = textureCube(previousPCSSMap, direction); } 3. It returns the blockerMap, everything is OK. void main(void) { sampleFunction(); gl_FragColor = textureCube(blockerMap, direction); //gl_FragColor = textureCube(previousPCSSMap, direction); } 4. It returns the blockerMap instead of the previous PCSSMap, what's wrong ? void main(void) { sampleFunction(); //gl_FragColor = textureCube(blockerMap, direction); gl_FragColor = textureCube(previousPCSSMap, direction); } As you can see, sampleFunction() works with blockerMap and has absolutely no contact with the previousPCSSMap. However, the previousPCSSMap seems to be replaced by the blockerMap and I have absolutely no idea how it's possible. As it's nonsense, I dare coming here begging for your help... Some more info : - I use shadowGenerator from Babylon. - I use my own PCSSGenerator. But this one is a CC of shadowGenerator. The unique difference is the shader which is called. - The last shader (material's one) only displays the result, the issue should not come from here. - I verified 1000 times, I don't send blockerMap in previousPCSSMap in my code. Maybe it does in a dark side of the library, but I don't think so. - I systematically empty my cache between each shader modification. - Of course, my PCSS shader contains a lot of calculations and uniforms I didn't show here. But I really commented a lot my code to obtain something really close to the usecase above. I'm working on isolating the issue in a new project. Thanks ! PeapBoy