Rendering Virtual-Reality Scenes In Blender

Rendering Virtual-Reality Scenes In Blender.

So I was bought a ‘google cardboard’ style Virtual-Reality type phone-case thing thing at Xmas (Though the particular one from my wish-list wass made of plastic, not cardboard))*

You just push your phone into the back and it uses the gyroscopes and/or accelerometers and/or compasses in your handset to know which way the phone is pointing and so which part of a 3d-scene to render onto each side of the screen. Lenses in the headset focus each side of the screen into each eye, and the software also corrects for the distortion in the lenses.

Here’s a thing I made:

Clever stuff, and surprisingly impressive for some of those apps. I like the street-view plugin to show sky-domes taken around the planet through the system (though they’re mostly technically 360-degree two-dimensional). Most of the games are inanely simple and dull but impressive to look at for a few minutes at least. Expect that’ll get better. Lamper VR has more of an actual game in the game than most of the other’s I’ve seen so far.

Youtube’s app has a VR-mode, and you can filter it’s search for 360-degree and/or 3d films. A couple of the coolest were this 360-degree zombie dance (Look out behind you!), and This 360-degree xmas cartoon in which the action runs around the full stage.

There’s also loads of vloggers playing with 360-degree cameras and films from skydivers or jet-fighters or hot-air-balloons or rocket-launches and stuff, all good fun.

You can see those things on your phone handset even without the 20-quid-or-so lump of plastic or cardboard, in 360-degree 2d by just moving your phone around. The button to make ’em 3d too may need the Cardboard app to be installed I guess.

So of course I figured I’d play around and build a full 3D 360-degree scene with my usual tentacle characters to see how easily and effectively such a thing can be done.

So here’s a two-minute loop of a half-second animation I built to see how it’s done. You may have to be using Chrome or non-flash or a mobile-browser or something to get it to work, seems that the 360-degree 3D stuff is still unsupported on some platforms.

In short this is how it’s done in Blender:

1) Use Cycles. The default blender-render won’t do panoramic camera-renders. Thus, I spent a fair amount of time updating materials to a new renderer. This would have had to be done at some point anyway I guess.

2) Set the camera-dimensions to half-height. I rendered in 4x resolution so half that is 3840×1080. We’re doing TWO pictures on each frame, left eye and right eye on the top and bottom, but the camera resolution needs to be set for just one of those pictures.

3) Set the camera “lens” property to “Panoramic”, and type “Equirectangular”. You won’t have an “Equirectangular” option in the blender renderer. See point 1.

4) Select “Window/Set Stereo-3d” and put that to “Top to Bottom”

5) In the Render panel, ensure that output/views-format is set to “Stereo 3d” and “Top to bottom”. If you save a frame as an image after hitting render, you’ll have to set that up in the sidebar while you pick a filename to save as too.

6) Position your camera horizontally. So that the z-axis of the camera is straight up. If your camera is out of alignment it’ll feel weird, like you’re standing on a slope or something when you put the headset on an look around.

7) Render your animation as usual.

You can use the Android “VR Player” app to view the files you render.

Upload to Youtube

Uploading to Youtube means inserting data into your mpeg to tell Youtube (and presumably anyone else) that the file is a spherical projection. You can use this Python Script to do that. To inject stereoscopic info and 360-degree projection you’ll want to run it with a command like this one I used:
[code]python spatialmedia -i -s top-bottom -c 3840:1080:3840:1080:0:0 inputFilename.mp4 outputFilename.mp4[/code]

With the special meta-data attached, you upload to Youtube as usual. It should notice it’s 3D and Panoramic and automatically use the 3D 360-degree player and offer “Cardboard” VR on phone apps.

Note also that it takes a while after upload for the whole thing to kick in, so it’ll look like it’s not worked for twenty minutes or so (youtube say “up to an hour”) even after the video says “processed”. Expect it to look wrong for half an hour after upload. So you’ll wanna upload it “private” then publish it when it finally notices the whole VR thing.

Tentacles in VR?

So all this was exciting and fun, and 2016 is surely going to be the year of Virtual Reality. Not so much coz cheap bit of plastic can turn your phone into a barely-useable VR headset, but more because of the release of the Oculus Rift and similar things all slated to arrive in the first half ot this year.

So should I do a Virtual-Reality cut of my next cartoon?

I’m currently thinking yes, and pondering questions like:

Should you “be” a character in the film, should you be embodied with arms and a torso to look down upon? From watching movies existing online so far, there can be a pretty powerful sense of inclusion in a scene when that happens compared to the disembodied floating feeling of not existing.

How do camera-fades and panning and zooming and all the other tricks of the trade work when your audience is able to turn around, to see behind them?

Often currently characters don’t get animated when the camera isn’t pointing at them. Why would they? Working in VR is going to mean everything needs animation data for every frame, and you can’t sneakily make them move impossibly fast etc. when the camera’s not looking at them.

So looking forward to experimenting with that very much.

It’ll be months and months before my first VR movie though. Have to finish Drunk Man before I can even start, and my wrists are playing up again lately so probably can’t work too hard.

Good luck, do tweet me any scenes you make 🙂

* – For what it’s worth, I don’t particularly recommend that one. I had no idea what was good or bad when I added that one to my wishlist. I think being plastic over cardboard is good, but you want one with a trigger/button on it as well as just the case and lenses. I’ve ordered a bluetooth remote for the button-press, but probably one on the headset would be better.

Leave a Reply