Quantcast
Channel: Bugs Latest Topics
Viewing all articles
Browse latest Browse all 760

custom shader : setFloat bug in VR when called in runRenderLoop

$
0
0

Hello,

I have created a custom shader ( BABYLON.ShaderMaterial ) that needs to update an uniform value (time) in the runRenderLoop.

I created a camera with : var vrHelper = scene.createDefaultVRExperience();

When I use the non VR camera everything is fine, but when I switch to the VR camera, the rendering freeze.

If I comment in the code below the line : my_material.setFloat("time", time);  then it renders normally in VR as well.

It looks that updating a uniform value of a shader does not work in VR or has to been done differently ?

var my_materials = scene.materials;

// Render

var time = 0;
engine.runRenderLoop(function () 
{

            for (var i = 0; i < my_materials .length; ++i)
            {

                  if (my_material != undefined)
                  {
                        my_material.setFloat("time", time); //If this line is commented work both in VR and non VR
                  }

             }

             time += engine.getDeltaTime()/1000;

            scene.render();

}

Thanks for the help,

Fabien

 

 

 


Viewing all articles
Browse latest Browse all 760

Trending Articles