Need help: a shader that changes individual hair color by direction of sway

(Vilber) #1

Hello, I am a beginner with programming in blender, but I have programmed in python before and am familiar with the basics of blender.

I am interested in creating a way to change the color of individual hairs according to what direction they sway. I am trying to display a biological structure used for detecting movement. It is called an otolith. In short they detect movement in different directions by rows of hair cells only activating in particular planes of movement.

This is an example of the directions that these cells are activated.

Here is an initial test movie I have made of their movement:

I would like to be able to have the “hairs” change color through the movement if the different planes of bend are activated. So that the hairs that are “activated” turn to a green or red or something. I would prefer a gradient of transition but a blinking on and off will be enough to get me started. I am wondering if the getattribute() function for particles is usable for this purpose. Or let me know if there is an easier way to accomplish this.

Thank you.