Model Loading / Deferred Rendering
609
1
Advertisement
Those two concepts don't necessarily have much in common, other than the fact that I've finished one and started another since my last journal entry.
I'm fairly pleased with the model loading. At first I was just loading models in the Milkshape3D format, which due to the way the format is optimized for, well, Milkshape itself, the processing I had to do ended up being a little sluggish. It took almost 3 seconds to process a model with around 12k vertices. That was ok for awhile, but has been on my list of things to rework for awhile now. The direction I took with fixing this up was to make up my own file format that would sacrifice a little storage space for extremely quick load times. I wanted something that would pretty much come straight from disk into vertex and index buffers with as little processing as possible. Following is a spec of the format in its current iteration:
Its really simple and basic and doesn't have many of the bells and whistles other formats may have like bones or animations, but adding those in shouldn't be too hard, and is something I think will help me better understand skeletal animation in the long run. I've also written a Milkshape plugin to export models into my custom format here, which was a fun and learning experience. And for the results, that same model it took my ms3d loader over 3 seconds to load now loads in less than 200 milliseconds, a huge difference. This will come in handy down the road when I want to load models in on the fly. After all this, I have a complete pipeline for creating models and resources in Milkshape and efficiently loading them into my engine.
On to deferred rendering. I'm not as pleased with my progress on this as my model loading, but I think I have a pretty good start. I won't even try to explain many of the details of deferred rendering here, other people have already done a much better job explaining it than I probably could. The point where I am with it, I'm calling 1/3 of the way done since I've gotten the first of three steps finished and working correctly, creating what's called the g-buffer or geometry buffer. I'm not on my dev pc at home or else I'd post some psychedelic looking screenshots of the separated components of the g-buffer. Overall my existing forward renderer was easily adapted to deferred rendering without too many major structural changes. Hopefully I will find some motivation this weekend to get this project to 2/3 of the way finished.
I'm fairly pleased with the model loading. At first I was just loading models in the Milkshape3D format, which due to the way the format is optimized for, well, Milkshape itself, the processing I had to do ended up being a little sluggish. It took almost 3 seconds to process a model with around 12k vertices. That was ok for awhile, but has been on my list of things to rework for awhile now. The direction I took with fixing this up was to make up my own file format that would sacrifice a little storage space for extremely quick load times. I wanted something that would pretty much come straight from disk into vertex and index buffers with as little processing as possible. Following is a spec of the format in its current iteration:
UINT version;
UINT nameLen;
char[] name;
UINT numMaterial;
Material {
short Index;
char name[32];
float ambient[4];
float diffuse[4];
float specular[4];
float emissive[4];
float shininess;
float transparency;
char mode;
char texture[128];
char alphamap[128];
}
UINT numMeshes
Mesh {
UINT nameLen;
char[] name;
UINT materialId;
UINT vertexLen;
VertexPositionTextureNormal[] vertices;
UINT indexLen;
short[] indices;
}
Its really simple and basic and doesn't have many of the bells and whistles other formats may have like bones or animations, but adding those in shouldn't be too hard, and is something I think will help me better understand skeletal animation in the long run. I've also written a Milkshape plugin to export models into my custom format here, which was a fun and learning experience. And for the results, that same model it took my ms3d loader over 3 seconds to load now loads in less than 200 milliseconds, a huge difference. This will come in handy down the road when I want to load models in on the fly. After all this, I have a complete pipeline for creating models and resources in Milkshape and efficiently loading them into my engine.
On to deferred rendering. I'm not as pleased with my progress on this as my model loading, but I think I have a pretty good start. I won't even try to explain many of the details of deferred rendering here, other people have already done a much better job explaining it than I probably could. The point where I am with it, I'm calling 1/3 of the way done since I've gotten the first of three steps finished and working correctly, creating what's called the g-buffer or geometry buffer. I'm not on my dev pc at home or else I'd post some psychedelic looking screenshots of the separated components of the g-buffer. Overall my existing forward renderer was easily adapted to deferred rendering without too many major structural changes. Hopefully I will find some motivation this weekend to get this project to 2/3 of the way finished.
Advertisement
Advertisement
Advertisement
Discussion