I wanted to use reflection probe so I added reflection probe to floor plane for the experiment.
However this code does not work.
breif logic-
1.creates plane named a
2.creates reflection probe that is property of Object named Game
3.set cubeTexture of reflection probe as reflection Texture of plane a.
- Import mesh.
5.In on import mesh function, add cube and imported mesh to reflection probe’s renderList.
Here’s the code.
function Render(){
createMainScreen();
BABYLON.SceneLoader.ImportMesh("",“model/”,“scene.gltf”,scene,function(model){
model[0].position = new BABYLON.Vector3(0,0,0);
model[0].scaling=new BABYLON.Vector3(0.005,0.005,0.005);
Game.player = model[0];
Game.gameStart[1]=true;
Game.player.rotationQuaternion = null;
Game.probe.renderList.push(model[0]);
var c = BABYLON.MeshBuilder.CreateBox(“cube”,{width:0.2,height:0.2,depth:0.2},scene);
c.position.y=0.3;
Game.probe.renderList.push©;
});
engine.runRenderLoop(function(){
scene.render();
});
}
var a=null;
var MainScreen = {};
//createMainScreen Function
function createMainScreen(){
a = BABYLON.MeshBuilder.CreateGround(“a”,{},scene);
a.material = new BABYLON.StandardMaterial(“sm”,scene);
Game.probe = new BABYLON.ReflectionProbe(“main”, 512, scene);
a.material.reflectionTexture = Game.probe.cubeTexture;
Game.probe.refreshRate = BABYLON.RenderTargetTexture.REFRESHRATE_RENDER_ONEVERYTWOFRAMES;
a.material.reflectionFresnelParameters= new BABYLON.FresnelParameters();
a.material.reflectionFresnelParameters.bias = 0.02;
a.material.diffuseColor = new BABYLON.Color3(1, 0.5, 0.5);
}
the color of plane that was set in onMeshImported function worked, but reflection desont work.