Shading Problems

Hi everybody.

I am trying to give my users visual clues about what they are modeling. My idea is to have the colors of the faces of each object (polygon models) change depending on the position of a light. My objective would be to give them an idea of (for example) heat on the surface.

I have toyed around with using several shaders and assigning a different shader to each face depending on my calcs...but I am exploring other avenues. I need more speed and I need to not have to change the model (the way I do it I completelly change the model by assigning the shaders to the surfaces). Keep in mind that is supposed to be an interactive modeling tool...

Is there any way of doing this in an interactive manner?
Or should I use a shader? Could I use the hardware render panel?

I am playing with MEL (a lot) and I am about to embark on exploring the API. Any suggestions?

Thanks in advance!

Umm why do you need this ona face levell... Its much more clumbersome than making it on a pixel levell. And if you actualy need them to look facetted then you can turn your mesh edges into hard ones and youll get just that.

one way thet would copletely respect the lightning:

make a labert node and connect the out color of that to a ramp edit the ramp to whatever. then connect this info on to a surface shader and assing nthat to your obect.

this is just avery wery simple way!

also heres no reason why the ramp cat be fed with dfferent shaders!

Sorry but I can't really understand what you mean. Could you explain a bit better? I don't know what is a ramp edit.

Would I be able to render this sollution you are suggesting in real time onto the HardwareRenderPanel (or anywhere else)?

Using a shader would eventually be great. To reiterate, what I am trying to do is use a formula (angle of the light with the face normal) to 'paint' the object. What I am looking to do would be very similar to those images of heat vision. I will eventually need to map the pixel values back to the surface so that I can sample them an know their values on a location basis...

Thanks.

heres an example. But no its not capable of doing this in the realtime views.

also note that a siple ramp would have been enough... no need for material connection since you dont actualy need many materials.

unfortunately doing this with mel is far too slow for any usefull feedback times (it can be done if you can accept refresh speeds of 1 fps or something similliar). So doing a mel script in any way will have serious speed drawbacks. So what you need is to look in the api and do your own open gl magics, for this. Fortunately for you its very dooable and not that hard either. But its still a big step since using the api has a realy steep learning curve... also you need to know opengl

But this method can however be a great push button solution if a push button is emough.

Thanks,

I could not see your example because I get a forbiden message. Is there any other way I can access it?

I do know a bit about the API and very little on OPENgl, but either dont seem very hard for me to tackke. My biggest problem is that I am climbing up that steep curve you talk about while trying to do something very uncommon

Fortunately for you the api comes with pretty good examples.

umm sorry about the link i forgot to put execute rights on the folder sorry!