Beginner using Blender (with DirectX). Have a couple questions regarding best practices

Hey,

I’ve been building a game engine in DirectX and am now at the point where I am looking to bring in external models I’ve made, or will make, in Blender. I’m unsure at the moment though what the best practices are in relation to how to setup my models.

As a bit of background, I’ve currently added the functionality to my engine to read in and render .obj files, with the option of mapping a texture over them (to add colour). Currently, I haven’t set it up to read in materials, and thus add color to the model that way (i.e. through diffuse lighting color).

My main query at the moment relates to how to best incorporate colors in a model with the intention of exporting and importing into my DX engine. For example, I have one model that consists of 6 different objects. If each of these needed to be a different color, should I be looking to assign a material to each one, adjusting the diffuse lighting color for each, and then read the model as 6 separate meshes in DirectX? Or is it preferable to combine the separate objects (all connected in space) into one, and create a texture that will correctly map the various colors to the object?

As a note, at this stage I am only considering basic colors that could be set by adjusting the diffuse lighting color (rather than more complicated coloring that might be better suited to using a texture).

Wow - you’re building your own game engine from scratch. That’s very impressive. Completely outside the knowledge of myself and most other people here. Welcome aboard!

I think it might be worth knowing the kind of game you’re going for - and the art style.
My first thought before I got to the end of your post was - “obj… that won’t allow for skeletal animation - surely FBX would be better”…

If you’re going for a simple block coloured look, then you can use a texture that looks like this…

and then you can just have the one material per object.

Thanks for the reply. I’ve been playing around with UV mapping in directX, and managed to get something going by assigning objects a new single color texture before unwrapping. Your solution is probably a bit cleaner though for what I’m working with at the moment (only need one image texture). Will give it a go.

Good tip also re. using FBX format. I’m pretty new to this and haven’t yet dealt with animations, so not super familiar with the different formats. Could just be that I’ll write a new file parser for .fbx files if animation is involved. Good to know though!

I only have vague plans for how the final game will work/look at this stage; mainly because learning to make a game engine is a big part of this so I was keen to get right into it rather than agonizing over the perfect design (and maybe never starting).