Hello people. I have been playing with this engine, and I think it is veeery cool. I am a Blitz3D user, and I must say I miss some things in IrrLicht.
The way in which IrrLicht handles multitexturing and texture effect (mainly thorugh the ISceneNode::setMaterialType() method) is pretty limited. I think a few changes would be cool to make it much more flexible. I am used to Blitz3D, and I think that the way it handles materials is very logic. I'll explain it, cos I think this would give Niko some nice ideas
Currently, you define the effects and blend modes at material level. It should be possible to define them at texture level. This would require some changes and maybe a compatibility break, but would improve the whole thing a lot:
In Blitz, a SceneNode (called Entities) can have 3 blend modes: Alpha, modulated and additive. They set the way in which the SceneNode is rendered over the scene.
- Alpha is the default mode. It renders the SceneNode with transparency based on its vertex alpha values, texture alpha map (only if the alphamap flag is enabled on the texture) and SceneNode alpha setting (by default it is 1.0, which means that the SceneNode will be opaque, unless it has alpha on some vertices or a texture with alphamap enabled).
- Modulated is the same is the same as the EMT_LIGHTMAP IrrLicht type, it simply multiplies the SceneNode with the scene.
- Additive is the same as the EMT_TRANSPARENT_ADD_COLOR, it adds the SceneNode to the scene.
But, Blitz3D also has flags and blend modes for the textures. You can set a texture as a spheremap, or a masked texture (the corkey will be invisible), or an alpha map (if the texture format supports alpha, like PNG or TGA, use this as an alpha map; if not, uses the RGB values as an alpha map, the lower the values, the more transparent the texture). You can also define how this texture will be blended with the previous one in a material, this way:
Alpha - If the texture has the alpha flag enabled, it is blended with alpha with the layer below this one. If the texture does not have an alphamap, texture layers below one with this texture won't be shown.
Multiply (default) - Pixels of this texture will be multiplied with the ones in the layer below it (the lightmap effect).
Add - Pixels in this texture will be added to the pixels in the texture below.
I think a similar working in IrrLicht would be REALLY cool, cos this way is much much more flexible than the way in which IrrLicht does it currently
Also, more than two texture layers for each material would be cool, and the ability to have more than one set of texture coordinates for each vertex of a mesh, and a method in the ITexture class to define which set index will the texture use (for example, a mesh would have two sets of texture coordinates. A diffuse texture should use the first set of coordinates, but a lightmap textures should use a second set of UV coordinates, cos it has to be mapped in a different way).
Thanks for reading this long post, and keep up the good work!
First impressions about material types
Thanks for your suggestions. I haven't looked at Bliz3D yet, sounds very flexible. The way Irrlicht currently handles materials is not optimal, that right. I'd like to change it someday, and I've looked at how other engines are doing this, there are lots of different approaches. What I want is to get away from this unsafe SMaterial struct, I'd like a material to be represented by an abstract class, which draws the geometry optimized for every Renderer. I've some detailed plans for this, providing even a similar interface like the current SMaterial approach, but I still need some time before I'll start to implement it.