Cinema 4D to Unity to Oculus Rift Quickstart

Photo of Donovan Keith

Instructor Donovan Keith

Share this video
  • Duration: 09:31
  • Views: 18155
  • Made with Release: 17
  • Works with Release: 17 and greater

Explore Cinema 4D projects in Virtual Reality using the Oculus Rift Headset and the Unity Game Engine

Quickly go through the process of exporting Cinema 4D project files to the Oculus Rift by way of the Unity Game Engine.


Tools Used



Process


  1. Ensure that your Oculus Rift is setup and working (Setup Instructions).
    • Note: You'll save yourself a lot of headache by first verifying your machine meets the incredibly specific and ambitious system requirements. But in short: you should be using a state of the art desktop PC. Macs and Laptops need not apply - unless you want to spend hours/days troubleshooting for lackluster results.

  2. Create a new Unity Project File. Be sure to include the Character assets.

  3. Export from C4D as FBX using CV-Smart Export.

  4. Import Models into a Unity scene.

  5. Make your objects static.

  6. Add Mesh Colliders to your floor.

  7. Add an FPS Rigid Body character to your scene.

  8. Enable VR in your Player Settings (Recommended Unity Build Settings for Oculus Rift)

  9. Press "Play"

Addendum


Unity is a quickly evolving application as is the Oculus Rift SDK.



  • My textures aren't showing up in Unity. Why not?!
    In 2017.2 Unity changed the way that they handle texture imports, and especially
    texture embeds.



    1. In Cinema 4D, ensure that you have "Textures and Materials" and "Embed
      Textures" checked in the FBX Export settings.

    2. In Unity, select the FBX file you're importing.

    3. Then, in the Inspector, click on the Materials tab.

    4. Click on Extract Textures and navigate to your textures folder, if your
      don't have one, I recommend creating a folder named Textures in the Assets
      folder.

    5. Click on Extract Materials and navigate to your materials folder, if your
      don't have one, I recommend creating a folder named Materials in the Assets
      folder.


    Thanks to Ryan Vincent for pointing out this issue.



Less...

Transcript

