We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

help with showFPS

Home Forums General Questions help with showFPS

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #28854
    core3d
    Customer

    Hello,
    I’m trying to make my scene as efficient as i can so i wanted to see FPS on my scene while i building. Using the latest pre3 version and triple F shortcut not working on my browser and im not sure how to enable showFPS() function in myscene.js file. help please.

    #28870

    Hi,

    This feature should work out of the box for all new projects, but for old ones that based on an older version of Verge3D you have to update them as described here: https://www.soft8soft.com/docs/manual/en/introduction/App-Manager.html#Update

    Co-founder and lead developer at Soft8Soft.

    #28963
    core3d
    Customer

    Edit: Nevermind it works now. if you update your old projects it won’t work but if you make a new one it works. At least in my case.

    #29358
    GLiFTeK
    Customer

    Hi,
    This feature should work out of the box for all new projects, but for old ones that based on an older version of Verge3D you have to update them as described here: https://www.soft8soft.com/docs/manual/en/introduction/App-Manager.html#Update

    how do you update a text object updated with the fps?
    i tried a js call, but don’t seem to be able to get the syntax correct.

    #29373

    how do you update a text object updated with the fps?
    i tried a js call, but don’t seem to be able to get the syntax correct.

    Do you mean Blender’s Text objects? Because there’s no need to update the FPS counter itself, I was just saying about updating an application to the newer version of verge3d.

    Co-founder and lead developer at Soft8Soft.

    #29489
    GLiFTeK
    Customer

    how do you update a text object updated with the fps? i tried a js call, but don’t seem to be able to get the syntax correct.

    Do you mean Blender’s Text objects? Because there’s no need to update the FPS counter itself, I was just saying about updating an application to the newer version of verge3d.

    well i was trying to get the fps to link to an updated blender text object for a readout, how does one use the ” .showFPS () : null ” line? wrap in a function? assign it a true value?

    put in run code area of bottom of myapp.js I’m thinking? or in the default generated area?

    #29606

    well i was trying to get the fps to link to an updated blender text object for a readout, how does one use the ” .showFPS () : null ” line? wrap in a function? assign it a true value?

    You can put app.showFPS(); in runCode to enable it via js (and app.hideFPS() to disable). And there’s also a hotkey to switch it: just press F 3 times.

    But this feature is just a small widget displaying FPS in the top left corner. It’s not well-suited for obtaining/utilizing the FPS value. If you need to calculate it I’d suggest to do that in a render callback:

    
    function runCode(app) {
        // add your code here, e.g. console.log('Hello, World!');
    
        var avgFPS = 0;
        app.renderCallbacks.push(function(delta, elapsed) {
            var FPS_INERTIA = 1;
            if (delta > 0) {
                avgFPS = v3d.MathUtils.expAverage(avgFPS, 1 / delta, delta, FPS_INERTIA);
    
                var fps = Math.round(avgFPS);
                // update objects, display FPS here, etc...
            }
        });
    }
    

    – then you can use that fps variable for updating a text object, for example:

    
    textObj.geometry = textObj.geometry.cloneWithText(String(fps) + ' FPS');
    

    Co-founder and lead developer at Soft8Soft.

    #31396
    web
    Customer

    Sorry to bring up this thread.
    I would like to know how you can remove that renderCallback, after you dont need that function anymore?

    #31424

    Hi,

    renderCallbacks is a plain JS Array so you can use various methods to remove your callback from this array.

    https://love2dev.com/blog/javascript-remove-from-array/

    Chief 3D Verger | LinkedIn | Twitter

    #31432
    web
    Customer

    Okay, didnt know that. Thanks for the link.

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.