Jump to content

custom shader : setFloat bug in VR when called in runRenderLoop


Recommended Posts


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;



Thanks for the 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...