During the development of my little game I had to code some things (crazy eh)
and maybe some of them might come in handy for other coders so here they are.
First thing first, I had those slowdowns when I drew some animated skin meshes
(luckily I didn't know at that moment I probably used a debug version of Irrlicht)
so I decided to make a hardware version for animated skin meshes.
That actually took quite some time and a big thanks goes to Blindside
who actually gave me a working example of how to do it!
I added blending and the possibility to use up to about ~75 bones.
You can also add a fragment shader and uncomment some lines in
the shaders to have your Tangents and Binormals calculated too.
Just don't forget to use that mesh->convertMeshToTangents(); on the skinmesh
before (and only once and not after midnight, otherwise the Normals and everything will go crazy).
Here is a pack including a MSVC project and a test executable (DirectX) that does animation 'blending'.
So life was shiny right?
I added 4 textures (this is really easy) bringing up the max number of textures to 8:
just change
Code: Select all
#define _IRR_MATERIAL_MAX_TEXTURES_ 4
Code: Select all
#define _IRR_MATERIAL_MAX_TEXTURES_ 8
include/IrrCompileConfig.h
in your downloaded Irrlicht and recompile it.
Or download the "8 texture patch" (right click and do 'save as') and apply it (should at least work on versions 1.7.x)
I now had 8 textures so I made a terrain splat shader (thanks Nadro for the help on that one!)
Everything went fine except one day something just choked and the framerate dropped
form 'very ok' to 'slightly crawling' as soon as I had 3-4 terrains on screen...
The Irrlicht terrain actually optimizes the mesh each frame and thus it have to:
a: calculate a lot of things, like all vertices and normals, each frame!
b: send it all to the gpu
So I wrote this 'simple terrain' which works like the Irrlich one but doesn't 'optimize' anything, it just
creates a mesh and chucks it over once to the gpu (it uses VBO) and the framerate was up again.
Simple Terrain MSVC project + executable + splat shader
So what happened next?
I decided to do colissions 'the old way' (no physics) and the framerate dropped so badly I actually expected something was broken ...
only a handful of items and I didn't get over 10fps...
Nothing was broken but a code snippet was missing in the selection of triangles (it always returned all triangles)
so here is the patch for that one:
Triselector Patch works on version 1.7.2 (right click and do 'save as')
As I already had my hands full of Irrlicht core-oil I added support for CubeMaps:
Here's the CubeMap Patch again for 1.7.2 and DX only (right click and do 'save as').
It is really easy to use but for the heck of it, here is another MSVC project (with executable) to show a flaming skybox in the euh sky...
Cubemap skybox MSVC project + executable
++
Valmond