Same thing applies here, we can't easily access the vertex set from OSL.
This seems strange, since an OSL shader can get any parameter from geometry.
OSL can get any parameters and user data that are available through getattribute().
https://docs.arnoldrenderer.com/display/A5ARP/OSL+Shaders
In katana one has access to Pref attribute as well as p attribute from geo, as well as which vertices are connected in one triangular polygon.
All we need is to get the edge length between each vertex.
Since we're not using 3d Studio Max, we should be able to get any attribute from a given geo.
-Vlad
This is what it says in the Arnold documentation.
Using the following attributes, if the getattribute() function specifies an objectname parameter, the value specific to that object is retrieved. If no specific object is named, the current object is implied."
Using this we can get Pref and p attributes from geo.
-Vlad
Alright, let me know how it goes.
Its not a concept I have got working through generic OSL.
What are you going to do with the edge length?
The Utility shader can get edge length, but I don't know if the same technique can be used in OSL. Will check it out.
Utility uses an API call that isn't available in OSL.
Can't you compute the edge lengths in Katana with an opscript and save that as user data on the object? Then shaders can get that user data to do stuff...
We can put together an example if you need it.
I wonder if I can do the same thing then.
Data channel modifier can cook up all kinds of things now that I think about it, there should be other ways to parse vertex array on an ID and conform it so we can read that id and some vector in some form and shape and syncronize OSL vector locations in the shader in a map (p) so we can drive implicit and hide source geo.
Hi Stephen,
Would it be possible for you to put together an example of such OP script?
Ultimately what we're trying to do is to show stretching of the vertices (the distance that a vertex travels over time) between "Pref" and "p" positions.
We have both Pref and p attributes in katana coming from geometry and all we need is to get edge length between those vertices to show how far they moved from the original position of Pref.
We're trying to do thins using an OSL shader, however if one can do this in an OP script that might work for us as well.
Thanks
-Vlad
I'll try to get you an example katana recipe with an opscript adding stretch/strain as user data.