Use data from CSV to drive a Plain effector


#1

Hi all,

I have a CSV file with data I have to use in cinema 4d. It have 160 different fields, all the value are already between 0 to 1.
OK all fine till now, using the ASCII import I’ve placed all the 160 data in 160 row in the timeline, and perfectly align and scale all data correctly in time.
Now I’ve made a cloner with 160 box and put a Plain effector . Now my incompetence arrive, because now I want to take all the 160 animated channel in the timeline and use this data for driving a sort of field for the plain in order that a value of 1 give me the max Y for the plain and 0 the minimum for the plain.

Could I solve this with some kind of field stack for the plain effector or I’m forced to use some xpresso ?
Looking forward from hearing from you, Thanks!


#2

There are countless ways to answer this question based on what it is you’re trying to achieve.

You may simply be better off using a bit of xpresso to manipulate the positions of vertices of a plane object then clone onto those vertex positions instead of faffing about with fields.

Post an image of what you’re trying to achieve or the project file with the data you can share and you’ll likely get a better answer.

Did you import these data into the structure manager with ascii import?

In the dim and distant past I have a vague recollection I used the Structure Manager to read in date as x,y,z vertex data and used Xpresso to read these data from the point cloud and process it and deform another object.


#3

Hi Infograph and thank so much!

I’ve attach the scene with all the 161 different animation tracks.
They represents the activity of 161 neurons in an artificial neural network (made for music recognition) while listening to different music. I’ve also the mp3 audio in synch with that data, but I ve not included in the scene for making it lighter.

I’ve imported the CSV file inside a null object with the ASCII import, so in the dope sheet or f curves I have all the 161 tracks of the 161 different neurons activity during time. This RAW data is already from 0 to 1 as real numbers, I guess they are still in this form inside cinema4d.

So this data is really a single vector, like a brightness from 0 to 1, or the Y position .

I need to transfert this data to the different clones, I’d like to use a Plain effector to driven the elevation of the Y position from 0 to X based on 0 to 1 of the RAW data. This way I guess will be easy for me to use a linear field for controlling the colors, and align the bottom of the linear field to the bottom of the Plain.

Again, thanks and Looking forward from hearing from you

simulation 161 artificial neurons activity from 0 to 1.c4d (54.9 MB)


#4

I can’t think of an elegant way you can read the Track Data by iteration and feed it into you clones in a loop with the way you’ve chosen to import these data.

The XPresso Track node will sample the track data but as far as I know the animation track has to be dragged manually into this node so you’d need 161 separate nodes then feed them manually into the clones, there’s nothing to stop you doing this but I’m sure there has to be a better way to do this with an iterative approach.

When I’ve had to bring data like this into C4D I’ve done it by making point clouds and iterating through the vertices reading their data and passing that into Clone positions, colour or whatever. X being time, Y being the value and Z being a reference.

I have never thought to bring in these data the way you have.

Maybe someone else has an idea how to use the track data in an iterative loop? I’ll keep thinking on this problem.


#5

There is a hidden way to link parameters in xpresso which are not exposed as a node input or output.

Select a “Track” xpresso node and drag cogs icon(top left corner of attribute manager) from attribute manager to xpresso editor.
Now You have a node with a “Track” input.
Create a link list node and drop all tracks into it’s link list field.
Connect “Link” output from link list node to “Tracks” of node You created using cogs icon.

Now You have to iterate all those tracks and feed those values into a list of effectors, or something like this.


#6

That’s brilliant @AdsovonMelk. Thanks, I learned something that I could’ve done with knowing years ago.

That’s your answer @n1ente.


#7

This is not obvious at all.
I don’t know why it is like that.
I have used this few times to create a loop in xpresso or to store some data inside a node editor without using user data.
Or like here, to access hidden ports.


#8

Hi !
Thank so much, seems the perfect trick to solve all this!
I’ ve never use xpresso before, so, I’m stuck in “drop all tracks into it’s link list field.”
Because the link list node have only index as input, (to an ignorant of xpresso like me) and its not clear to me “how to drop all tracks” (because if I drop he null object with all the tracks inside I cannot see how to output the data I want) and whats or how to create this “link list field”, excuse my incompetence

After this I guess its not clear if “Now You have to iterate all those tracks” means that there is an iterative node that I have to create , or this iterative process is already accomplished by the previous node system?

Thank you!


#9

You have to select all tracks names inside a timeline window and drag those in a “Link List” field inside a Link List node attributes.

The index port has to be connected to iteration node with iteration end set to a number of tracks -1.You have to create corresponding number of effectors and put those into another link list.

Connect the iteration node to index port of the second list node to synchronize iteration.

Now drag one of effectors into xpresso editor and connect link list(with effectors) “link” port to effector’s node

“Object” port.
Now it’s just a matter of connecting “Track” node output to any input in effector’s node to drive all effectors.


#10

Good morning AdsovonMelk!

Again thanks so much! I ve still some issues following your instructions but its amazing to start using xpresso with your help and learning all this usefull stuff.

Briefly what I made till now,
I want to start with a simple Plain effector and use 0 for 0 Plain and 1 for maximum Plain, is it right to drag it in xpresso (I don t need field for it I have these tracks isn’it )? If yes is this same Plain that needs to be added to node list (with effectors) too?

So I have to create track output pin (in the track node with track input isn’it) ? If yes, I don’t understand where to connect it. You suggest “any input” but seem me it needs track input, and after I m not sure when you write “effector’s node” do you mean the node list (with effectors) or the effectors node (like Plain effector).

I ve attach a small screenshot of the actual xpresso.

Thanks!


#11

Unfortunately this technique doesn’t work.
You could link all necessary nodes in a logical way, but it seems that there is no option to iterate through track list in conjunction with track node.

Try this instead:
https://drive.google.com/file/d/1XgE75L511uJgZ3C64iyvXwqvhSaJTsYo/view

There is a user data tab in Python Effector with all tracks listed inside a link list.
This is not very optimized code so it is quite slow.
It could be faster by deleting unnecessary transformations from this line:

" if mode==c4d.ID_MG_BASEEFFECTOR_SCALE or mode==c4d.ID_MG_BASEEFFECTOR_POSITION or mode==c4d.ID_MG_BASEEFFECTOR_ROTATION or mode==c4d.ID_MG_BASEEFFECTOR_COLOR: "

If You use only a position parameter You can replace this line by:

" if mode==c4d.ID_MG_BASEEFFECTOR_POSITION: "