Page MenuHome

Cycles: Add "Edge Length" output to the Geometry node
Needs RevisionPublic

Authored by Lukas Stockner (lukasstockner97) on Feb 27 2016, 10:29 PM.

Details

Summary

This commit adds an output to the Geometry node that gives the average
length of the edges connected to the face vertices.
Internally, this is stored as a per-Vertex attribute and then interpolated
over the face, just like Pointiness.

The output isn't really useful for production shaders, but can be handy
to quickly visualize the tesselation of the scene.

Requested by @Ronny G (nutel) on IRC.

Diff Detail

Branch
cycles-edgelength

Event Timeline

Ronny G (nutel) added a comment.EditedFeb 27 2016, 10:45 PM

tiny example

and a simple blend file

Brecht Van Lommel (brecht) requested changes to this revision.Feb 28 2016, 9:53 PM
Brecht Van Lommel (brecht) edited edge metadata.

Generally the functionality seems fine to add, though I wonder if this should be in the geometry node?

This is one of those options that people should only use for debugging, and there's already quite a few geometry node outputs. So perhaps it makes sense as part of a new Debug / Analysis node? I would like it to be clear that this is not something you typically use for building shaders. "Parametric" belongs in that category as well I think, so could be moved to the same node.

It's possible to think of a few more outputs for such a node, like a random per face color, some more advanced way to analyze over/undertessellation, .., so even if this new node would have few options now I could see more being added in the future.

By the way, for measuring stress or deformation it's probably better to do what Blender Internal does, comparing to the undeformed coordinates, although it's nice that you can already do something with this edge length now.

intern/cycles/blender/blender_mesh.cpp
473

I would use vector<int> data(numverts, 0);.

This revision now requires changes to proceed.Feb 28 2016, 9:53 PM

Agree with feedback from Brecht.

But side note: Bi does quite bad job for stressmap: it indeed calculates difference with underformed mesh, which makes it totally useless for production files and linked characters, because it is often agreed to move character by moving Master bone. This makes full character to be considered fully deformed, which is rather totally useless. If one will work on stressmaps for Cycles he should totally keep this in mind and address it.