- Hi. I'm Donovan Keith, and in this video, I'm going to show you how to take a Cinema 4D project file and get it into the Oculus Rift. We're going to do this using Cinema 4D, the CV Smart Export plugin, the Unity 3D game engine, and your Oculus Rift. Now, I'm making a few assumptions for this video. One, you've got your Oculus Rift installed and working, and you can verify that that's happened by going into your task manager here and opening up your Oculus configuration utility. You should see that your Oculus Rift DK2 is ready, and when you choose Show Demo Scene, when you move your Oculus Rift headset around, the demo scene updates. Now, if that is not working for you, I feel pretty badly for you because it's a bit of a bear to get it all set up and working. You're just going to have to do a lot of Googling and troubleshooting to get this up and running. Next, I'm also assuming that you've got a recent version of Unity. I'm on Unity 5.3.1 and I recommend just downloading the latest version of Unity, your latest Oculus drivers, your latest graphic card drivers, and that's a pretty good starting point for moving forward. Now, all of that having been done, let's go ahead and create a new Unity project file. And I'm starting in Unity because that's our final destination really. And in Unity, I'm going to name this project, "Farm VR." And I'm going to navigate to a folder on my desktop. I recommend someplace that a little more permanent in nature for you. And I'm going to go to my Farm VR folder, which I've already created, and you'll notice a C4D file, and that contains my Cinema 4D project. Now, I'm going to save this Unity project as "Farm VR" inside of here. So, I'm going to choose select folder, and I'm going to make sure it's a 3D game. And in my asset packages, I want to select characters, and I'm choosing characters because I want a character that moves around in 3D space as I use my arrow keys. I'm now going to choose Create Project, and while that project is being created, which might take a little bit of time, I'm going to go back into Cinema 4D. Now, in Cinema 4D, I can just save out a C4D file and have that import directly into Unity, but that can sometimes make the update process a little bit slower when you've got a large project file. So, I'm going to use plugins CV Smart Export, and this little gear icon right here. You can get CV Smart Export from Cineversity.com or the CV tool box, and there's a link in the description for how to get access to this. I'm going to export top level objects as files, which means that every one of these objects is going to be exported. I'm going to turn off baking for position and rotation, because I don't have any animation. And in my FBX settings, I'm going to turn off lights, cameras, and splines, and I do that because any extraneous objects that make their way into your FBX file will make it into your game, and it just makes it a little bit more work for you than you'd necessarily want. Having done that, I'm going to choose okay. And my file browser's going to open up, I'm going to navigate to my Farm VR folder, and inside of that is another Farm VR folder. This is my Unity project. Now, inside of there, Unity has automatically created an assets folder, and inside of that assets folder, I'm going to create a folder called "Models." We'll rename that. And my Models folder is going to contain all of my models, and I'm going to group them by the scene. So, this is my farm. Inside of my Farm folder, I now save this as "Farm." Now CV Smart Export is going to save out a bunch of versions of this file, Farm_Silo, Farm_House, etc. And when I go back into Unity, we'll notice that it's telling me to hold on, because it is automatically importing these assets. And this is really sort of making the case for why you want to export those top level objects separately, because if you had to go through this import process and it taking this long every single time you updated your scene, you'd never get anywhere. Better to just change the one object and re-export that one object as needed. All right. In my models here, I now have that farm folder that I created, and inside of here, I have a number of different previews of my model. So, I'm just going to select the first one, hold down Shift to select all of them, and then drag them directly into my hierarchy window here. And as I navigate around with the Alt button clicked and dragging, I see I've got a really gorgeous looking scene. It's a really nice-looking preview that Unity gives you. And this is all happening as a result of Unity's real time global illumination system and shading. Now, to get even better results, what I want to do is select all of my objects here, and I'm going to turn them into static objects, and that's going to allow Unity to bake their lighting. Now as this is happening, you can sort of chart the progress of the baking down here in the lower right, I can start adding in some other elements. So, I want to bring in my character. So, I'm going to go to standard assets, characters, first person character, and then inside of prefabs here, we'll see rigid body FPS. So, this is for a first person shooter. But basically, this is just a character that allows me to walk around my scene. I'm going to zero out its position and its rotation. Now, as I look at my scene, we see that it's now showing up right here near my home, and in order to get this to interact with the floor appropriately, I want to select this floor or this terrain, and I am going to add a component, and I'm going to add a mesh collider. And you can get that just by typing in "mesh," and it's going to be one of the first things that comes up. This is basically equivalent to Cinema 4D's rigid body dynamic system. Now with that in place, I can press play, and I have a character that I can navigate around my scene. Now, it's not coming through my Oculus Rift just yet, and that's because there are a few settings we need to tweak. So, I'm going to hit the escape key so I can see my cursor and press on this play button to end my demo of the game. Now to set this up for VR, I go to edit, project settings, and choose player. Now that I've got player selected, I can go into this other setting, this tab, and inside of other settings is a virtual reality supported check box. That's going to tell Unity to export to the Oculus. Now that that's there, I want to adjust my quality settings. So edit, project settings, quality. And once there, I want to select good, which is what I think the default is for the Oculus, and I'm going to change my anti-aliasing from disabled to, at a minimum, two times multi-sampling, which will start to anti-alias things or more ideally, four times multi-sampling, and you really want to have AA on with your VR work, because the flickering lines can really make you sick, especially if it's different in left and right eyes. All right. With those settings in effect, if I press play now, I'll notice the tally light for my Oculus Rift head tracker turns on, and I can now put on my rift, look around. I'm going to get my health and safety warning, so I can just press a key on my keyboard. And notice that I'm jumping, and now I can move my character around, and I'm going to move into the direction that I'm looking. But as I move this character, I'm already starting to feel a little bit seasick, and that's because it's moving so fast. So, there's a few more settings we're going to tweak here. So I'm again, going to hit escape, press play right here, and now I want to click on my rigid body FPS controller. And inside of here are my movement settings. The forward speed is eight. I'm going to set that down to one. My backward speed is four. I'm going to set that down to one. And my strafe speed is my left, right., also going to be one. And my run multiplier is two. I guess that is quite all right. And now with that set, I can use my arrow keys to navigate around this scene, and use my head to just sort of look around, see what's going on, and also use that to navigate. Now you see I'm approaching the fence, and one of the cool things about the Oculus Rift over something like the Gear VR is that it has, what's called positional tracking. That means I can just move my torso, move my head and it's going to allow me to get a different perspective on this scene without having to use my arrow keys on my keyboard. And there you have it. You're now exploring a Cinema 4D project in virtual reality. To do that again, remember create a new Unity project file. Make sure that you're bringing in your characters as you do that. Export your project file out of Cinema 4D as an FBX, import that into Unity, add a rigid body FPS player controller, and then in your player settings for your build, make sure that you turn on virtual reality, some anti-aliasing, and you probably want to add in some rigid body collisions with your floor. Last but not least, you may want to tweak your player's speed, and then you should be good to go in the Oculus Rift.
Resume Auto-Scroll?