Arkwood’s prodding finger. He had a gold crown upon his greasy mop. ‘Build me a palace!’
Well, as it so happens, I can. For Blender, the 3D creation suite, makes building virtual rooms a cinch.
You can start off with a cube and squash its Location, Rotation and Scale down to a wall, or ceiling, or floor. Flatpack assembly, really.
Next, I added some Material and Texture to the ceiling. A nice wood panelling. GIMP, the image manipulation program, has a nice feature that allows us to tile a material before bringing it into Blender.
And once in Blender we can adjust the UV Vertex X Y coordinates to create further image tiling.
With the virtual room complete in Blender, I export it as a Wavefront .obj file. Next, I import the .obj file into my C++ Microsoft Visual Studio application, ready to render it to the Oculus Rift virtual reality headset with the aid of OpenGL graphics library and the Oculus SDK for Windows.
Of course, I could have reduced the scale of the room in Blender and scaled it up in OpenGL. Either way, we are getting an entire room loaded into OpenGL using only one .obj file. And since the meshes are all simple cuboids – for the ceiling, walls and floor – there’s few vertices to handle.
Nice. I add a bit of collision detection to the walls so as not to stroll through them and into the blackness of nothingness. Sure, the wallpaper is not perfectly spaced, and the carpet is a bit pixelated, but nothing that can’t be improved upon.
Blender has provided a superb way to visualise the building of a virtual room. Not only that, Blender will export the normals for the vertices, which will come in handy when creating realistic lighting for the room.
‘It’s not a palace or a castle for His Excellency,’ I told Arkwood, ‘but it is the most luxurious of living quarters!’
Arkwood sniffed. ‘Ditch the carpet, it’s too itchy.’