Search the Community

Showing results for tags 'light'.

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
    • 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 36 results

  1. Light Cookies

    Hello everybody! I am making caustics effect underwater. I see playcanvas.js engine has an example. Here: Doc: I tested with editor's playcanvas.js, result just like what i need, below image. They use Spotlight with a texture. I tried search google, forum, document but does not have this attribute. How i can make this effect? Can Babylon.js's team support this attribute for Spotlight? Thanks so much!
  2. 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
  3. Hi community, I have a light source with a specific specular color. I would expect that you can see this color on a surface reflecting (especially on a very smooth surface) . Either I miss some settings, or it's a bug? see Playground diffuse works, but specular (should be red) is dead.
  4. Hi guys, I am trying to understand the fundamental concepts of direction light and the shadow generator, and how to combine them both. I am playing with the shadows demo from the playground - I have removed light2 (well, commented it )I have added another sphere to show me the direction's position (the new sphere's position is light.direction)Light direction is -1, -2, -1 . So far so good. Example here - , and everything is working fine. Now I do the following - I change the light's direction to -1,-1,-1. I wouldn't have expected Any major difference (shadow should move a bit, it should still be generated for the entire object). What happens is this - . Part of the shadow is simply cut out (Lower right corner, in case you haven't changed the camera perspective). Ok, I then decided to keep on experimenting. I have changed the direction to -1, -20, -1 . Once again, I have expected that there won't be a major difference in the shadow (I have just moved the light's y a few units (well, 18 ) down. This is how it looks like - This time, the upper left corner is somehow filtered out. I have continued to change the direction property a few more time, but the only time a real full shadow appeared was when it was -1, -2, -1. I have also played with the light's position, it was still very hard to get the shadows working with different configuration. I do believe my major misunderstanding is about the direction property of the directional light. The direction is the point to which the light source is directed to. Light is emitted from (according to ) everywhere, which means that technically objects should be lit from the bottom as well. The position property of the light is just for the shadow generation. Otherwise it is not really used (I hope I got that right). What am I missing? Why is the shadow not working correctly?
  5. Shape of light source

    Hi, I couldn't seem to find an answer to this question I want to create a light source that has a specific shape, or make an object also be a light source. Whichever. How would I do that? Thanks for the help!
  6. I'm displaying some items in the "billboard" mode: The items would need to maintain the same color (or change it just a bit with the camera rotations). I believe it must be very simple to do, but, still bein a novice, I do not know how ....
  7. Hi, what would be the best way to crate lamp like mesh, that is half transparent and is lightened from inside (emits light). Thanks.
  8. I have a Phaser game created and I am able to create an updated visibility graphic object while my sprite moves. However, like in this example, and every other I have found online:, they are using an image of the thing you want to see as the 'background', and simply .mask against the visibility graphic. In my case, I do not have an image of the map as it is created through a tilemap generator, so my current code basically shows the opposite of what I am looking for: For this example, I created a test box in the bottom right of the screen that has nothing to do with the real map (I'll add the correct walls later to the visibility algorithm). I want the part that is not white to be blacked out, and the whited part to be crystal clear. I have tried creating a sprite of just black, and a sprite of just transparent, and had them .mask = visibility graphic. But this just overwrites everything else. I have taken out the most important part of the code for reference: preload () { //load assets that are specific for this level'blackness', '../../assets/images/blackness.jpg');'transparent', '../../assets/images/transparent.png'); //'yellowish', '../../assets/images/yellowish.png') } create () { this.blackness =,0,'blackness'); //this.blackness.alpha = 0.8; //this.transparent =,0,'transparent'); this.lightCanvas =,0); } update() { let visibility = this.createLightPolygon(this.currentPlayerSprite.x, this.currentPlayerSprite.y); this.lightCanvas.clear(); this.lightCanvas.beginFill(0xffffff,0.5); console.log('visibility',visibility) this.lightCanvas.moveTo(visibility[0][0],visibility[0][1]); for(let i=1;i<=visibility.length;i++){ this.lightCanvas.lineTo(visibility[i%visibility.length][0],visibility[i%visibility.length][1]); } //this.transparent.mask = this.lightCanvas; this.lightCanvas.endFill(); }
  9. I do not understand why the ground in the scene is not affected by the solar light of the sky box. demo: I will describe it in more detail: When I removed the light(The HemisphericLight) in the scene.The ground turned black .I think there is a sun in the sky box, why the sun's light does not affect the ground. please help me!!
  10. Hi guys! I make map with the dark forest and I need make center of the map with good light, but the closer to the forest, then map gets darker. I need something like the fog but without binding to the camera. Fog always in position 0, 0, 0 and if player go to coordinates 100, 100, 100 then his go to the dark. While I did just the fog attached to the camera and if the player closer to the forest, then fog far from the player and camera. And the forest does not seem so dark. Anybody haves some ideas how do it?
  11. Hi All, I would like to replicate what I've seen referred to in some other engines as ambient light; definition of which being - a light that evenly distributes across the whole scene; e.g. doesn't cast shadows, and no parts of the scene look darker / lighter than any other part. My main reason for this is that some of my 3D content will need to have light maps baked into the texture images (for other non-babylon related reasons) & I don't want the default babylon lighting to affect this light mapping. I noticed this topic asked a similar question: However the answer they got didn't seem to satisfy my requirements. So far - the closest solution I've come up with is: for (i = 0; i < newScene.lights.length; i++){ newScene.lights.setEnabled(false); } for (i = 0; i < newScene.materials.length; i++){ newScene.materials.emissiveColor = newScene.materials.diffuseColor; } However this assumes that all my materials are solid colour; which they won't all be; some of them will have image textures. Any advice would be greatly appreciated? Perhaps a shader effect might be of help? Thanks!
  12. flickering neon light effect

    Hi, For my website i created a neon effect with PixiJS v4 and i'm not happy with the results i was wondering if anyone could improve upon or has a better idea how create a neon effect which works across multiple desktop/mobile devices. The neon light is a simple transparent png image overlaid on top of static background image. It works for time been 'good enough' for desktop browsers, but i had to disabled it for iPad, etc. because of the slow performance combined with rain (pixi-particles) and fog (custom particle effect). Live version: Code: //PIXI var PIXI; var Container = PIXI.Container, autoDetectRenderer = PIXI.autoDetectRenderer, loader = PIXI.loader, resources = PIXI.loader.resources, Sprite = PIXI.Sprite, ParticleContainer = PIXI.particles.ParticleContainer, extras = PIXI.extras; var street = new Container(); var weatherType = new Container(); var renderer = new autoDetectRenderer(3600, 720, {antialias: false, transparent: true, resolution: 1}); document.getElementById('street').appendChild(renderer.view); //View = 'block'; renderer.autoResize = true; //Variables var neonSign, neonFilter, colorMatrix, count = 1; function animateScene() { //Animate neonSign neonSign.alpha = 0.1; count += 2; var bright = 2 + Math.sin(count); neonFilter.brightness(bright, false); requestAnimationFrame(animateScene); renderer.render(street); } function setup() { //Setup neonSign neonSign = new Sprite(resources['images/one-stop-copy-shop_glow.png'].texture); neonSign.width = 1200; neonSign.height = 300; neonSign.position.set(1200,0); colorMatrix = [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]; neonFilter = new PIXI.filters.ColorMatrixFilter(); neonFilter.matrix = colorMatrix; neonSign.filters = [neonFilter]; //Add neonSign street.addChild(neonSign); //Start animateScene(); } //Setup loader .add('images/one-stop-copy-shop_glow.png') .load(setup);
  13. Hey Delta... Did you get a chance to put the missing light.onDispose and camera.onDispose just like the mesh.onDispose has???
  14. 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 !
  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. Light problem

    I'm testing the 3ds max exporter and I have the light problem shown in the attached image. Why? There are a plane object, a teapot and a simple omni light with shadow map activated. I've tried every parameters combination between the exporter UI and the light parameters. Thanks in advance.
  17. Hello, I am having trouble with the shadow generator, this playground illustrate my problem => 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
  18. Hi, So I have another problem, this time with the PBR textures imported from unity using Babylon2unity. If I am using any light other than Hemilight (pbr material from unity seem to work with it), all the textures show up black. Again it might be solved by some tweaks in the texture objects, so I have been looking for the problem for hours now... I had some successes, failure, a lot of frustration. So I thought i should ask for your help. On the first image this is the results of my tweaking using an omnilight. So I though I had it figured out, by changing the reflectivityColor and reflectionColor from 0,0,0 to 1,1,1 it seems I get back my texture for the little robot in the middle (the infamous roger robot). With some shadow etc. I also changed the "hasAlpha" in the reflectivityTexture (because it does have alpha) and changed useMicroSurfaceFromReflectivityMapAlpha and useAutoMicroSurfaceFromReflectivityMap to "true" (one of them was already to true, can't remember which one) - that did work with matte region becoming matte, at long last. So I said Great ! lets change the reflectivity color and reflexion color for one of the tile type (the little hexagons thingy). By doing that I also get back the texture normal color BUT, light does not seem to interact in the same way, the mesh is lighted both in front and behind similarly... the back face should be black no? (see image 2). The last 2 images is with the hemilight (front and back) , it seems the material is behaving normally... You might be wondering why I am persisting on resolving this issue when I have a perfectly well behaved light source at disposal... and that is a very relevant question. Any idea(s) ? Light source code: var hemiLight = new BABYLON.HemisphericLight('hemiLight', new BABYLON.Vector3(0, 0, -30), scene); hemiLight.intensity = 2; // var sun = new BABYLON.PointLight("sun", new BABYLON.Vector3(0, 50, 0), scene); // sun.intensity = 2;
  19. Hello, I'm currently working with flat shaded meshes and point lights in my Babylon.JS scene and the light is reflecting in a not-flat-shaded way. Playground demo: My own screenshot: My target is to have one "flat color" per face and no light beam reflections which fade over distance. Is my target even possible with point lights or do I have to use other lights like the hemispheric light? Thanks for every answer, Simon
  20. How to remove glare from light? I need to model the illumination light but did not glare. Is it possible to do something to remove the glare?
  21. hi everybody.. could you give me tips to create fake light? i draw fake light like following image with blendMode..(i don't use shader here because it's slow on mobile). it will be drawn on maps.. i wanna add good simple animation like intensity of light or glittering i need good formula or function to draw good.. thx..
  22. Light Trail and Follow

    Hello everyone! First of all, thanks for the excellent forum! It's amazing. My question is, how to make and which the best way to make a "Light trail effect". I've make this image from photoshop to illustrate: The red dot is the point that the line shall follow. When the line becomes long, needs to fade out. I thought 2 possibilities to do it : Particles or slice and manipule a "shape" (texture), dividing in 3 parts, like : My doubt is, what is better? Or have other way to do... And, the Particles or Particles Storm from Phaser can do this? Sorry for my bad english Thanks for patience!
  23. Visual light area

    I would like to have the below effect t The problem I'm having is that the spotlight doesn't provide me with the total length of the light, so there's no way for me to calculate the measurements for the cone. Can someone please lead me in the right direction on how to get the desired effect? Thanks in advance.
  24. Hi, I would like to setup so that light falls on the mesh, even when mesh is rotated. Currently, if I rotate the mesh and look at the bottom surface, it is rendered as black, which means there is no light that hits this surface. I think this means light moves along with the camera. is this correct? However, when scene is rotated and a different surface is placed on top, I see a shine. Why is this ? I think I am missing something very basic here. All I want is use a single source of light and illuminate the mesh, no matter how it is rotated. Is this possible ? Regards Rajkumar