cubeRenderTarget to 2D texture?

Step by Step Tutorial

For anyone new to 360 rendering from VFX, Film or Games who would like to produce 360 captures for Youtube 360, Google Cardboard or Gear VR ect. If rendered to a high quality (4K with lossless image quality (PNG / BMP / TGA) then this can be a viable, fast and FREE alternative to 360 panoramic rendering from standard 3D packages such as Max, Maya or C4D.

Pros of using this technique:

  1. Produces 1080p renders for Youtube 360
  2. Quick to set up and get testing
  3. It’s easy for beginners
  4. Can be produced in a Blueprint only project
  5. Renders quickly

Cons of using this technique:

  1. Lossy image quality (Look at 's Thread for a 4K solution)
  2. Capped at your screen resolution (unconfirmed)
  3. Reflections and Fog particles can cause Seams

TUTORIAL

  1. MODES - Create a Scene Capture Cube
  2. CONTENT BROWSER - Add New - Materials & Textures - Cube Render Target, call it “T_CubeRenderTarget”
  3. Edit T_CubeRenderTarget - Size X to 2048
  4. Return to Scene Capture Cube - Set the Render to Texture Target as T_CubeRenderTarget
  5. Uncheck & Check tick box “Capture every frame” to refresh the texture
  6. Content Browser - Create new Material called “M_360CaptureMaterial”
  7. Set Material Shading Model to UNLIT
  8. Drag in your 360 T_CubeRenderTarget Texture as a Texture Sample, Hook into ‘Emissive Color’
  9. Create a new “custom” node
  10. Add Code as follows into Code slot
    float2 Angles = float2(2 PI (UV.x + 0.5f), PI UV.y);float s = sin(Angles.y);float3 Direction = float3(s sin(Angles.x), cos(Angles.y), -s * cos(Angles.x));return Direction.xzy;
  11. Add a 2nd Input, name it ‘UV’
  12. Create a Texture Coordinate, and plug it into input 2
  13. Search for a Plane in the Content Browser - if no Plane create one in 3d modelling package. Polycount is irrelevant
  14. Apply M_360CaptureMaterial to the Plane
  15. Set Scale to X=2, Y=1, Z=1 which gives us a 2:1 aspect ratio surface to capture from
  16. Create a standard Camera in the world, facing the plane front on
  17. Set Location of Camera to be the same in the X & Z. but offset in the Y to give some distance (specific distance is irrellevant.)
  18. Edit the Camera Settings to be:
  • Name: 360_Orthographic_Camera
  • Projection Mode: Orthographic
  • Ortho Width: (Size to fit Plane)
  • Constrain Aspect Ratio: On
  • Aspect Ratio: 2.0
  1. Create a called MAT_360
  • Select 360_Orthographic_Camera in your scene
  • Right-Click - Add New Camera Group
  • Name Your Group
  • Create new Director Group
  • Add Key - Choose your camera Group
  1. Animate your Scene Capture Cube through the world.
  2. Select your
  3. Open Level Blueprint
  4. Right-Click, create reference to your
  5. Drag out a wire from the reference, add a ‘Play’ function
  6. Hook the ‘Play’ Function into Event Begin Play
  7. Add a Delay, set duration to the same as your length (in seconds) ex. ‘30’
  8. Add an Execute Console Command: ‘quit’
  9. SAVE YOUR WORK
  10. Open (maximise) click on MOVIE (create a movie, in the far right of the toolbar, you may have to expand the toolbar)
  11. Choose your settings:
    Capture Type: AVI / JPEG Image Sequence
    Capture Resolution: 1920 x 960 (Maximum Monitor Resolution x Width / 2 = 2:1 Aspect Ratio) FPS: 30fps
  12. Click OK, Wait for Render to complete (or hit ‘tilde’ to bring up console command and type in quit)
  13. Navigate to your Unreal Project Folder:
    …/Saved/Screenshots/Windows

If you’re getting any rendering errors like I did after tying your scene capture cubes into an existing , don’t panic! Just delete your sequence and try again.
Errors discovered include - incorrect arrangement of faces from cube map, black bars around frames, different scaling of faces.

If you’re seeing seams on your renders like I do, you may have to re-think how you’re approaching screen-space reflections, screen-facing particles and vignettes.

[Will post video results & screenshots soon]

Thanks!
.

1 Like