UTS Data Arena
  • home
  • projects
  • dive in
  • about
  • calendar
UTS Data Arena
projectsdive inaboutcalendar

Unreal Engine

Follow our ongoing process of integrating Unreal Engine and nDisplay into the Data Arena.


9 Dec 2020 16:12

Object-oriented programming with Class Blueprints

This is just a small update to share something we created while exploring Class Blueprints: Unreal Engine's approach to visual object-oriented programming. If you're familiar with the concept of objects within programming (from any language), the term class should give you a sense of how these work. A Class Blueprint is a way to build the geometry, data and behaviours/functionality of an object in Unreal Engine. After defining a class blueprint (for an Actor for example), it's possible to generate as many actors based off this class as you like.

As a quick test a few months ago, I (Thomas) decided to try and create a class blueprint around the idea of a coloured light. It would essentially be a point light with a visible sphere. Each object should be able to receive a unique colour to apply to its point light and the emissive material on the sphere to make the light source visible. Here's how the scene came out in the end...

class_bp_2.jpg
class_bp_1.jpg
class_bp_3.jpg
class_bp_4.jpg

The actual blueprint

Each Class Blueprint has an event graph to create a node-based program. Starting with the BeginPlay event (which fires once per object at runtime), a random vector is created and multiplied to appear anywhere with a 5000 unit radius from the centre. I've mapped the Z value to keep it above ground. This is all for the position of the light. To generate a random colour, a random float value is generated between 0 and 360, representing the hue spectrum. This is passed through the HSV to RGB node to create a usable colour object by UE, and it's then applied to the point light colour and emissive material of the object itself. This is identical to how the random colours were generated for the lights in this post.

Below is a live embed of the blueprint I created (thanks blueprintue.com). You can interact with right-mouse drag and scrolling.

Left Mouse ButtonSelect/Drag
Mouse-WheelZoom
Right Mouse ButtonPan

From here

This small experiment was particularly useful coming from a background where I'm familiar with the concept of objects and class-based programming. Understanding how to generate objects in Unreal Engine and control how they manifest themselves in the scene, as well as what points of data and behaviours are available, is incredibly useful and we'll definitely be building on this for future projects and pipelines.


9 Dec 2020 16:12

Developing a Rhino → Unreal Engine pipeline

One of our goals with implementing Unreal Engine into the Data Arena is to create a pipeline for students of architecture, interior design, product design or any practice involving create creation of digital 3D models. A pipeline into Unreal Engine would theoretically allow anyone to quickly bring in their work into Unreal Engine projects set up to run in the Data Arena and explore their work in 360º stereo with UE's incredibly lighting and material qualities.

A few weeks ago we started looking into the popular modelling software Rhino to figure out how best to export data. After trying a few common formats, we found FBX to play nicely with Unreal Engine and carry over material properties. Here's a simple red box coated with a glossy red "paint" in Rhino.

rhino_2.jpg
rhino_1.jpg
rhino_3.jpg

Export and import

After a simple File → Export option, we imported the exported FBX file into Unreal Engine and left the default settings as they were. UE accurately separated imported the geometry and created a material, no adjustments needed.

Here it is placed in a bit of a "studio" setup with some basic lighting. Note: at this point I didn't really know anything about lighting in Unreal Engine, and I don't think these shadows are even properly baked to a high standard, so this says a lot about how well UE handles materials out-of-the-box.

ue_contents.png

Unreal Engine screenshots

rhino_ue_1.png
rhino_ue_2.png
rhino_ue_3.png
rhino_ue_4.png
rhino_ue_5.png

From here...

This first test came out pretty well with minimal issues and was a good first step towards developing some sort of pipeline. From here we wondered if it would be possible to specify a model to view at runtime, especially coming off the back of the previous experiment where we were changing lights through command line arguments.

Long story short we couldn't quite crack it. Unreal Engine doesn't display 3D models like FBX files, it imports and then interprets them into its own asset system of static meshes and materials. For us to be able to specify a model at runtime means we would need access to this importing and asset creation system at runtime which currently isn't possible (at least in 4.25). It might not be the safest path either, as the importing process handles a few options about the creation of materials and search for textures etc that you might not want to just automate at runtime.

As we move towards developing a pipeline, we're keeping in mind that it might look something closer to a template file that we provide to students or researchers working in these spaces, along with some instructions for importing and placement, and then take said file back to view in the Data Arena.


9 Dec 2020 16:12

Accessing command line arguments at runtime

ue_coloured_lights_command_arguments_1

Simple task: change the colour of two lights

This post covers some discoveries from earlier this year in May. A question came up during some initial discussion of how we can use Unreal Engine to develop new pipelines, specifically whether it would be possible to include arguments in a launch script to modify something in the scene. Initially we wondered if we could specify an FBX model file to import and display, without having to open and re-package an entire project. This turned out to be borderline impossible with the architecture of Unreal Engine projects, but we did manage to get a small demo working with some coloured lights, just to get off the ground.

The launch command

./TheProjectBinary --args SmokySpace -windowed -ResX=1000 -ResY=600 LightOneHue=20 LightTwoHue=330

TheProjectBinary refers to the executable binary that Unreal Engine produced when packaging for Linux. Truth be told, the screenshot above is running on a Mac using open TheProjectBinary.app command instead. The --args flag tells UE to expect further arguments. The next is SmokySpace which is the name of the level you're looking at (we could avoid this if it was the default level). The next few arguments request to run the game in a window rather than fullscreen, at a specific size.

The interesting part here are the custom arguments LightOneHue and LightTwoHue. These are totally custom terms and mean nothing to Unreal Engine, however with some handy nodes in the level blueprint, we are able to retrieve these and use them at runtime. Here's a few more executions with different hue values provided.

ue_coloured_lights_command_arguments_2
ue_coloured_lights_command_arguments_3

Here's our level blueprint. A custom function called Get Option Value has the task of taking in a specified argument name (e.g LightOneHue) and finding its value. The key node here is the first Get Command Line node which retrieves the entire command that was used to launch the project as a string. From there, after much splitting and searching, we return the value assigned to the argument.

ue_coloured_lights_command_arguments_blueprint_1

From there, after the BeginPlay event, this is called and the integer is passed into a HSV to RGB node to generate a colour and applied to the geometry material and light colour of a point light actor. Currently this is repeated for each light but optimisation can come later!

ue_coloured_lights_command_arguments_blueprint_2

From this little experiment we can see that it's absolutely possible to retrieve basic pieces of information at runtime (numbers and text). Next we'd like to explore the possibility of specifying a CSV file (for example), or a more complex dataset or 3D model at runtime.


Pages
1234567