I'd like to add that no project is Blueprint-only though, you can still add C++ classes to extend UE4's functionality. In that project, I set that actor in the field of view, but looking backwards, so that we don't see its UI and only see the StereoLayer. One of the issues is that this will only work if the actor containing the UI is visible, otherwise the UI won't render to the texture. We also need to only do this once, after the first render of the widget, due the boolean in the blueprint). The blueprint below shows this (we need to grab both the StereoLayer, the WidgetComponent, and link them together. In blueprints, if we get that material instance, get the texture named "SlateUI", and set the stereo layer's texture to it, it works. If that parameter is not null, the Widget Component will create a Dynamic Material Instance, and create a texture parameter in that instance whose name is "SlateUI", and render the widget to that texture. Basically, the Widget Component has an optional Material parameter. Unreal Engine 4.26 Documentation Unreal Engine 4. Enclosed is the modified version of the LayerUI project that is now Blueprint-only. How to create a Widget Blueprint and Overview of the Widget Blueprint Interface in Unreal Engine. We would need to raytrace the head gaze / touch gaze against the quad to figure out where the user is aiming, but that's for another day!Īlrighty so there is actually a way to make this work with only blueprints, it seems. The input should be pretty straightforward if using buttons like the GearVR touchpad and others, but a bit more involved if using the head gaze as input. The TextureRenderTarget2D is then used as input for a stereo layer That "Widget to Texture" blueprint function is the one that I defined in the C++ function library. In Menu, you'll notice that in the Event Graph, I have an event tick that every frame renders the widget to a TextureRenderTarget2D I defined in the Content section (as shown on the screenshot). In my sample, in Blueprints, you'll find NewUserWidget, which is the UMG widget, and Menu, the actor containing the widget (of class NewUserWidget). It's only in C++, so I wrapped it in a blueprint function library, that you can copy into your project. There is actually a simpler way, which is to use Epic's WidgetRenderer class. I was mistaken in my belief that the 3D widget was the best way to do this. Enclosed is a test project that renders a very simple UMG Widget-based UI to a texture, then uses that texture as a quad layer.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |