Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: bidirectional crease to surface-edge distance functions #1160

Open
loren-osborn opened this issue Sep 6, 2019 · 2 comments

Comments

@loren-osborn
Copy link

loren-osborn commented Sep 6, 2019

I don’t know if this is appropriate for OpenSubDiv, but I thought this is at least a good place to ask.

I’m wanting to add an option (in Blender) to be able to set edge creases from a bevel radius approximation and vise versa. (The main benefit of this is that you may wish to set similar curvatures with diverse geometries. This would allow calculating the correct crease value for a given curvature for each edge.) Given the relative angle of the edge faces and the distance between the limit surface and the control edge (at the edge midpoint) calculating the bevel radius to approximate it is fairly straightforward. Unfortunately I’m having trouble determining the distance between the limit surface and the control edge from the edge crease, and vise versa.

  • Is there a straightforward way to bidirectionally compute this relationship?
  • Is this already implemented in OSD?
  • Would it make a useful addition to OSD?

For comparison, the rough algorithm to determine the approximate bevel radius from the distance i’m looking for:

  • Take the unit-length normals of the two faces adjacent to the edge.
  • The arc-cosine of the dot product of these normals to get the angle between these surfaces.
  • Inscribe a circle with the desired bevel radius in the calculated angle.
  • The distance between the circle center and the angle minus the bevel radius is how far the surface lies from the control edge.
  • Given:
    • α the angle computed above
    • d the distance from the limit surface to the control edge
    • r the bevel radius approximating the SS limit surface:
    • \frac{d}{r} = \frac{1}{\sin{\frac{\alpha}{2}}} - 1

I realize there are all sorts of edge cases where this has divide by zero issues and other range errors and discontinuities, and I think I neglected to say that one of the normals should have been negated, but this is intended to give the general idea.

TL;DR: how do I compute the crease value from the distance between the control edge (midpoint) and the SS limit surface, and vise versa?

@jilliene
Copy link

jilliene commented Sep 6, 2019

Filed as internal issue #OSD-303

@loren-osborn
Copy link
Author

loren-osborn commented Sep 7, 2019

I think I can clarify this request some:

This request really boils down to two items:

  1. Given a SS control cage edge, with relevant local geometry, how do I calculate between a OSD crease value, and the distance between a point on the control cage (the midpoint of the edge) and the corresponding point on the OSD limit surface bidirectionally?
  2. Should computation of this relationship be added to the OSD API? (Or is it possibly already there?)

As I’m really new to OSD, I really don’t have any meaningful opinion on the second point. The main issue with the first point is really compatibility:

  • The basic Catmull–Clark subdivision surface algorithm is widely well understood and well documented, but does not include a definitive definition of “crease” or how it impacts the algorithm.
  • Searching online there are appear to be several definitions of “crease”, and how it impacts the CC SS algorithm.

So, can you clarify which crease variation of the CC SS algorithm does OSD implement. From that I expect I can derive the relationship I’m looking for.

Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants