Search the Community

Showing results for tags 'shadow'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

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

Found 48 results

  1. I am loading a mesh from a babylon file The mesh has a skeleton. The shadow casted by it is not proper. See file "with_skel.jpg" to check the shadow casted. Now if i remove the skeleton by doing mesh.skeleton=null; The shadow is proper. See file "without_skel.jpg" I was able to reproduce the issue in playground but wasn't able to save the code. I got the error message "file too big" when trying to save. The code is a little large as it has an embedded scene file. So I have attached the code here. See file "playground_code,txt" Copy the code to playground to check. comment on/off line 44 to see the issue playground_code.txt
  2. Hey Folks! In our scene we have some images with transparency on quads. The transparency is just used to mask the silhouettes of the image, so we have no larger half- transparent areas. So far we used the default shader for this, which produced nice silhouettes. All these Objekt are registered in a shadow generator from which we extract the shadow map an pass it in a custom shader. After writing our own shader for the images we ran into a problem: The shadow generator now only takes the quad into account, not the transparency of the image. Therefor the shadows of these images are square. When constructing the custom shader we tell baby- lon to use alpha blending and we also tell the shadow- generator to use transparency shadows. The diffuse texture is simply loaded with a texture sampler in- cluding the alpha channel. We even tried to clip frag- ments under a certain value but the shadow genera- tor still ignores it. We looked through the default shader but couldn't find anything that's helping us in this matter. We found the opacity map, which to our understanding is just a separate, black and white masking texture. So our question is: What steps are necessiary to generate shadow silhouettes based on the alpha channel of an objects texture? As we said, clipping with a threshold or cutout for that matter would be enough. Thank you for your time -Mainequin Team
  3. Sprites and Shadows

    Hey! I wanted to know if the library has been updated yet to perform this function, as I found a couple of post from 2014 talking about it being in future updates @Deltakosh, An example post I found and wanted to know if it's here as would be suuuuuper useful to me right now in my current project build, if you know of another way also of it being done please let me know, please find the babylon playground link and youtube video of my build as my textures are not very good at working! https://www.babylonjs-playground.com/#80E5N5
  4. Hi, i have a question about shadows, is it possible to let a mesh cast shadow on it self? Currently I can make a tree looking like the first picture, but in this case the 3d deep looks not that good. I looking for a solution I can get a tree like the second picture. Thanks for your help Mirco
  5. Part 6 of my tutorial series on making Slither.io is here! https://loonride.com/learn/phaser/slither-io-part-6 Check out the demo: https://loonride.com/examples/slither-io/part-6/ Enjoy!
  6. can't see any shaodw on my mobile phone for this pg http://playground.babylonjs.com/#TM2NLD#7 but this demo works pretty good http://www.babylonjs-playground.com/?15 don't know why, would you guys please give me a hand?
  7. Hy gangs, how's your day been? i saw a post on how to cast shadow of a texture from a plane onto a surface using the pointlight, i've been looking for that post but i couldn't find it, i should have followed the discussion trend
  8. Hi, I'm trying to make a light: has fixed position relative to the viewer (camera); casts shadows. I set camera as the light's parent to achieve (1). But the shadow seems not updated as camera orbits. Playground: https://playground.babylonjs.com/#GWK0TQ Can I tell the shadow map to refresh? Thank you very much!
  9. Hello everyone! This is my first question about my first babylon.js project. It will be a strategy game with complex economics (similar to Caesar 3, Knights and Merchants). The framework is amazing, I like it very much, but I have some problems with shadows. Everything works fine, until I add lots of instances of a mesh across a large ground. The shadow becomes just a blob, almost invisible. I think the problem comes from DirectionalLight.prototype.setShadowProjectionMatrix where all mesh positions are checked to see how big the area is for casting shadows. The bigger the area, the more detail will be lost. Can someone give me some advice on how to handle this problem? I thought of the following: 1. Increase the mapSize from 1024 to a much larger value, but it doesn't make much difference with 2048 and the fps drops very much. 2. Somehow force the shadow casting area to be smaller with the help of customProjectionMatrixBuilder, and make it follow the camera, but how? 3. Make the shadow part of the model, like an old-school circle shadow with transparency. Ugly, but at least I get 60 fps Any other idea may be helpful You can take a look at it if it helps: http://feszer.go.ro/babylon.js/1/ P.S. I know, that instances can't have different animations, I will handle that with separate clones for every action, I think
  10. Shadows in Custom Shader

    Dear Babylon JS community, we as a company have decided, that we want to use Babylon JS for a larger project. For this we have specific requirements for what the shaders have to be able to do. I will first state the problem I am trying to solve and then give the context, for possible alternative solutions. PROBLEMS: For our more complex shader computations we want to integrate shadows from at least one shadow-generator in a custom shader. For reasons of confidentiality I can not submit our current project code, that is why I created this test playground: http://www.babylonjs-playground.com/#VZKI0U We want to get the influence of all shadows on a fragment as a float value in the shader for further computations. For this we encountered the following problems: - Mapping to shadow-map coordinates seems to be wrong - using functions like computeShadow() from #include<shadowsFragmentFunctions> yields not-declared-error - computeShadow() yields always 1.0 as a result COURSE OF EVENTS: We started playing around with the standart material and shadow generators and quickly got them to work. we wrote a small utility function for setting up the shadow generators, which you can find at the top of the linked playground code. After this we played around with uploading textures into our custom shaders and were able to create the desired effects. We looked into uploading the shadow-map and the shadow-generator parameters into the shader, which was sucessful. You can find the uploads at line 113-115 of the linked playground code. Since we do not want to write the mapping to shadow map coordinates ourselves, we looked if there is already existing code, which we found in the shadowsVertex.fx, shadowsFragment.fx and shadowsFragmentFunctions.fx files. While trying to get the mapping right, we encountered the aformentioned problems. We were not able to get correct results regarding the shadow-uv-coordinates, shaderincludes like the above mentioned #include<shadowsFragmentFunctions> yields a "computeShadow() has not been declared" error when used in the code after the statement and what code we currently copied from these files seems to always yield 1.0 as a result for the sha- dow intensity. We are turning to you now, because we are at a point where we cannot find the errors in our approach/code anymore. We are required to use Babylon JS version 2.5 in our project. Although it didn't seem to make a difference for the shader code we looked through I wanted to mention it. CONTEXT: Our scene is basically shadeless, with multiple materials per object, distributed via a mask. Therefor we combine a precomputed light texture (for individual objects) with a diffuse texture and multiple material textures blended via a mask texture. Since we require no lighting computation we just want the shadow values to get some visual depth in the scene. Therefor the standart material seems to be not sufficient for our purposes, hence the reliance on a custom shader. I saw code that created a custom material with the standart shaders and then re- placed parts of the vertex and fragment code via a function. We would be ready to do this kind of code insertion, if it yields correct shadow information. Sadly I cannot find the example project for this anymore, so if you could provide a link to a simmiliar source it would be much appreciated. Thank you sincerely for your time and help With best regards from the green heart of Germany The Mainequin Team
  11. 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 !
  12. Hello, is it the correct behaviour that instances that are being disposed doesn't get removed from ShadowGenerator.getShadowMap().renderList ? I have the refreshrate set to 0 and only render with shadow on demand. if (_renderShadow && this._manuallyShadowRender) { this._shadowGenerator.getShadowMap().refreshRate = 1; this._scene.render(); this._shadowGenerator.getShadowMap().refreshRate = 0; } else { this._scene.render(); } Is this a problem i this case? I just want to know (maybe it's a bug). Shouldn't ShadowGenerator check the Mesh.isDisposed attribute? Have a nice day Kevin
  13. [SOLVED] - Problem with Exported Shadow

    I think there may be a problem with the "lifecyle" of a exported shadow generator. If i create the shadow generator with the exporter (good bias and filter settings) the shadows show up IF the Y position is high enough off the ground. But if close to ground ... no shadows. If i create the shadows in the client scene.executeWhenReady the shadows are perfect... If i Console.log both shadows generators (the one created from unity exporter and the one manually created) they are the same. Its weird... Maybe something to do with "Where In The Scene Lifecycle" the shadow generator is being created of exported and the shadow generator info is in the .babyone scene file. I am attaching a test .babylon file exported from unity... The shadow generator part of the .babylon looks fine. but even in sandbox. With none of my babylon enhancements, the .babylon on load... Show the sphere above the ground... Shadows enabled and physics enabled... The balls starts to drop but when it gets close to ground, the shadow disappears. Its gotta be something in the way way is reading the shadow generator information and instantiates the BABYLON.ShadowGenerator... or maybe WHEN is instantiates the BABYLON.ShadowGenerator. Anyways take a look a the MiniGame.babylon file in SANDBOX MiniGame.babylon
  14. So I would like to have my terrain cast shadows on it's self, like the mountains shadow the rest of the terrain, etc. But when I try to do this by adding the groundPlane to the shadowGenerator, the entire mesh turns black. Is there a way to do this, or is this not something that can be done yet? I really hope to be able to pull this off!
  15. Shadow issues..

    OK so I have this endless chunked terrain where I am walking around, I head out a ways, the sun/light objects are moving with the player as I move keeping it's orbit and direction pointed toward the player model, but for some reason the shadows start to go off to the wrong side and distorts (see above image)! Is there a way to tell the shadow generator the light position and target has updated because it looks like it isn't updating since it was instantiated. I'd think it would auto update or something each frame to make sure it was following the light source properly, but that doesn't seem to be the case here. Is there something like shadow generator.update() or something I'm missing? How would I get this to work right, it is bugging me! Here is the bit of code that updates the sun/light position pre-calculated before frame render, less global variables of course.. scene.beforeRender = function (){ skybox.rotate(BABYLON.Axis.Z, -0.00008, BABYLON.Space.PIVOT); if(sunmove && actor){ sunvls.mesh.position = new BABYLON.Vector3(actor.position.x + sunorbdis * Math.sin(sunorbdelta), actor.position.y + sunorbdis * Math.cos(sunorbdelta), actor.position.z); light.position = sunvls.mesh.position; sunorbdelta += sunspeed; } }; How can I work in shadow generator update? Thanks!
  16. Hello, I am having trouble with the shadow generator, this playground illustrate my problem => http://www.babylonjs-playground.com/#DAKLR#4 I made a room with a window. Then I add two lights with a shadowgenerator for each one, the two sphere show their position into the scene. The one outside the room act properly (you can see light pass through the window), but the one inside the room light nothing. If you comment line 97 -> 104 (remove the roof) the light inside act properly. Thanks
  17. Hello, I am trying to generate shadows for a 3D scene with the ShadowGenerator of Babylon. My problem is the following : a mesh can't create shadows and receiving shadows at the same time. Here is a playground where this is illustrated : http://babylonjs-playground.azurewebsites.net/#1R4XE8#1 Let's focus on lines 47 & 48 : torus.receiveShadows = true; shadowGenerator.getShadowMap().renderList.push(torus); If the first one is commented the torus doesn't receive shadow and when it pass into the cube shadow, it is still highlight. If the second one is commented the torus doesn't create shadow but when it pass into the cube shadow, it act well. Finally if the both are uncommented the torus is constantly shadowed (like it is occluding by itself...) Thanks for any help !
  18. Hi Everyone , I'm just starting to work with BJS. I'm trying the ShadowGenerator but I have an issue with the shadow that appears to be a bug but I'm not sure. I've looked up for the "shadow" and "shadows" tag on the forum but I couldn't find anything. http://www.babylonjs-playground.com/#E3ZTS#0
  19. Hi, has been a while however I started a new project using BabylonJS, where I'm importing a model from Blender into a scene, now for some reason I cannot get it to cast a shadow. I added a cube next to it and it does cast a shadow, I'm also adding both the cube and the model to the renderList of the shadow generator.. Any ideas or suggestions what I could try or why it wouldn't work?
  20. shadow issue

    see the following playground http://www.babylonjs-playground.com/#2CPMRP#2 This has a ground , 2 boxes and a DirectionalLight The two boxes cast shadow on ground. If you move the two boxes away from each other the shadows cast by them start fading, becomes less sharp. un-comment 13 and comment out 14 to see this effect Is this expected behavior ? (The above does not happen for useVarianceShadowMap) Also is there any documentation on shadowGenerator's properties useVarianceShadowMap, useBlurVarianceShadowMap, usePoissonSampling, bias
  21. shadow generator serialization issue

    serialization uses mesh id to add mesh to the shadowgenerator renderlist if two or more mesh have same id then during deserialization only one mesh gets added to the renderlist and thus only one of them displays shadow Instead of meshid maybe we should use the mesh's uniqueId ? Today, as a workaround, just before I serialize a scene, I rename all mesh id and give each of them unique id
  22. Hi guys, http://babylonjs-playground.azurewebsites.net/#13CBYF#0 Can someone tell me if this is normal shadow behavior? Mesh is beneath ground, shadow atop ground. Thanks.
  23. Hello! Can someone explain what is happening in this scene: http://www.babylonjs-playground.com/#QOUJT#0 ? The shadow of the torus gets rendered between the light and the object. This looks like a bug to me. Regards, Jens
  24. I'm using a custom material which is pretty similar to the ground material used in WorldMonger demo. The problem is that I don't get a shadows on it. Well it's not a big surprise, because I'm overriding the _effect property of the base material. The question is how can I get both my effect with a base material effect without copy-pasting the code from base material. I mean how can I get shadows while using additional effects?
  25. The scene has one light and two box meshes. The front one throws shadow on the rear one. OK so far. But if I hide both meshes (isVisible=false) and create mesh instances for each them then these instances are visible but do not thow shadow. Even more, if I leave original front meshe visible it doesn't throw shadow until it's instances is visible. See http://babylonjs-playground.com/#1HRVL5#4