Ramp driven pupil dialtion

291 views
Skip to first unread message

Daniel Davie

unread,
Aug 15, 2023, 2:50:30 PM8/15/23
to gaffer-dev
Hi Gaffer team,

I am currently trying to transfer the lookdev of an asset from Maya to Gaffer which is going well but I have hit a bit of an issue with the eyes. In Maya the rig is driving a circular ramp which is then being used to control a circular ramp to allow for pupil dilation. 

I found an old thread here where John showed how to create a circular ramp using OSL nodes which is great but now I am just trying to figure out how to drive the position of the ramp. I was thinking that the best way would be to use an animated attribute which can be cached out by the alembic node. I have gotten this far and can see the attribute in the Scene Inspector in Gaffer but I am not sure how to use that to drive an attribute on the shading nodes.

How would I go about doing this? Also if there is another more Gaffer friendly way of doing this that you guys can think of I am all ears!

Thanks and all the best,
Dan

John Haddon

unread,
Aug 16, 2023, 4:14:26 AM8/16/23
to gaffe...@googlegroups.com
Hi Dan,
One way would be to use an AttributeQuery node to get the value of the attribute and then feed that into the position of a point in the ramp. I've attached an example showing this in action...
Cheers...
John

--
You received this message because you are subscribed to the Google Groups "gaffer-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gaffer-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gaffer-dev/53a3a6a3-c27d-47d7-9049-26c1b9be61b0n%40googlegroups.com.
pupilSizeDriver.gfr

Daniel Davie

unread,
Aug 17, 2023, 1:03:53 PM8/17/23
to gaffe...@googlegroups.com
Hi John,

Ahh this looks great, just what we were looking for! Thank you for the example scene!

Cheers,
Dan

You received this message because you are subscribed to a topic in the Google Groups "gaffer-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gaffer-dev/9Ba1eaG1oeg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gaffer-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gaffer-dev/CAB8pVgLFtTDxM%3DKO-bCFFNGCpXBd_1xjTn_y_thZeUksa5B3EQ%40mail.gmail.com.

Victor Barbosa

unread,
Dec 5, 2023, 12:49:10 AM12/5/23
to gaffer-dev
Hey guys,

I am trying to query an attribute from a usd file that was exported with a geometry from Maya. I tried using an "AttributeQuery" node, but for some reason the output value is 0.0 instead of 10.0 which is the value of the attribute I am trying to query.
I attached a couple images in the hopes that it can give some context.

Thank you very much.
Screenshot from 2023-12-04 21-41-29.png
Screenshot from 2023-12-04 21-41-20.png

Victor Barbosa

unread,
Dec 5, 2023, 12:52:56 AM12/5/23
to gaffer-dev
I forgot to include the USD file, please see attached file. FYI, I'm using Gaffer version 1.3.8.0
hi-default.usd

John Haddon

unread,
Dec 5, 2023, 5:52:43 AM12/5/23
to gaffer-dev
Hi Victor,

It looks like the query is failing because AttributeQuery currently only knows about `float`, `int` and `bool` numeric attributes, and the attribute being queried is a `double`. I've fixed this by adding support for querying all numeric types - you should be able to download a test build artifact from the PR here if you'd like to give it a go : https://github.com/GafferHQ/gaffer/actions/runs/7099645827.

Cheers...
John

Victor Barbosa

unread,
Dec 5, 2023, 5:56:07 PM12/5/23
to gaffer-dev
Nice, it works! 
I also tested the attribute with values animated and the "AttributeQuery" node works like a charm.

Should I assume that the next release will carry this update ( obvious question, which I think I know the answer :D ) ?

Fantastic John, thank you!!!!


Murray Stevenson

unread,
Dec 5, 2023, 6:49:55 PM12/5/23
to gaffer-dev
Hi Victor,

Great to hear it's working for you, we've merged John's update and it'll be included in the next 1.3 release.

Cheers,

Murray

John Haddon

unread,
Dec 12, 2023, 8:47:35 AM12/12/23
to gaffe...@googlegroups.com
Quick update : the fixes discussed were released in Gaffer 1.3.9.0 today...
Cheers...
John

Victor Barbosa

unread,
Jan 5, 2024, 8:36:38 PM1/5/24
to gaffer-dev
Hey John,

I hope you had a great holiday. By the way happy new year!


I attached a gaffer scene with a simple pupil animation changing size over time. I am trying to export the result to a USD format and I think it is not working ( maybe I'm crazy ;P ). 
Could you let me know if what I am trying to do is possible or even make sense?


Many thanks in advance :D
pupilSetup.gfr

John Haddon

unread,
Jan 12, 2024, 5:38:12 AM1/12/24
to gaffe...@googlegroups.com
Hi Victor,

Sorry for the delayed reply, and a belated happy new year!

One slight oddity in your setup is the CustomAttributes->AttributeQuery step used to get the pupil size into the ramp. The AttributeQuery is done at scene generation time rather than at render time, so the whole thing is equivalent to just keyframing the position of the ramp directly. But that's not the reason why this isn't working - that's because Gaffer can't currently export animated materials. Gaffer materials don't have an identifier in the same way a USD material does (.e.g. `/materials/metal`), so we make identifiers on export based on the contents of the material - those are the awkward hashes you see in the material names in the USD file. Which means that an animated material gets exported as a series of individual materials, with only the last one actually getting bound to the object. We'll need to sort this out, but it's not straightforward.

What should work in the meantime is to actually take advantage of the CustomAttributes node by querying the value in the shader using a `user_data_float` shader. That way the material isn't animated as far as USD is concerned, but does get an animated value for the pupil at render time by querying the animated attribute. I've attached an example of doing this that is definitely working pre-export. The exported version looks good to me as well, but I haven't built a USD composition to verify that. Let me know how it works for you...

Cheers...
John




pupilSetupWorking.gfr

Victor Barbosa

unread,
May 16, 2024, 3:05:04 PM5/16/24
to gaffer-dev
Screenshot from 2024-05-16 11-16-44_2.pngHi John, hope you're doing great.

Sorry to keep pressing this "Pupil Ramp" topic.

What I'm looking for, is a way to make a geometry with a custom attribute from a USD geometry cache to layer together with a lookdev USD output from Gaffer. Therefore, when the lighting artist reads the layered USD file (geo + look), the pupil ramp would be animated.

I'm wondering if Gaffer's ramp node exposing the position array of the ramp color bar and accept floating, double or int values like a regular input connection instead of using an expression ( what we are using for now ) could be the solution for the problem I am dealing with.


Thanks a bunch John.
Victor B.


Reply all
Reply to author
Forward
0 new messages