Jump to content

How do I add a real-time reflection to a mesh that was created in blender.


Recommended Posts

Hello Everyone,


I would like to add shadows and reflections to a car model that was exported from blender to Babylon.JS. (The file is attached to this post.) I have tried using 'static reflection' in the blender software but it looks horrible when I exported it as a *.babylon file. I have seen reflections in 'The Car" demo on the BabylonJS website and would like to know how to do the same. I am not sure how to identify the mesh that I want to use as a reflector (My programming skills is very weak.) I have seen the tutorial on 'advanced texturing' here https://github.com/BabylonJS/Babylon.js/wiki/14-Advanced-Texturing, but I am not clear on how to do it with *.babylon meshes.  Could someone help me please? I would greatly appreciate it. Thanks

Link to comment
Share on other sites

You can use LensFlare to create reflections. See here:


var lensFlareSystem = new BABYLON.LensFlareSystem("lensFlareSystem", light0, scene);

var flare00 = new BABYLON.LensFlare(0.2, 0, new BABYLON.Color3(1, 1, 1), "Assets/lens5.png", lensFlareSystem);




You can also play with the lights on the specularColor and emissiveColor level.


and you can also use the reflexionTexture


var material = new BABYLON.StandardMaterial("name", scene);
material.reflexionTexture =
new BABYLON.Texture("reflexion.jpg", scene);
material.emissiveColor =
new BABYLON.Color3(0.3, 0.3, 0.3); 

Link to comment
Share on other sites

Hello Dad72


Thanks for taking the time out to assist me. My car.babylon file contains several meshes and I would like to make the the body, doors and rim meshes to be reflective. I need to know how to identify and target these meshes so that I can add the reflection texture. I also need to know exactly where to put the code for the reflection texture. Do I add it to the html file or do I create a new javascript file e.g. 'car.js' and place the code in that file. All of this is beyond my present knowledge. Thanks for your help.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...