Jump to content

reading arbitrary data into vex (as array)


Recommended Posts

In an inline vex node in the surface shading context, I would like to loop over an arbitrary set of (geometry) data from another object. I am trying to find the best way to get this data into the vex array. If possible, I'd like to avoid writing data out to disk, but if its necessary I can compromise on that. Some options I'm considering and have been testing:

1. attach the data as point attributes to the original geometry being shaded. However, this is kind of inconvenient, as the arbitrary data doesn't correspond to points or prims in the original geometry, and as the geometry gets heavier, would add extra attribute traffic.

2. attach the data as detail attributes. This is inconvenient and seems inefficient also, since I would have to make a separate detail attribute for each piece of data. I could also save all the arbitrary data into a string, but, how can I parse that string in vex and get the data into an array? Is that workable?

3. use getattribute vex function to lookup from an arbitrary piece of geometry. I was having a little trouble getting this working, also using the op:/ syntax from vex just wasn't working either.

4. Use python to parse the arbitrary data into a formatted vex file, and include that vex file in the inline code. I haven't tried this yet, but it seems like a clumsy way to do this, and I'd like to avoid writing out the external file.


Something like a "python VOP" would really come in handy right now, as I feel like I'm trying to make a workaround for it. Or, are there ways to parse strings in vex that I don't know about?

Thanks for any insight!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...