question

Ellie Row avatar image
Ellie Row asked ·

aiToon width scaling depending on distance from camera?

Hello, can I change the edge width scaling on the aiToon in Maya, depending on the distance between the camera and my model?

I have read that attaching a facing ratio shader to the width scaling could help, but I have tried that and found that it had no effect. I found that changing bias and gain had some effect on the line width in general, but not depending on the camera. Is there a particular way I should attach it?

The problem I am having is the a close up of my model shows barely any line width, while a wide shot shows very thick lines in comparison to my model.

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

John Park avatar image
John Park answered ·

Thanks you Tim for the file! but i failed to render clear black line when the obj is really really far from the camera... does anyone know how to fix this? or is there any other way around this problem of width scaling depending on distance from camera?


screenshot-5.png (49.5 KiB)
screenshot-2.png (124.0 KiB)
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.

Gary Crane avatar image
Gary Crane answered ·

yes, I am using 2017 atm. Thanks for the tree

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.

Stephen Blair avatar image
Stephen Blair answered ·

It's not empty. It's a Maya 2018 scene. Maybe you have an older verison?

Here's the shader tree:

createNode aiToon -n "aiToon1";
	rename -uid "4FADED48-470B-E0B8-228E-A79FCC4266B6";
	setAttr ".angle_threshold" 12.203390121459961;
createNode aiReciprocal -n "aiReciprocal1";
	rename -uid "EC988765-4429-C535-C4C3-798146F759E3";
createNode aiAdd -n "aiAdd1";
	rename -uid "8EE04718-4C0C-2392-9DDF-F9B189A2180C";
	setAttr ".input2" -type "float3" 1 1 1 ;
createNode aiMultiply -n "aiMultiply1";
	rename -uid "D738C301-43DD-46A2-1BEB-43A43B4F6BF4";
	setAttr ".input2" -type "float3" 0.1 0.1 0.1 ;
createNode aiStateFloat -n "aiStateFloat1";
	rename -uid "CD8210B2-4064-5D10-3045-DCA3506982DE";
	setAttr ".variable" 5;
connectAttr "aiReciprocal1.outr" "aiToon1.edge_width_scale";
connectAttr "aiAdd1.out" "aiReciprocal1.input";
connectAttr "aiMultiply1.out" "aiAdd1.input1";
connectAttr "aiStateFloat1.out" "aiMultiply1.input1r";
connectAttr "aiStateFloat1.out" "aiMultiply1.input1g";
connectAttr "aiStateFloat1.out" "aiMultiply1.input1b";
connectAttr "aiToon1.msg" ":defaultShaderList1.s" -na;
connectAttr "aiStateFloat1.msg" ":defaultRenderUtilityList1.u" -na;
connectAttr "aiAdd1.msg" ":defaultRenderUtilityList1.u" -na;
connectAttr "aiMultiply1.msg" ":defaultRenderUtilityList1.u" -na;
connectAttr "aiReciprocal1.msg" ":defaultRenderUtilityList1.u" -na;
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.

Gary Crane avatar image
Gary Crane answered ·

Hey Tim, I downloaded your example, and it is an empty scene

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.

Loïc Tabourin avatar image
Loïc Tabourin answered ·

Hi ! I was also looking for that. Thank you Tim but I think i miss something when I tried it and I am not able to open your project it says "Error reading file". Here is what i tried. I new to maya so i'm pretty sur I did a mistake.

Thank you !


nodes.png (68.4 KiB)
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.

Max Tarpini avatar image
Max Tarpini answered ·

@Tim Harding be aware that it ain't gonna be consistent as soon one introduces camera fov

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.

Pétur Eggerz avatar image
Pétur Eggerz answered ·

Same problem here, my current workaround is primitive and tedious, in post (AE in my case) i apply a "simple choker" and animate the choke matte in relative to the edge widh i want.

This requires different passes for the outlines of each object if they move independently on the "Z" axes in your scene.

Hope this helps

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.

Tim Harding avatar image
Tim Harding answered ·

You can use an aiStateFloat set to Rl. This gives you the distance from the camera to the shading point. Add one with aiAdd and take the reciprocal with aiReciprocal, thus taking the linear distance input and applying the function 1/(x+1). The result will vary taper from 1 when the point is close to 0 when it is far away. You can see what this looks like here. You can also scale the ray length with aiMultiply before passing it through the function to adjust how the effect falls off. Use this to drive the aiToon edge width scaling. If you're using Maya you can see an example here.


far.png (8.4 KiB)
mid.png (14.1 KiB)
close.png (16.6 KiB)
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.

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.