1
$\begingroup$

i work in BGE and i would like change the texture or the material of an object.

For exemple if i click on a pushbutton the texture of the transparent windows fade to texture of curtain.

$\endgroup$
  • $\begingroup$ do you want to fade from a curtain texture to a totally transparent material, or do you want to fade from a curtain texture to a window texture with the middle transparent? $\endgroup$ – X-27 wants to Reinstate Monica May 10 '16 at 14:34
  • $\begingroup$ I just would like to for example change my rock texture on my cube to a tree texture on my cube. $\endgroup$ – softyoda yoann May 10 '16 at 14:50
  • $\begingroup$ Oh, that is actually rather easy. it doesn't need transparency? $\endgroup$ – X-27 wants to Reinstate Monica May 10 '16 at 14:51
1
$\begingroup$

Well, there might be different solutions - but here is one which worked for me. It involves Material nodes with three seperate materials. You need...

  • one for your initial material (window),
  • one for your second material (curtain) and
  • one which controls your fading.

The last one uses the objects color, which can be changed via Python. Here is an my minimal example using a blue and red material as inputs and a shadeless one for fading:

enter image description here

When running it, the materials fade within 10 seconds, driven by the timer.

$\endgroup$
  • $\begingroup$ No need to use python here. Animate a value on a lamp or camera, and use lamp data or camera data as an input on your mix node. $\endgroup$ – X-27 wants to Reinstate Monica May 10 '16 at 23:09
  • $\begingroup$ Well, what you need is a possibility to feed the mix node whit a value from 0 to 1, that's for sure. Following your suggestion I took a look at the input nodes for camera and lamp Data. For the cam there are view vector, z depth and distance, for the lamp there is color, light vector, distance, shadow and visibility factor. Which one do you suggest to change, and how would be your way of doing it without Python? $\endgroup$ – AeroLynx May 10 '16 at 23:38
  • $\begingroup$ simply animate the value of a lamp's color or strength, have that animation play in BGE, and use that in a lamp data node as imput. $\endgroup$ – X-27 wants to Reinstate Monica May 11 '16 at 0:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.