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

Share this post

Link to post
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); 

Share this post

Link to post
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.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.