hide texture

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
aiman
Posts: 19
Joined: Thu Nov 06, 2014 5:04 pm

hide texture

Post by aiman »

how to make texture invisible
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: hide texture

Post by mongoose7 »

I guess you mean, how to make a meshbuffer invisible. It would be nice if you could set the MaterialType to some invalid value, but I think this draws the meshbuffer black and probably writes to the depth buffer. So I think the only way is to write a do-nothing pixel shader. Like

Code: Select all

main() { discard; }
aiman
Posts: 19
Joined: Thu Nov 06, 2014 5:04 pm

Re: hide texture

Post by aiman »

i have a cube ,i put a texture on it, I need this texture to be sometimes visible and invisible in other times (when the texture is invisible,the cube must still visible)
vivekSivamRP
Posts: 66
Joined: Sat Sep 29, 2012 11:58 am

Re: hide texture

Post by vivekSivamRP »

Use 2 shaders, one that use the cube's texture, other use some other colour to render the cube.
Change the shader of the cube whenever you need.
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: hide texture

Post by CuteAlien »

Easiest solution - replace the texture in the SMaterial by another. Slightly more complicated - as long as each side of your cube has it's own vertices you can change the vertex-alpha values with IMeshManiputator::setVertexColorAlpha as long as the material type is one that supports vertex alpha values, like EMT_TRANSPARENT_ADD_COLOR.

Shaders are another solution.
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
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: hide texture

Post by mongoose7 »

TRANSPARENT_ADD_COLOR doesn't use transparency at all. Pehaps you mean TRANSPARENT_VERTEX_ALPHA?
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: hide texture

Post by CuteAlien »

EMT_TRANSPARENT_ADD_COLOR also uses vertex alpha. EMT_TRANSPARENT_VERTEX_ALPHA works as well.
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