• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
  • entries
    316
  • comments
    485
  • views
    321135

Oculus Rift + Hieroglyph 3 = Fun!

Sign in to follow this  
Followers 0
Jason Z

835 views

I recently have been adding support to Hieroglyph 3 for the Oculus Rift. This post is going to discuss the process a little bit, and how the design of the Hieroglyph 3 engine ended up providing a hassle free option for adding Rift interaction to an application. Here's the first screen shot of the properly running output rendering:

OculusRiftSample100001.png



I have been an admirer of the Rift for quite some time, and I wanted to find a way to integrate it into some of the sample applications in Hieroglyph. I'll assume most of you are already familiar with the device itself, but when you think about how to integrate it into an engine you are looking at two different aspects: 1) Input from the HMD's sensors, and 2) Output to the HMD's screen. If your engine is modular, it shouldn't be too hard to add a few new options for a camera object and an rendering pass object.

After working on the engine for many years, I was completely not interested in building and maintaining multiple copies of my sample applications just to support a different camera and rendering model. I work pretty much on my own on the engine, and my free time seems to be vanishingly small nowadays, so it is critical to get a solution that would allow for either a runtime decision about standard or HMD rendering, or a compile time decision using a few definitions to conditionally choose the HMD. I'm pretty close to that point, and have a single new application (OculusRiftSample) set up for testing and integration.

Representing the HMD



The first step in getting Rift support was to build a few classes to represent the HMD itself. I am working with the OculusSDK 0.3.2 right now, which provides a C-API for interacting with the device. I basically created one class (RiftManager) that provides very simple RAII style initialization and uninitialization of the API itself, and then one class that would represent the overall HMD (RiftHMD).

RiftHMD is where most of the magic happens with the creation of an HMD object, lifetime management, and data acquisition and conversion to the Hieroglyph objects. The OculusSDK provides its own math types, so a few small conversion and helper functions to get the sensor orientation and some field of view values was necessary. You can check out the class here (header, source).

Getting the Input



Once you have a way to initialize the device and grab some sensor data, the first job is to apply that to an object in your scene that will represent the camera movement of your user. In Hieroglyph 3 this is a accomplished with an IController implementation, called RiftController (header, source). This simple class takes a shared_ptr to a RiftHMD instance, and then reads the orientation and writes it to the entity that it is attached to.

All actors in Hieroglyph are composed of a Node3D and an Entity3D. The node is the core of the object, and the entity is attached to it. This allows for easily composing both local (via the entity) and absolute (via the node) motion of an object. For our Rift based camera, we attach the RiftController to the entity of the Camera actor. This lets you move around with the normal WASD controls, but also look around with the Rift too.

Rendering the Output



Rendering is also quite interesting for the Rift. The DK1 device has a 1280x800 display, but you don't actually render to that object. Instead, you render to off-screen textures (at much higher resolutions) and then the SDK uses these textures as input to a final rendering pass that applies the distortion to your rendered images and maps that to the HMD's display. All of this stuff is nicely encapsulated into a specialized SceneRenderTask object called ViewRift (header, source).

This object creates the needed textures, sets up the state objects and viewports needed for rendering, and also supplies the actual rendering sequence needed for each eye. This construct where a rendering pass is encapsulated into an object has been one of the oldest and best design choices that I have ever made. I can't emphasize it enough - make your rendering code component based and you will be much happier in the long run! All rendering in Hieroglyph is done in these SceneRenderTask objects, which are just bound to the camera during initialization.

The Final Integration



So in the end, integration into an application follows these easy steps:

1. Create a RiftManager and RiftHMD instance.
2. Create the application's window according to the RiftHMD's resolution.
3. Create a RiftController and attach it to the Camera's entity.
4. Create a ViewRift object and bind it to the camera for rendering.
5. Put on the headset and look around :)

It is simple enough to meet my requirements of easy addition to existing samples. I still need to automate the process, but it is ready to go. Now I want to experiment with the device and see what types of new samples I could build that take advantage of the stereo vision capabilities. The device really is as cool as everyone says it is, so go out and give it a shot!

6
Sign in to follow this  
Followers 0


5 Comments


I tried a DK1 recently. I found the display really pixelated and the response time to head movements was really slow. Not sure if this is improved in DK2 or if it was something wrong with the setup.

 

There is a local shop offering demos for £2.50 for half an hour, which I'm sure is entirely illegal and I should probably report them. They were a bunch of total morons and may have had it set up wrong, but I was horribly aware of the three RGB colour rects on each pixel. Turning my head was producing a slow response much like the old VR sets from the '90s.

 

Anyone else found similar?

1

Share this comment


Link to comment

I actually find that the image is obviously pixelated, but I never noticed the sub-pixel color elements.  Regarding the tracking, I found that the response was quick, but that there is a motion blur if you move faster than a threshold amount.  The DK2 is supposed to take care of both of these issues at least to some degree, so it will be interesting to try it out.

 

The DK1 device certainly isn't perfect, but the initial experience was quite striking for me.  The way it makes you go into the scene is quite different from a normal gaming experience.  I think it is mostly due to the complete immersion - you can't see anything else but the game, so it is a much more 'full' notion of being there.  I can't wait to see where it all leads!

1

Share this comment


Link to comment

Absolutely agree re the immersion, apart from the distractions I mentioned. I hope the only solution to the pixelation problem isn't just ramping up the resolution (seems to be the current direction from what I can gather) as the upper limit will stop being anything to do with the Occulus hardware and become bound by the resolution your graphics hardware can render at.

 

They seem to be investing in higher and higher res tech at the moment, which is all fine and dandy, except how is a just-reasonable rig going to provide that HD content quickly enough?

 

Be a shame if you have to have a super-spec PC in order to provide Occulus with sufficiently high resolution input to avoid the pixelation. This I see as a real potential barrier at the moment.

 

Maybe there is some approach they can take to post-process a more normal resolution in hardware prior to display to reduce the pixel artifacts? This is wild speculation on my part here.

2

Share this comment


Link to comment

I completely agree.  The way that they do the rendering now does seem like a form of a work around.  You render to a target, and then they sample that and warp it for the distortion rendering.  It would be significantly more efficient if they used a warping technique and rendered directly to the final distorted image.  This would have similar challenges as paraboloid mapping, but the same solutions would apply - ensuring that your geometry is tessellated properly, and being careful to clip what is behind the view plane.

 

I also think that there are anti-aliasing techniques to be discovered that would work with the warped images.  Who knows though - I'm sure if John Carmack is working on it that he will be on top of the rendering challenges...

0

Share this comment


Link to comment

Indeed, far cleverer people than me well aware of these issues, I'm sure :)

 

Very interesting journal entry by the way, thanks. I'm quite fascinated to see where this new lunge at VR takes us over the next few years.

1

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now