playMaker

Author Topic: Set Material Texture (Projector _ShadowTex)  (Read 4681 times)

adgrist

  • Playmaker Newbie
  • *
  • Posts: 28
Set Material Texture (Projector _ShadowTex)
« on: August 02, 2012, 11:34:02 AM »
Getting into PlayMaker now!

Trying to use Set Material Texture, all seems to work well with normal materials using '_mainTex', but i need to change a texture on a projector at run time. In the shader it has the main 'cookie' texture as '_ShadowTex' but using this on Set Material Texture doesn't seem to work.

Any ideas anyone?

adgrist

  • Playmaker Newbie
  • *
  • Posts: 28
Re: Set Material Texture (Projector _ShadowTex)
« Reply #1 on: August 07, 2012, 10:26:19 AM »
Nobody ever tried this before?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Set Material Texture (Projector _ShadowTex)
« Reply #2 on: August 08, 2012, 05:14:00 AM »
Hi,

 Where did you get that projector material shader?

bye,

 Jean

adgrist

  • Playmaker Newbie
  • *
  • Posts: 28
Re: Set Material Texture (Projector _ShadowTex)
« Reply #3 on: August 08, 2012, 01:33:23 PM »
Hi Jean,

It is from the standard Projectors package, Projector/Multiply shader

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Set Material Texture (Projector _ShadowTex)
« Reply #4 on: August 09, 2012, 04:33:28 AM »
Hi,

 it works here using "_ShadowTex" i can change the texture of a material using that shader.

 You might have a clash with another set material texture that set it back to null or something or maybe you are not calling that action at all in the first place, or your action is not targeting the right gameObject. Make a simple scene, with one cube and that material, if that works, then something is wrong in your actual set up, not in the action itself

bye,

 Jean

adgrist

  • Playmaker Newbie
  • *
  • Posts: 28
Re: Set Material Texture (Projector _ShadowTex)
« Reply #5 on: August 09, 2012, 12:43:19 PM »
Thanks Jean. set texture works with everything else and other shaders, but when the projector shader is used, on a projector too, it just wont change the _shadowTex. I have just spent a while double checking and im still stumped. Would you be able to describe how you tested it so I know I am not doing it wrong.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Set Material Texture (Projector _ShadowTex)
« Reply #6 on: August 10, 2012, 03:06:40 AM »
Hi,

 yes, I should have explained better:

 projectors set up is different from normal rendering, hence the set material texture doesn't work as is by default, you need to explicitly reference the material you want to change. so drag the material onto the action slot, and that will work.

 I have attached a working prefab, so you can see how the action is set up.

warning, changing materials is permanent, so to test this over and over again, set back the material texture to something else and hit play.


 bye,

 Jean