User avatar
jsantos
Site Admin
Posts: 2905
Joined: 20 Jan 2012, 17:18
Contact:

Re: Turn off continuous rendering in Unity?

26 Aug 2020, 11:34

We are going to implement support for disabling "Continuous Rendering" in main cameras. That way we will render only when changes happen.

To work properly though, this feature needs Unity preserving the content of the framebuffer between frames. That's on your side, not something Noesis can control.
 
User avatar
jsantos
Site Admin
Posts: 2905
Joined: 20 Jan 2012, 17:18
Contact:

Re: Turn off continuous rendering in Unity?

29 Aug 2020, 23:48

I closed the ticket this without changes because they are not needed. The API already supports all scenarios. When NoesisGUI is being rendered to a main camera, as explained in the documentation, 'NeedsRendering' must be used with a manually repainted camera. Manually repainted cameras must be disabled (the Camera component, not the gameobject) and Render must be invoked when needed, for example attaching the following component:
public class Redraw : MonoBehaviour
{
    void Update()
    {
        NoesisView view = gameObject.GetComponent<NoesisView>();
        Camera camera = gameObject.GetComponent<Camera>();

        if (view.NeedsRendering)
        {
            camera.Render();
        }
    }
}
With this component attached to a camera, our examples only render frames when strictly needed.
 
ttermeer-reboundcg
Posts: 3
Joined: 13 Sep 2019, 11:10

Re: Turn off continuous rendering in Unity?

01 Sep 2020, 14:10

Thank you for the code.

Just a precision for anyone who wants to try it, this does not work in the Unity Editor - only when build. So you need to change the script to enable the camera when you are running inside the editor
 
User avatar
jsantos
Site Admin
Posts: 2905
Joined: 20 Jan 2012, 17:18
Contact:

Re: Turn off continuous rendering in Unity?

02 Sep 2020, 13:17

Yes, thanks for that clarification. Inside the editor, if the camera is disabled nothing is rendered.

We were debating here if we should do this trick automatically: when Noesis is rendering to camera (not texture) and continuous rendering is enabled we could 'disable' the camera component and pump frames manually. But for now, we decided not to, I think it is too intrusive (changing parameters in the main camera) and probably confusing.

Also we didn't try all platforms, not sure if this trick will work everywhere.

What do you think?

Who is online

Users browsing this forum: Google [Bot], noizex and 0 guests