Page 1 of 1

Unity3D ImageEffects

Posted: 20 Mar 2014, 13:38
by Mikael Gyth
Hello.
There might be a simple solutions to this, but I haven't discovered it yet.
Is there a way to have Unitys ImageEffects not effect NoesisGui?

Re: Unity3D ImageEffects

Posted: 21 Mar 2014, 13:36
by sfernandez
Hi,

We are currently doing our render on the MonoBehavior.PostRender() function, that gets called after Unity's Render.TransparentGeometry layer, but before Camera.ImageEffects.

I've been investigating and I think we can move our Render to the end of frame by using a corutine that waits until then. We will probably change it for 1.2 version, but if you want to try it now, you will have to modify a pair of scripts:

- In Assets/Plugins/NoesisGUI/Scripts/NoesisGUIPanel.cs, change the PostRender() function to:
void OnPostRender()
{
    if (_uiRenderer != null)
    {
        StartCoroutine(EndOfFrameRender());
    }
}

IEnumerator EndOfFrameRender()
{
    yield return new WaitForEndOfFrame();
    _uiRenderer.PostRender();
}
- In Assets/Plugins/NoesisGUI/Scripts/Core/NoesisUIRenderer.cs, in the function UpdateSettings(), comment the line that flips render vertically for deferred lighting:
private void UpdateSettings(Noesis.AntialiasingMode aaMode,
    Noesis.TessellationMode tessMode, Noesis.TessellationQuality tessQuality,
    Noesis.RendererFlags flags)
{
    // update renderer size
    if (_texture == null)
    {
        // ...

        if (_isGraphicsDeviceDirectX)
        {
            // ...

            if (camera != null &&
                camera.actualRenderingPath == UnityEngine.RenderingPath.DeferredLighting)
            {
                // vvv   H E R E   vvv
                //flags |= RendererFlags.FlipY;
            }
        }
    }
    else // Render to Texture
    {
        // ...
    }

    // ...
}

Re: Unity3D ImageEffects

Posted: 22 Mar 2014, 17:28
by Mikael Gyth
I will give it a try.
Your customer service never seizes to astonish me. Thank you very much. :D

Re: Unity3D ImageEffects

Posted: 25 Mar 2014, 17:20
by Mikael Gyth
Just popped in to say that the fix seems to work as expected.
I did notice that Unitys Bloom affect still affected NoesisGUI after the changes tough (But thats not a problem for us right now).
Thanks again for the quick reply :)

Re: Unity3D ImageEffects

Posted: 27 Mar 2014, 17:10
by g33rt
If you change this for the 1.2 version, could this be made optional somehow? I'm currently using the Unity3D Image effects to create some cool transitions between the NoesisGUI pages ...

Geert

Re: Unity3D ImageEffects

Posted: 28 Mar 2014, 23:45
by sfernandez
Just popped in to say that the fix seems to work as expected.
I did notice that Unitys Bloom affect still affected NoesisGUI after the changes tough (But thats not a problem for us right now).
Thanks again for the quick reply :)
Yes, Bloom is affecting all the textures (brush gradients, text glyphs, images...) that we use to render the GUI. We will investigate how to avoid this issues when rendering the GUI without image effects.
If you change this for the 1.2 version, could this be made optional somehow? I'm currently using the Unity3D Image effects to create some cool transitions between the NoesisGUI pages ...

Geert
It sounds right to me, we can provide a check box in the NoesisGUI Panel component to decide if Image Effects should affect the GUI or not. Thanks for the suggestion.