If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.


Postby smkzi » Thu Oct 26, 2017 10:14 am


I am just starting out programming with c++, using Irrlicht, and with game development in general. I read some posts on the forums and visited some ancient commits on the sourceforge and github pages, particularly in the shader branch and the trunk. As far as I can tell, instancing is not supported. I am not 100% sure I understand exactly what "instancing" is, but it is apparently very useful for when you want to draw the same model (mesh,texture and material) at multiple locations.

As you can see here: , someone was apparently working on this in the shader branch about 3 years ago. Looking over the source files, the current shader branch, the trunk, my own build and the github linked there, I cannot find this IRR_ARB_INSTANCED_ARRAYS or EVD_INSTANCING anywhere in the source code, though for some reason EVDF_TEXTURE_COMPRESSED_DXT and seemingly IRR_EXT_texture_compression_s3tc survived.

Since I am a complete beginner I do not know how to write shaders (OpenGL) myself, but with geometry/instancing shaders being a solved problem, and as I understand, what is needed to tackle this, I was hoping that one of you experienced developers could aid me? If not... Could you suggest to me another approach?

The reason I am asking is that I am trying to develop a roguelike game with 3D graphics using IrrLicht. The dungeon rooms will be pre-made models/assets that should be placed intelligently to connect to each other and form entire levels. However, I do not want the levels to be too small, and so I might need 10 of that corridor model, 20 of that rectangular room model, and so on. With limited visibility being a planned feature, would it be easier (and comparably efficient) to somehow cull everything outside say, a cylinder or sphere around the player character?

Thank you for reading.
Posts: 1
Joined: Thu Oct 26, 2017 9:54 am

Re: Instancing

Postby CuteAlien » Thu Oct 26, 2017 11:58 am

Yeah, instancing is not supported in Irrlicht so far. I can't tell much about the patch as I was never involved in the shader branch and all it's maintainers are gone, so that branch is currently no longer in development.

Instancing is useful for showing lot of instances of the same model fast. Not sure if it makes really much of a difference with 10 or 20 models - but it's useful once you talk about several thousand instances. I think it's about meshes shown in one screen - so if you have different rooms which are not shown together it's probably not going to make a difference.

What you need is indeed some culling. You get culling of models outside the camera-radius by default in Irrlicht (you can enable/disable that with ISceneNode::setAutomaticCulling). Sometimes it might also help to use an octreescenenode. Or (unfortunately not in Irrlicht to my knowledge) with BSD trees.

It's generally a good idea to write some simple test to get an idea about the numbers involved. For example in ... -micha/src I have a file called profile_meshscenenode.cpp which simply shows huge number of the same mesh. You can replace the mesh in there with your own and just find out how fast/slow it will be. Or profile_pins.cpp in there is a similar test where I tried how much faster it could get if I get rid of the overhead of scenenodes and just draw all meshbuffers in one node (didn't make that much of differnce in this case - but in other situations the speed improvement can be huge). profile_pins.cpp would be one that could profit a lot from instancing I guess.

So you could for example create one simple room in a modeling tool like Blender and then use one of those codes to display it a few thousand times. Then add some more models inside and try again etc - just to get a feeling for that stuff. This is also useful if you want to compare a few engines as it's usually easy to port those few lines to another engine.
IRC: #irrlicht on
Code snippets, patches&stuff:
Free racer created with Irrlicht:
User avatar
Posts: 8466
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany

Return to Beginners Help

Who is online

Users browsing this forum: No registered users and 1 guest