Getting hair implicit uvs in a custom OSL shader

Getting hair implicit uvs in a custom OSL shader

Anonymous
Not applicable
1,542 Views
4 Replies
Message 1 of 5

Getting hair implicit uvs in a custom OSL shader

Anonymous
Not applicable

I'm trying to access the the implicit uvs of xgen curves exported to .ass from maya from a custom osl shader.

I'm trying to replicate the behavior of the maya ramp node in a custom OSL shader. It provides access to the implicit curve uvs (basically root to tip mapping). I've looked in the docs and found this:

https://support.solidangle.com/display/A5NodeRef/curves

I've exported 1 strand of xgen hair for testing as an ASCII .ass file and I reimported it in maya for testing

1- I don't see the uvs parameter mentioned in the link above in my .ass file.

2- getattribute("uvs", hair_uv); in my shader is returning 0.

3- The maya ramp seems to work regardless of the above.

As a side note: I'm also wondering if there is a shader in KtoA that can replicate the Maya ramp behaviour.

Thanks in advance!

0 Likes
1,543 Views
4 Replies
Replies (4)
Message 2 of 5

zenop
Advocate
Advocate

You can replicate the implicit uv's of the ramp shader by feeding a flat utility shader set to the barycentric coordinates into the uv params. Not sure about the osl-side though.

0 Likes
Message 3 of 5

Anonymous
Not applicable

Great! I got it to work using the "Utility" shader in maya and katana. that takes care of my immediate problem. I still need to get that data in a custom OSL shader.

Are barycentric coordinates calculated by the utility shader or read from the geometry?

0 Likes
Message 4 of 5

zenop
Advocate
Advocate

I think they're read from the geometry since they're in the shaderglobals: https://trac.solidangle.com/arnoldpedia/chrome/site/Arnold-5.0.2.0/doc/api/structAtShaderGlobals.htm...

0 Likes
Message 5 of 5

Anonymous
Not applicable

Cool! I don't see bu or bv in the exported ASCII .ass file. Are these implicit?

I've tried this in my osl shader with no luck.

float bv = 0.5;
float x = getattribute("bv", bv);
printf("%f \n", x);
out = bv;
0 Likes