An Isometric 3D Engine
Posted: Sat Sep 20, 2014 7:53 pm
I usually don't post demos and experiments here. But this was so much fun todo, that I want to share it.
I always thought Isometric 2d graphics were strangely compelling. The simplicity and the slightly artificial look really appealed to me.
I especially like the look of early PS1 games which had an isomtric perspective, bute the camera could be freely rotated, for example Final Fantasy Tactics or Breath of Fire III/IV.
I wanted to recreate this look, which is somewhere between 2d and 3d. Since the arrival of meshes an image can be easily transformed into an isometric view so I thought I'll give it a try.
It took me several tries to get it right. After I realized there's no way around some math, I did read up on some stuff and learned a lot in the process. I didn't use shaders, because I sometimes code on my netbook, which doesn't support them, so this is just using löve's meshes
It can load an .obj model. You have to specify the texture though, as it ignores .mtl*s.
Oh and don't expect much from the obj importer, it's really rushed. Yiou have to trianglute your mesh first. Also make sure your faces are in "vertex/uv/normal" format in the obj format.
So this is by no means a complete 3d engine as it comes with a lot of limitations:
[*] Only one parallel light source (currently hard coded), no soft shading (could probably be done, if I get to wrap my mind around)
[*] Pretty low vertex count. This example has about 370 triangles and renders with about 110 FPS on my netbook, so you could still go a little higher but not much because....
[*] No Z-Buffer: Depth Sorting is the bottleneck here, this is what limits the amount of vertices.
[*] Only one texture per mesh. This is a love mesh restriction.
Probalby many more. Still it succeeds to recreate the look and feel of what I was trying to achieve. Feel free to poke around in the code. I tried to annotate as much as possible.
Just wanted this to share and get some feedback. I might continue with this for a little longer.
UPDATE
* Added smooth shading.
I always thought Isometric 2d graphics were strangely compelling. The simplicity and the slightly artificial look really appealed to me.
I especially like the look of early PS1 games which had an isomtric perspective, bute the camera could be freely rotated, for example Final Fantasy Tactics or Breath of Fire III/IV.
I wanted to recreate this look, which is somewhere between 2d and 3d. Since the arrival of meshes an image can be easily transformed into an isometric view so I thought I'll give it a try.
It took me several tries to get it right. After I realized there's no way around some math, I did read up on some stuff and learned a lot in the process. I didn't use shaders, because I sometimes code on my netbook, which doesn't support them, so this is just using löve's meshes
It can load an .obj model. You have to specify the texture though, as it ignores .mtl*s.
Oh and don't expect much from the obj importer, it's really rushed. Yiou have to trianglute your mesh first. Also make sure your faces are in "vertex/uv/normal" format in the obj format.
So this is by no means a complete 3d engine as it comes with a lot of limitations:
[*] Only one parallel light source (currently hard coded), no soft shading (could probably be done, if I get to wrap my mind around)
[*] Pretty low vertex count. This example has about 370 triangles and renders with about 110 FPS on my netbook, so you could still go a little higher but not much because....
[*] No Z-Buffer: Depth Sorting is the bottleneck here, this is what limits the amount of vertices.
[*] Only one texture per mesh. This is a love mesh restriction.
Probalby many more. Still it succeeds to recreate the look and feel of what I was trying to achieve. Feel free to poke around in the code. I tried to annotate as much as possible.
Just wanted this to share and get some feedback. I might continue with this for a little longer.
UPDATE
* Added smooth shading.