mixing hair mappings along the strand and from emitter surface uvs

487 views
Skip to first unread message

Ark

unread,
Feb 12, 2016, 3:40:00 PM2/12/16
to alshaders
Hi,

Since alHair doesn't have separate root and tip channels, we're trying to use both types of mapping - 'from the surfaces uvs' and 'along the strand' together in a single shader. Is there a good method to do that? We've tried setting Uparam/Vparam to blank to get 'along the strand' behavior by default and then using aiUserDataFloats with uparamcoord/vparamcoord for specific nodes - works nice with ramps, but maya file node ignores that (doesn't seem to export coords at all). Works fine with aiImage, but fails when we use UDIM (maya file node work correctly with UDIM). Is there any other ways to mix these two mappings?


Best regards,
Ark

Graham Cristie

unread,
May 2, 2016, 9:40:04 AM5/2/16
to alshaders
I've just started working with the alHair shader and ran into the same issue.

There is a work around, while it is a little complex to set up it does work.
  • Delete the uparamcoord and vparamcoord values form the alHair shader to get the root to tip mapping
  • Use aiImage nodes to bring in your maps.
  • Create two aiUserDataFloat and enter the uparamcoord and vparamcoord into the float attr name field for each node respectively
  • Plug the aiUserDataFloas into the Uvcoords X and Y for the aiImage respectively
  • Now plugging the aiImage into dyeColor (or whatever) will respect the UV setup on the yeti mesh.
  • As you said the aiImage fails when trying to use with a udim token - the work around is to create a aiImage per udim and combine them together
  • Create an aiImage per udim - load each udim - so if you have udims for 1001 to 1004 load them into separate aiImage nodes.
  • On each aiImage node set wrapU and wrapV to "BLACK"
  • set the offset for succesive aiImage from tile 1002 and up - so for udim 1002 OffsetU will be -1.0, 1003 is -2.0 and so on.
  • Combine the nodes using alCombine color set to add 1+2
  • If you are using different maps for root and tip, you can plug these into the different color entry lists on a ramp shader - root maps into color entry list [0], tip into color entry list [1]
  • You can use as many color entry lists as you like - we're using 3 for root, mid and tip
  • Now the uparamcoord and vparamcoord are turned off for alHair shader, the ramp shades from root to tip and the aiImage shades over the UVs

Ark

unread,
May 8, 2016, 10:01:22 PM5/8/16
to alshaders
Thanks, Graham.

In fact, we've found an easier solution - you can create attribute inside yeti and load texture map (udim works fine) into it, then read it with aiUserDataColor, keeping alHair in 'along the strand' mode.

Anders Langlands

unread,
May 9, 2016, 8:10:40 AM5/9/16
to Ark, alshaders
Just keep u/vparamcoord and use a ramp with textures plugged into the ramp knots.
On Sun, May 8, 2016 at 22:01 Ark <sag...@gmail.com> wrote:
Thanks, Graham.

In fact, we've found an easier solution - you can create attribute inside yeti and load texture map (udim works fine) into it, then read it with aiUserDataColor, keeping alHair in 'along the strand' mode.

--
You received this message because you are subscribed to the Google Groups "alshaders" group.
To unsubscribe from this group and stop receiving emails from it, send an email to alshaders+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

gra...@passion-pictures.com

unread,
May 9, 2016, 10:12:26 AM5/9/16
to alshaders, sag...@gmail.com
just shows there's more than one way to skin a cat (pun intended)

Ark

unread,
May 9, 2016, 10:22:53 AM5/9/16
to alshaders, sag...@gmail.com
This way ramp gets mapped across the surface as well, and textures get blended across the surface, not along the strand.

Anders Langlands

unread,
May 9, 2016, 10:24:11 AM5/9/16
to Ark, alshaders
Are you using Maya's ramp? It should go down the hair strand

gra...@passion-pictures.com

unread,
May 9, 2016, 10:26:50 AM5/9/16
to alshaders, sag...@gmail.com
good to know that method is working for you Ark, though here since our grooms have to be published it's quicker to have that set up in the shading side rather than in the Yeti graph

Anders,
"Just keep u/vparamcoord and use a ramp with textures plugged into the ramp knots" that was my initial approach and did work initially on an early test, but since failed - maybe it could be something in the Yeti node causing the problem?

I assume you mean u/v paramcoord to map on the meshes UV tiles / udims and using the ramp to handle the root to tip maps?

I have my setup scripted now, so it;s very quick to setup, but will investigate further...

Ark

unread,
May 9, 2016, 10:29:55 AM5/9/16
to alshaders, sag...@gmail.com
Yes, standard maya ramp. Always worked the same for me - as other procedurals or file node - respecting u/vparams.
Reply all
Reply to author
Forward
0 new messages