Page 1 of 1

Automatic RenderTexture Mode ?

Posted: 24 Feb 2018, 10:24
by Regbalt
I Must say, i have a blast right now with noesisGUI.
That i can simply place a Sphere and put an Menu on it, with 2 clicks and the Mouse works right from the start. :shock:
Hello Epic VR Menue's :lol:
Somtimes it must be a MeshCollider. Capsule and Shere Collider seem's not to work.

But i was wondering, that NoesisView don't have an option to create the Render Texture and Material automatically.

I have created a small Script, that creates a Material from Shader and than create an Render Texture, added it to the Material and placed it on the Mesh and then activates the NoesisView, that then, creates the Camera and Menue.

Re: Automatic RenderTexture Mode ?

Posted: 24 Feb 2018, 15:49
by hcpizzi

I'm glad you're enjoying the experience so far.

I guess you're referring to the UE4 plugin, correct? In that case, the WidgetComponent basically has all the render to texture code in place. If I remember correctly, the only thing that prevents a full render to texture and map over a mesh is the mouse pointer handling. Off the top of my head, I think they don't actually use hit testing for that, instead calculating the position of the mouse analytically, which is why it only works when the widget is displayed as a plane and not their cylinder projection method.

You can actually do something like this, where Widget is a WidgetComponent and Cube is a Mesh, and it uses the UI texture in the mesh:
I think it shouldn't be too complicated to write a subclass of WidgetComponent and override GetLocalHitLocation, but maybe something more is required.

Re: Automatic RenderTexture Mode ?

Posted: 24 Feb 2018, 18:47
by Regbalt
Oh, I have to be more precise. Im learning at the moment wpf and usally use Unity3D.

This is the little code, for automatically creating the Material and Render Texture, that are requied for the NoesisView on a Mesh.
public class RTCreator : MonoBehaviour
    public int width = 1024;
    public int height = 1024;

    public bool transparent = false;
    public bool unlit = true;

    void Start ()
        Shader shader = null;
        if (unlit == false) shader = Shader.Find("Standard");
        if (unlit == true)
            if (transparent == false)
                shader = Shader.Find("Unlit/Texture");
                shader = Shader.Find("Unlit/Transparent");

        RenderTexture rt = new RenderTexture(width, height, 0);
        Material m = new Material(shader);
        m.mainTexture = rt;

        if (transparent && unlit == false)
            StandardShaderUtils.ChangeRenderMode(m, StandardShaderUtils.BlendMode.Fade);
        Renderer r = GetComponent<Renderer>();
        r.sharedMaterial = m;

        NoesisView nview = GetComponent<NoesisView>();
        nview.enabled = true;       
I was just wondering, why there was no Option for this directly in the NoesisView script.

Re: Automatic RenderTexture Mode ?

Posted: 25 Feb 2018, 09:35
by hcpizzi
Oh, well, please ignore my answer then. When you said Epic I thought you were referring to Epic Games, hence my assumption :)