Community
Arnold General Rendering Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Getting hair implicit uvs in a custom OSL shader

4 REPLIES 4
Reply
Message 1 of 5
minaragaie
676 Views, 4 Replies

Getting hair implicit uvs in a custom OSL shader

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!

Tags (4)
Labels (4)
4 REPLIES 4
Message 2 of 5
zenop
in reply to: minaragaie

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.

Message 3 of 5
minaragaie
in reply to: minaragaie

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?

Message 4 of 5
zenop
in reply to: minaragaie

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...

Message 5 of 5
minaragaie
in reply to: minaragaie

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;

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report