Can we force a material to not render?

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
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Can we force a material to not render?

Post by christianclavet »

Hi. I would like to select material in a model and force it to (display/hide). Preferably to not render.

I would like to create a RPG type character will all the equipments (weapons and clothes) that the character would wear in the game. Skin all of theses equipments and save the character with all the equipment visible.

Once in Irrlicht, I would create a GUI to "browse" thru the material, assign them an id with the equipment that it can wear. So for this to work, I would have to disable rendering for all material in the model and only keep the one that the character wear. I've checked the SMATERIAL reference but I don't see things like "isVisible(), setVisible()".

Can this be done in another way?

The only other way I am thinking if this is not supported at all, is to export each equipment separately skinned with the whole skeleton, load the equipment, and animate it at the same time of the main character while also keeping the position/rotation the same. Would mean animate at least 5 characters for a single one (Could have sync issue, where the equipment is not moving with the character). Disabling rendering for selected material would be more efficient.
Last edited by christianclavet on Sun Sep 07, 2014 2:15 am, edited 1 time in total.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Can we force a material to not render?

Post by hendu »

Equipment is usually done by attaching it to a bone. Hat to head bone, armor to chest bone, etc etc.
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Re: Can we force a material to not render?

Post by christianclavet »

Thank Hendu.

And if the character is bending the torso or for example wearing a cape, robe, pants, etc.? This method for me is only good for attaching weapons and helmets. Attaching clothes will not work because the item will need to deform. For this each cloth equipment need to be skinned to the character bones, and I need a way to display/hide them depending on what the active wear of the character is.

I edited the first post, to mention that equipment are weapons and clothes. I think that only wrote "equipment" could bring the subject to confusion
Last edited by christianclavet on Sun Sep 07, 2014 2:16 am, edited 1 time in total.
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Can we force a material to not render?

Post by mongoose7 »

Material.MaterialType = -1
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Re: Can we force a material to not render?

Post by christianclavet »

Ha! Thanks Mongoose7! I was checking the source in CAnimatedMeshSceneNode on how it was rendering the meshbuffers.

I will have to test this, this seem logical since there is no enum for -1. If it doesn't work, I will have to try a patch on Irrlicht to create a new material type that doesn't render at all. So adding a new enum in the material types, and checking in the render() function of CAnimatedMeshSceneNode where I could put a condition to don't render the meshbuffer.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Can we force a material to not render?

Post by hendu »

That seems to be a lot of animator work. Me, being lazy, would probably make Bullet do the cloth deforming for capes, shirts, and so on.

I also remember reading a siggraph paper on fast cloth folding.
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Re: Can we force a material to not render?

Post by christianclavet »

Hi, We can apply physic in Blender/3DS Max on a bone chain and then on a press of a button, we can bake that into the animation. But not sure I would do this for clothes. Perhaps, only if the character would have really long hairs.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Can we force a material to not render?

Post by hendu »

Wouldn't that be static, if baked? The user would notice the repetition soon, while real deforming would react to new situations. For example, hanging upside down, wind, etc.
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Re: Can we force a material to not render?

Post by christianclavet »

Yes, theses would not affect, since they would be baked. There are some compromises to be taken and that depend on the type of game you want to do.
chronologicaldot
Competition winner
Posts: 688
Joined: Mon Sep 10, 2012 8:51 am

Re: Can we force a material to not render?

Post by chronologicaldot »

I think you could do it with IMaterialRenderer. Store the material to be rendered, and if it is not "active", replace it temporarily with an invisible material.
Post Reply