I'm trying to set color and other properties of a shader dependent on the specific face of an imported mesh.

To make the problem a little bit less abstract, I'll give you the background: I did physics simulations on a surface mesh with some other software and got a timeline of values for each mesh face saved somewhere in a textfile. I want to make an animation, where these values are color coded on the surface mesh with blender.

I'm not exactly a blender pro and tried to fumble around with .osl scripts to the effect that I can set the time-dependent color of an object by using something like

float my_array[120] = {
#include "myfile.txt"

within the .osl script. I don't know whether there is a better way, any suggestions are welcome, but it works for now.

But now I'm stuck. The script needs a second input: the specific mesh face, preferrably as the index at which it occurs in the .ply file of the mesh. If I had that, i could again load some flattened array, calculate an index in it from the mesh index and the time. But how do I get that index? The Geometry node does not have something like that and a UV-map also doesn't seem like the place to look.

Thanks in advance for any pointers


Your Answer

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

Browse other questions tagged or ask your own question.