nbrancaccio@Posted: Fri Jul 06, 2007 8:02 pm :
Hey all,

Just a quick, but probably complicated question:

Would it be possible to create a material that would alternate the diffuse channel from one image to a different one when hit by a light?

What I mean by this is say I gave a material 100% self illumination. Now would it be possible to make it so that when that material was hit by say a spot light, it would reveal a different texture where the spot is hitting than that that is seen when the material is not being hit by that light source.

Does that make sense?

Thanks in advance!



rich_is_bored@Posted: Fri Jul 06, 2007 10:37 pm :
Not using a single material shader. But you should be able to do it using separate material and light shaders that make use of the spectrum keyword.



nbrancaccio@Posted: Fri Jul 06, 2007 11:19 pm :
ah awsome, thats the perfect thing, and its even more customizable. I just have one more follow up question... then is it possible to assign an object 2 materials? One which would be self illuminated and show whenever and whereever it is not hit by a light, and another to show where that object is being hit by a light source of the proper spectrum?

Thanks!



rich_is_bored@Posted: Sat Jul 07, 2007 5:16 am :
That depends on what you mean by object.

If you mean a single surface, no. You can only apply one material per surface.

However, it would be possible to place two identical surfaces in the same location, each referencing a different material.



nbrancaccio@Posted: Sat Jul 07, 2007 2:28 pm :
ah yeah good point! However, wouldn't there be Z-fighting issues? also with that technique would it be possible to make a material that whereever it is lit up, it would appear normal, and where ever it wasnt getting light from that proper spectrum it would be simply invisible (so that the surface beneith it would be visible?



The Happy Friar@Posted: Sat Jul 07, 2007 3:47 pm :
that's easy: just make & apply a material that uses the spectrum keyword. No light that spectrum hitting it = not there.



nbrancaccio@Posted: Sat Jul 07, 2007 7:27 pm :
Ah very cool! thankyou! I was worried that the part not being hit by the light would just appear black. Now to test this :D

THANKS!



The Happy Friar@Posted: Sat Jul 07, 2007 8:22 pm :
oh... never thought of that. :D



bolleh@Posted: Sat Jul 07, 2007 8:33 pm :
nbrancaccio wrote:
Ah very cool! thankyou! I was worried that the part not being hit by the light would just appear black. Now to test this :D

THANKS!

well, in case this does happen to be the case(am not sure) you can use a workaround. Whenever you let the light come on, and thus one material goes black, just let the script move that brush back a tiny bit and have the other brush move forward. Do it ridiculously fast and it shouldn't really be noticable but it may require some tweaking to get nicely