Trailing edges on Toon lines

Trailing edges on Toon lines

maruska
Advocate Advocate
4,567 Views
17 Replies
Message 1 of 18

Trailing edges on Toon lines

maruska
Advocate
Advocate

I tend to render technical objects that have a lot of parallel faces, but are at different "depths". Most of my data is coming from CAD, has no UV's, and the topology typically is pretty awful by DCC standards.


When rendering toon-line images, anywhere there is a trailing edge of a surface that is coplanar with another surface, Arnold Toon will skip that toon line. This omission tends to drop a lot of detail that otherwise should be represented.

8036-toon-trailingedges.png

Any depth-pass or normal-pass tricks to get these conditions to render? I'm rendering in Maya (MtoA), but I'm guessing tricks from any platform would help.


I think a similar question has been asked here...

https://answers.arnoldrenderer.com/questions/14378/toon-contour-lines-based-on-depth.html


Cheers,

Joshua


0 Likes
Accepted solutions (1)
4,568 Views
17 Replies
  • toon
Replies (17)
Message 2 of 18

ramon.montoya
Contributor
Contributor

You are right, toon does not use depth to detect edges. We will look into adding that feature.

In the meantime, if you are not using UVS, you could

1) use a uv_transform shader as the root for your shading tree
2) pipe the uv_transform.offset.x to a length shader, whose length.input points to the camera position


With that setup the toon shader will see distance to current camera (i.e. depth) as U, and you can use uv_threshold to control where edges are inserted.


0 Likes
Message 3 of 18

lee_griggs
Autodesk
Autodesk

Does reducing the angle_threshold or changing the edge_detection to geometric_normal help at all?

Lee Griggs
Arnold rendering specialist
AUTODESK
0 Likes
Message 4 of 18

maruska
Advocate
Advocate

8066-arnold-toon-anglethresholds.jpg


No difference between edge detection modes. I did a quick multi-frame output with the angle threshold keyed from 0º to 180º. Even at zero, the trailing edge of both the protruding cylinder and the square are missing.


I'm guessing the CAD data is dense enough that the edge mode makes little difference as these models don't typically play smoothing tricks found in a usual DCC model.

0 Likes
Message 5 of 18

maruska
Advocate
Advocate

8067-screen-shot-2020-09-03-at-51905-pm.png

Did I do this right? It still looks the same. (This is with a 15º angle threshold)

0 Likes
Message 6 of 18

lee_griggs
Autodesk
Autodesk

Maybe mesh->remesh/retopologise could help?

8068-1599201192458.png


Lee Griggs
Arnold rendering specialist
AUTODESK
0 Likes
Message 7 of 18

maruska
Advocate
Advocate

I don't think it's a topology issue. This was modeled in Maya - just a cube and some offset extruded faces. Same condition though - the top faces are parallel so the back edge disappears.


8078-screen-shot-2020-09-04-at-83856-am.png8080-screen-shot-2020-09-04-at-83828-am.png



For giggles, here is a similar model - but two cubes on top of one another. They have been combined into one body so they share the same Toon ID (not typical of my models, but just to make a point). Both top faces are a single quad.8081-screen-shot-2020-09-04-at-84407-am.png



And as another example. This is the same Maya model where I took the top inner face and rotated it out of plane by 0.1º. The back edge appears because the two faces are no longer parallel - again, not a real world scenario, as I often have parallel faces.8083-screen-shot-2020-09-04-at-85252-am.png

0 Likes
Message 8 of 18

CiroCardoso3v
Advisor
Advisor

Have you tried tweaking the UV threshold? I found that values between 0.1 and 0.2 adds some extra lines that can be useful.

Lead Enviroment Artist @Axis Studios

Arnold Discord Server


Ciro Cardoso

EESignature

0 Likes
Message 9 of 18

maruska
Advocate
Advocate

That didn't seem to do anything. Maybe because there are no UV's on the model? I think that's what Ramon Montoya Vozmediano was looking at with the uv_transform.offset.x to length shader hook-up to pipe screen space information into the UV system.

0 Likes
Message 10 of 18

maruska
Advocate
Advocate

@Lee Griggs do you have any more ideas on this use case?

0 Likes
Message 11 of 18

lee_griggs
Autodesk
Autodesk

Can you upload the geo somewhere so that I can have a play with it?

Lee Griggs
Arnold rendering specialist
AUTODESK
0 Likes
Message 12 of 18

maruska
Advocate
Advocate

@Lee Griggs Sure thing. Here is the Maya file with both test objects.

ToonTool_example.mb.zip

0 Likes
Message 13 of 18

lee_griggs
Autodesk
Autodesk

Sorry, I could only fix the right issue by separating the cubes.

8150-1600066986991.png

Lee Griggs
Arnold rendering specialist
AUTODESK
0 Likes
Message 14 of 18

maruska
Advocate
Advocate

Darn it. That’s cheating. Ha.

0 Likes
Message 15 of 18

maruska
Advocate
Advocate
Accepted solution

I think this is the answer. I need to stress test it a bit, but piping a aiCurvature node into Mask_Color did the trick.


8197-screen-shot-2020-09-17-at-85852-pm.png8196-screen-shot-2020-09-17-at-85508-pm.png

0 Likes
Message 16 of 18

maruska
Advocate
Advocate

Going back to the original model, it does seem to work as I would like it to. I am using a couple different Toon shader instances to control when and where edges appear - such as the honeycomb pattern in the lower right where having everything outlined made the image very busy. Nice to have options!


8198-screen-shot-2020-09-17-at-92611-pm.png

0 Likes
Message 17 of 18

lee_griggs
Autodesk
Autodesk

Nice trick! Glad you got it to work in the end.

Lee Griggs
Arnold rendering specialist
AUTODESK
0 Likes
Message 18 of 18

thiago.ize
Autodesk
Autodesk

The just released Arnold 7.2.4 (and associated plugins) now properly finds these edges. https://arnoldrenderer.com/download/

0 Likes