how to implement frustum culling on solid mesh?

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.
Post Reply
alko
Posts: 26
Joined: Wed Aug 29, 2018 10:14 am

how to implement frustum culling on solid mesh?

Post by alko »

This is topology of obj-file

Image

how to enable frustum culling on this by visible pyramid ?
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: how to implement frustum culling on solid mesh?

Post by CuteAlien »

Culling is mostly per node. So if it's all one node then it will cull all or nothing. If those are independent nodes, then culling is done with ISceneNode:: setAutomaticCulling which can take any value of E_CULLING_TYPE. The default for meshscenenodes should be EAC_BOX.

If you want culling per polygon you can create an IOctreeSceneNode with ISceneManager::addOctreeSceneNode. Thought it depends a lot on the scene if that makes sense. Basically in such cases you care about the worst case - so if there is any time you can see the whole scene then this will always be a bad idea. If your scene is large enough that you never see everything at once then it can be worth it. But it's done on CPU and you will get then mesh-uploads to GPU each frame. There are use-cases for it, but you should really profile if it's worth it as often it's far better to set the whole mesh to static instead which means it will stay on GPU (IMesh::setHardwareMappingHint).

Another option is to split your scene into more scenenodes. Thought again a thing you have to measure if it's worth it as Irrlicht has a pretty high per-node overhead when drawing. So for culling it can be great (no drawing then), but if your nodes get too small and you get more than say 5000 nodes (depends on system, just throwing out a rough number here) on screen the drawing overhead will start being expensive.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
alko
Posts: 26
Joined: Wed Aug 29, 2018 10:14 am

Re: how to implement frustum culling on solid mesh?

Post by alko »

this is a single node.

camera directon is top-down.
https://vk.com/wall-145919754_766
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: how to implement frustum culling on solid mesh?

Post by CuteAlien »

OK, but still the options I mentioned above is basically what you can do. One more option is writing your own node (or other code) which does decide on it's own which meshbuffers to send to the driver.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply