raylib – upcoming changes to wavefront OBJ loading

For most models things are kept simple, just one material with a texture, job done – lets get this out the door! however especially if you want a good looking low poly style, then just one material just doesn’t cut it. Take a look at an example model from the highly recommended kenney.nl

The first thing I should point out that this model is completely untextured. This is because you can define materials that have simple colour definitions only, in this case for example the triangles in the white stripe on the barrels are given a diffuse colour of white. Looking at the same model with just one material and you can see its just a whole lot less interesting.

I suppose you could make a texture for this, but unwrapping the whole model and applying a single texture is both tricky and time consuming, Rather easier just to select a bunch of triangles and assign a simple material to them (this can be done very easily from blender)

This has further implications though, as the OBJ now has multiple materials (the OBJ is split into several sub meshes 1 per material) You could have multiple textures per OBJ, wrapping a hand full of triangles in blender is really straight forward, much easier than wrapping a whole object (try wrapping a ball in a single sheet of paper so the paper is flat and undistorted on the ball and you’ll see what I mean!!)

While to be honest the changes I had to make to the code where not trivial, this is the type of change I do like – that most people just won’t notice, things will just keep on working the same! However if you know about the changes you can really take advantage of them!


Leave a Reply

Your email address will not be published.