how to to obtain shadow volume every certain amount of frames?

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
Noiecity
Posts: 163
Joined: Wed Aug 23, 2023 7:22 pm
Contact:

how to to obtain shadow volume every certain amount of frames?

Post by Noiecity »

is there any way to obtain shadow volume every certain amount of frames? for example, that every 5 frames recalculates the position, but that maintains the visual effect, that is to say, that when deactivating still remains the visual effect of the shadow.

It can be with shadow volume or xeffects, I would like to confirm the performance improvement if I do this.
:mrgreen: :mrgreen:
**
If you are looking for people with whom to develop your game, even to try functionalities, I can help you, free. CC0 man.

Image
**
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: how to to obtain shadow volume every certain amount of frames?

Post by CuteAlien »

Ouf, there's maybe some messed up tricks involving lightmanager and finding and removing and adding back the CShadowVolumeSceneNode, but if this is just for a profiling test I'd just modify the engine.

Like add a frame counter in CMeshSceneNode and then check that in CMeshSceneNode::render() before the updateShadowVolumes call. Or in CAnimatedMeshSceneNode.

If it's a feature you really need we can add some function to either IMeshSceneNode or IShadowVolumeSceneNode which tells nodes to update/not update their shadow volume (then you'd have to do it manually which is likely fine).

Or maybe some other hack might work: After addShadowVolumeSceneNode grab() it yourself and then remove it from the node. I think it keeps access to the Mesh. So now you have full control. You can call updateShadowVolumes whenever you want. But you have to call OnRegisterSceneNode() for it (every frame) and you have to set position, rotation manually to the old parent position,rotation (as it's no longer a child now - also every frame).

Maybe there are more options, don't know :)
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
Noiecity
Posts: 163
Joined: Wed Aug 23, 2023 7:22 pm
Contact:

Re: how to to obtain shadow volume every certain amount of frames?

Post by Noiecity »

CuteAlien wrote: Wed Nov 06, 2024 5:41 pm Ouf, there's maybe some messed up tricks involving lightmanager and finding and removing and adding back the CShadowVolumeSceneNode, but if this is just for a profiling test I'd just modify the engine.

Like add a frame counter in CMeshSceneNode and then check that in CMeshSceneNode::render() before the updateShadowVolumes call. Or in CAnimatedMeshSceneNode.

If it's a feature you really need we can add some function to either IMeshSceneNode or IShadowVolumeSceneNode which tells nodes to update/not update their shadow volume (then you'd have to do it manually which is likely fine).

Or maybe some other hack might work: After addShadowVolumeSceneNode grab() it yourself and then remove it from the node. I think it keeps access to the Mesh. So now you have full control. You can call updateShadowVolumes whenever you want. But you have to call OnRegisterSceneNode() for it (every frame) and you have to set position, rotation manually to the old parent position,rotation (as it's no longer a child now - also every frame).

Maybe there are more options, don't know :)
Please add it mr. CuteAlien! I would be very grateful, I've been trying many things, but I can't do without the irrlicht shadow volume, if you could set this up it would be perfect! :mrgreen:
**
If you are looking for people with whom to develop your game, even to try functionalities, I can help you, free. CC0 man.

Image
**
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: how to to obtain shadow volume every certain amount of frames?

Post by CuteAlien »

OK, with svn trunk r6671 you have now IShadowVolumeSceneNode::setFreeze which has 3 options (don't freeze, freeze after update, freeze current shadow volumes). If you want more complex behavior, like update only every x frames, you have to do your own counter to freeze/unfreeze correspondingly.

To access the IShadowVolumeSceneNode either remember it when calling addShadowVolumeSceneNode or search all the children of your node for those with type ESNT_SHADOW_VOLUME.
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
Noiecity
Posts: 163
Joined: Wed Aug 23, 2023 7:22 pm
Contact:

Re: how to to obtain shadow volume every certain amount of frames?

Post by Noiecity »

CuteAlien wrote: Wed Nov 06, 2024 11:09 pm OK, with svn trunk r6671 you have now IShadowVolumeSceneNode::setFreeze which has 3 options (don't freeze, freeze after update, freeze current shadow volumes). If you want more complex behavior, like update only every x frames, you have to do your own counter to freeze/unfreeze correspondingly.

To access the IShadowVolumeSceneNode either remember it when calling addShadowVolumeSceneNode or search all the children of your node for those with type ESNT_SHADOW_VOLUME.
Thank you! thank you very much! I hope to put it into practice soon, it's for a scenario I'm making, it's a rocky dungeon with a dirt floor, I have an orc and a goblin, I plan to make a mini test with the robot and show it here soon :mrgreen: :mrgreen:
**
If you are looking for people with whom to develop your game, even to try functionalities, I can help you, free. CC0 man.

Image
**
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: how to to obtain shadow volume every certain amount of frames?

Post by CuteAlien »

No problem :-) I think it's actually a quite useful feature.
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