question

vlad streltsov avatar image
vlad streltsov asked ·

How to set up an OLS shader that shows stretching of vertices based on the Pref distance?

Hello,

I'm trying to create an OSL shader that will show the distance that a vertex has traveled over time.
I was thinking of using Pref to keep track of the starting position and end position of all the vertices.
The end goal is to show stretching of vertices over time on a given geometry.

Any suggestion how to approach this puzzle would be greatly appreciated.

-Vlad

osl
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

1 Answer

· Write an Answer
Mads Drøschler avatar image
Mads Drøschler answered ·

OSL has no concept of Pref, so that wont work. No direct access to mesh info, you have to do it shade space. ( construct vertex array list from xml and parse though an #include. then redraw in shader and do your calculations between 2 given refference points and some interpolation inbetween ) I suspect you will run into scalar issues, small works fine, large, not so much since array gets huge, I havent tried with millions of vectors. so just speculation.

In GL there is a concept more closely related, vertex and frag.
We lack the vertex component, they attach in GL by refferencing the vertex component into the frag, we only have the frag in OSL for now.

2 comments Share
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Hi Mads,
Thanks for the quick response.
I'm using KtoA and in katana I have the info for the vertex array P and the array for Pref coming from the geo as attributes P and Pref.
I was wondering if it would be possible to create an OSL shader that would read these two attributes (P and Pref) and print out the difference between them for each vertex of the geo.
Then output that difference (which would ultimately be the distance between the vertices) as a RGB color?

Thanks

-Vlad

0 Likes 0 · ·

I understand what you need, I dont have the interface you use KtoA.

I just know that we cant easily ping Pref through atrributes in the OSL implementation in MAX. We cant contact the vertex array directly. You may very likely be sitting in same situation.
I have no qualified quess as to how to progress.

Tho I am experimenting with several approaches to port vector values from mesh to OSL.

0 Likes 0 · ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Welcome to the Arnold Answers community.

This is the place for Arnold renderer users everywhere to ask and answer rendering questions, and share knowledge about using Arnold, Arnold plugins, workflows and developing tools with Arnold.

If you are a new user to Arnold Answers, please first check out our FAQ and User Guide for more information.

When posting questions, please be sure to select the appropriate Space for your Arnold plugin and include the plugin version you are using.

Please include images, scene and log files whenever possible as this helps the community answer your questions.

Instructions for generating full verbosity log files are available for MtoA, MaxtoA, C4DtoA, HtoA, KtoA, and Kick.

If you are looking for Arnold Documentation and Support please visit the Arnold Support site.

To try Arnold please visit the Arnold Trial page.

Bottom No panel present for this section.