In early May, Google opened a source code of technology for VR scene simplification named Seurat.
Impressed by articles and Blade Runner demo I decided to test Seurat. It led me to a few hours of pain and attempts to understand what should I do next. An official documentation seemed very unclear to me, so I wrote this note to save other people’s time :)
Unreal Engine 4 plugin
Plugin can be downloaded from Github.
I’ll skip theory about plugins in UE4. You can read it in the official documentation by Epic Games.
But don’t be so quick to run your test project with the plugin: it won’t compile (as at 16 May).
To fix errors, you need to add one line to plugin’s Build.cs file which can be found in <projectname>\Plugins\Seurat\Source\Seurat\Seurat.Build.cs
Just add the following:
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
Your Seurat.Build.cs should look like this.
Now you can open the project and capture a scene!
- Open a project containing Seurat plugin
- Check if the plugin is enabled in Edit-Plugins window
- Create a level, add some meshes in it
- Then place Scene Capture Seurat object in your scene. It will capture a bunch of pictures of the environment
5. Look through details of the added object and press Capture button
6. Scene capturing will be started. Be patient and wait until message box appears.
7. All right, we did it. You can find captured parts of the scene in <projectname>\Intermediate\SeuratCapture folder
Now we need to build Seurat’s pipeline to convert these pictures into a mesh with a texture.
- Git clone or download Seurat
- Open BUILDING.md file and follow instructions inside (don’t make that mistake I’ve made! If you are going to build for Windows platform, you need to call build.bat -c opt_x64 command from VS Native Tools Command Prompt)
3. If you did everything right, you would find pipeline executable in \seurat\bazel-bin\seurat\pipeline folder.
Open a command prompt and cd to pipeline’s folder (\seurat\bazel-bin\seurat\pipeline).
We should execute seurat.exe with two params (full list of params):
- input_path [default=“”] [required] : Path to the input manifest.json file.
- output_path [default=“”] [required] : Base path to all output artifacts.
Let’s create an input folder and put captured images from UE4 scene inside (don’t forget manifest.json fille! If you specify a whole input folder in input_path param, not manifest.json, you’ll see an error message: “Output path required” :) Yep, that’s wired). Then create an output folder where the mesh and the texture from the pipeline will be created.
So, Seurat call will be like:
seurat.exe -input_path=”<path to input folder>\manifest.json” -output_path=”<path to output folder>”
Wait until mesh and textures generation complete and check Output folder.
Import in UE4
Now you can import generated mesh and texture in the UE4 project, following plugin documentation.
Put new mesh in the scene, apply material for it and enjoy the optimized scene.
I worked with Seurat quite a bit, but I’m sure it’s an easy and fast solution to create a lightweight background for your game or VR scene so far.
Good luck with your optimization experiments :)