Texture visibility switch

Hello all. Is there way to dynamicly change texture visibility in BGE? Let’s say my mesh has base and secondary texture that i want to be visible only when i need. I was trying to make action changing texture color from 0 to 1 but such action doesn’t work in game and even in preview window. How to do such thing?

a childObject with the second texture with visible and invisble logic

Thank you for advice.

mix rgb by object color

1 Like

Hello Deadalus. Will it be possible to apply “dirt” texture (or any other “overlay” texture) over base texture using such technique? Could you be so kind to explain how exactly achive this with mix RGB?

if you are using upbge, then object color is easier to get.

but all you need to do is mix the textures, then after add another mix rgb with you dirt texture. mix rgb is mostly the same as traditional material texture settings. mix, multiply, overlay, etc. fac is like the slider.

after that, plug into diffuse of a material node, then into output.

repeat for glossy. however, the object color mixer can be reused/branched off.

1 Like

Thank you very much for directing me. I am currently using BGE. It seems this is what i want. If I got it right I can easily “apply” overlay effects like scars, blood or dirt overlays using only fac ‘slider’. I am gonna try this.

with normal bge:

  • Shader material is a normal material. add bumpmaps into this material (select it and texture tab)
  • Material is the material assigned to the object (IMPORTANT) and is shadeless and has object color checked
1 Like

upbge 0.2.0 object color node makes it easy. added an optional greater than to prevent mixing.

1 Like

Ok I done what you say and it’s works. I can control mix value via animating object color. Base texture is mixing with overlay and i get some kind dirt over surface. This is cool feature .
I have question how to make ‘overlay’ texture not to mix with base one but completely ‘replace’ it? I was playing with these nodes but yet didn’t managed to do it. Couldn’t you show me pleeeez. :slight_smile: Here is my example blend - spacebar to activate action:

RGB mix.blend (987.0 KB)

1 Like

Blue nodes are one texture setup, Yellow is the other. the Detail texture is any shared effects, like dirt.

Alternative, simpler. Details are added after the mix, so the same effect apply to both textures

1 Like

Thank you guys. Now i have two variants to switch textures\add overlays - via python or material nodes. I will use both for different situations! This is great.