Layer Textures on IBillboardSceneNode

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
dmb
Posts: 9
Joined: Thu Jun 13, 2013 2:07 pm

Layer Textures on IBillboardSceneNode

Post by dmb »

So I've got this IBillboardSceneNode that acts as a base avatar. I want to layer a piece of "clothing" on the avatar with another texture.

When I set the clothing material texture layer to 1, it still only renders the original image. I looked at the API and saw that the setMaterialTexture() calls getMaterialCount() during the for loop, which returns 0. So there only exists one layer.

With code like this:

Code: Select all

IBillboardSceneNode * node3 = smgr->addBillboardSceneNode();
    node3->setMaterialFlag(EMF_LIGHTING, false);
    node3->setMaterialTexture(0,driver->getTexture("C:\\irrlicht-1.8\\media\\newwall3.bmp"));
    node3->setMaterialTexture(1,driver->getTexture("C:\\irrlicht-1.8\\media\\wallcover.bmp"));
I only ever see the original image. Is it a situation where I have to create my own sub-class of ISceneNode and overwrite this, or am I just missing something? Wiki gave me no information either, just showed me how to rotate the single layer.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Layer Textures on IBillboardSceneNode

Post by hendu »

Use a shader.
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Layer Textures on IBillboardSceneNode

Post by Mel »

Use a shader that draws your clothing over your character. The materials that Irrlicht offer only blend the textures, don't draw texture layers one over the other.

Use a shader, read the textures and blend them bottom to top.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
zprg
Competition winner
Posts: 30
Joined: Tue Jul 31, 2012 12:29 pm
Location: Germany

Re: Layer Textures on IBillboardSceneNode

Post by zprg »

to use shaders for it isnt it like breaking a nut with a sledgehammer (or like we say shooting with cannons on sparrows) and you lose hardwareindependence besides?
why not using some prepared textures and if there are too many clothes to store them all in different textures why not creating them with rendertotexture after programstart in a texturearray?
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Layer Textures on IBillboardSceneNode

Post by hendu »

Shooting sparrows with a bazooka is fun ;)

There is very little HW that supports render targets but not shaders.
zprg
Competition winner
Posts: 30
Joined: Tue Jul 31, 2012 12:29 pm
Location: Germany

Re: Layer Textures on IBillboardSceneNode

Post by zprg »

hendu, oops i didnt know
Post Reply