Tags

, , , , , , , , , , , , ,

‘I am a woodlouse!’ Arkwood declared. Metamorphosis. Scurry he does up the bedroom wall. Hard outer shell.

‘Well,’ I replied to the crazy creep, ‘I have just the hovel for you!’

It’s not hard to create a table in Blender, the 3D creation suite:

oculusrift_virtualtable_virtualworld

Green Blender tutorial Blender Modeling – Wood Table was my spirit level.

‘But one thing to note,’ I muttered as I put down pellets to put down Arkwood, ‘is those textures.’

You see, the table has a nice wood texture for each of its four legs and its surface. That’s five times we use the same texture.

Before I render my table into a virtual world – using OpenGL graphics library and the Oculus SDK for Windows – I need to load the exported Blender Wavefront obj file using Assimp (Open Asset Import Library) and the texture image using SOIL (Simple OpenGL Image Library).

Loading an image file for a texture is expensive in processing time, so I don’t want to load the same image five times for my table.

Instead, the Learn OpenGL site suggests a nice optimization to quell this angst.

We simply store our loaded textures in a vector. That way we can check whether our wood image has already loaded for a mesh in the table model, avoiding unnecessary reloads. Less time to wait before pixels flood my Oculus Rift virtual reality headset.

‘Come down from the walls!’ I shouted. But Arkwood scurried under the sofa, ignorant of the crafted furniture. I put down a trail of pellets to bring him to my virtual claws.

Ciao!

Advertisements