Search Unity

Alternative Catmull-Clark subdivision surfaces?

Discussion in 'General Graphics' started by neginfinity, Sep 1, 2016.

  1. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,572
    Has anyone ever seen an alternative implementation of catmull-clark subdivision?

    https://en.wikipedia.org/wiki/Catmull–Clark_subdivision_surface

    Basically, if you subdivide a cube, it slowly turns into sphere. However, resulting sphere does not pass through original control points. When modeling it means that when you grab a low-poly control geometry and slice it, it distorts the shape being modeled.

    I think that it should be possible to take the original algorithm and adjust it a bit so the original points do not move, so it would behave like a catmull-rom spline for surfaces...

    has anyone seen a software trying to do that?
     
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,794
    You generally use weights on points and edges. 100% weight means edge/vert will be at the original point.

    Most 3d software have that functionality.

    (also, disney/pixar had their own variation that dealt with artifacts pretty nicely, I believe modo uses both)
     
  3. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,572
    I don't think that this is what I'm talking about.

    See the picture from here:

    What I meant that when you start subdividing the cube, existing points stay in place, but the shape becomes spherical. Meaning it "inflates" outwards instead of "shrinking" inwards.
     
  4. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,794
    And what would you like to happen instead?

    (ah I think I got it? You want the resulting sphere to be large enough so that the radius is equal to the cube's diagonal?)
     
  5. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,572
    Yes, Basically, I do not want original points to "jump" when the model is subdivided and would like to avoid this effect:

    gif2.gif


    I think it would be great for modeling.
     

    Attached Files:

    • GIF.gif
      GIF.gif
      File size:
      99.8 KB
      Views:
      1,079
  6. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,794
    That sort of sounds to me more like nurbs based modelling than subdivision. (at least the second part of adding more "control points" without distorting the surface)
     
  7. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,572
    True, but IIRC nurbs operate on patches, not on arbitrary geometry.
     
  8. Deleted User

    Deleted User

    Guest

    You could always just convert nurbs to poly's then re-topo if it's easier. Quite often done in hard surface modelling..

    The workflow is pretty simple in Maya, as you can just preview catmul by pressing 1,2,3 so you can compare any radial differences between the two or add edge loops of course to sort out the geometry.

    But as @AcidArrow says, what I believe you're looking for is SDS subdivide algorithm which is available in Modo.. Although I can't say I'm too fond of it for games development on the whole.
     
  9. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    Isn't this basically the same thing as taking a cube and mapping it onto a sphere, like cubemap projection or something?
     
  10. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,572
    That's not it. I'm fine with using subdivision surffaces, and I definitely wouldn't want patch-based approach (which is what, IIRC, 3dsmax had many years ago when I last tried it). It is just I'd love to have a way to avoid geometry "jumps" when I split an edge into two and I'd like to try keeping number of points to absolute minimum.

    I'm using blender. The problem is not a difference between subdivision levels, but the situation when you have low-poly control geometry, stretch something out far away, and then add edge-loop in the middle of it. In this case, there will be significant change in the shape of subdivided surface. It is manageable, but mildly annoying.

    Hmm... I'll check out the algorithm. I probably won't be using modo, though. IIRC it is something like $500.

    There's no connection whatsoever between cubemap projection and subsurf modeling.
     
    Last edited: Sep 1, 2016
  11. tswalk

    tswalk

    Joined:
    Jul 27, 2013
    Posts:
    1,109
  12. Deleted User

    Deleted User

    Guest

    Well you should also check out Maya LT which is $30.00 a month and Modo Indie which cost's nowhere near that, although I did pay full price for mine.. You live and learn.

    Firstly in Maya LT it's opensubdiv, secondly even if that doesn't do it for you there's alg's to smooth out low poly meshes without having to add additional edge loops (well not many), which smooth's the average difference of vertex's. Also you can use a sub-div proxy, which allows you to compare the original shape if there's something you don't like.

    No matter what you do, smoothing does have some border edge placement changes. But you can minimise it by of course using different things.. Also it has to be the simplest DCC, or at least the most straight forward I've ever used.!
     
  13. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,572
    Blender has opensubdiv support (in viewport, though)... and papers linked by @tswalk suggest that it is still catmull-clark, meaning it'll work exactly the same way as in blender. Also, I could justify subscription only if I were modeling fulltime.

    Meaning that I"ll check the videos/information about algorithms, but most likely won't be switching to either software.
     
  14. Deleted User

    Deleted User

    Guest

    It is still catmull (open subdiv) but, there are other things you can do in both Maya and Modo as said like smooth average and SDS..
     
  15. Deon-Cadme

    Deon-Cadme

    Joined:
    Sep 10, 2013
    Posts:
    288
    Its not going through the low poly, vertices points because that would result in either flat surfaces, lots of bumps or craters.

    You can manipulated the "hardness" in Blender but personally found it to be more trouble then it is worth. The other option which I prefer is to move the vertices to the sub-surface mesh through the modifier.

    The reason that the original, low poly mesh gets so horribly distorted is that each vertice work roughly the same way a "handle" work when you do vector based 2D drawing. You sometimes have to move those handles way of to get the vector curve that you need.
     
    Martin_H likes this.
  16. tswalk

    tswalk

    Joined:
    Jul 27, 2013
    Posts:
    1,109
    what about simply modifying the surface normals per vertex?... it may be an operation that could be done in a surface shader perhaps to take the original "hard" angle vertex normal, and run some filtering on them to then project a smoother surface?

    IDK, i'm just thinking out loud now which gets me in a lot of trouble often... :)
     
  17. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    6,025
    If the result of the catmull subdivision is too slim It might be worth fattening it up a bit by scaling the whole mesh along normals (alt-s).

    I looked into Modo indie due to its seemingly good hardsurface tools, but far as I know there's no scripting your own stuff (nor in Maya Lite). The possibilities of customising stuff are way too useful for me to consider dropping blender. If only there was an easier way to set up your own modifiers without recompiling though ...
     
  18. Mwsc

    Mwsc

    Joined:
    Aug 26, 2012
    Posts:
    189
  19. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,572
    It is not about surfaces being hard or shaders. I would want subdivided surface to go through original points. I.e. instead of acting like some sort of surface version of a bezier curve:

    I'd want it to act like a surface version cardinal/catmull-rom spline

    ... on arbitrary geometry.
     
  20. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436

    How do those behave when you go from a straight line into a curve? E.g. how would you model a capsule shape like the Unity default capsule mesh with this?
     
    neginfinity likes this.
  21. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,572
    That's actually a good point which I didn't consider. And thinking about it, making this shape with a surface that passes through control points will be incredibly difficult.

    .... I guess I'll have to stick with catmull-clarck subdivision.
     
    Martin_H likes this.
  22. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,794
    There's also Spline Patching.
     
  23. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,501
    upload_2017-3-28_17-35-21.png

    This is my way idea of how to make a new type of tessellation subdivision. Is just the combination of both + parameters values. The combination is "simple subdivision" in the flat zone and "catmull-clark subdivision" in the corners where angles are bigger than "angle value" and the catmull-clark subdivision length extension is driven by a radius factor. I never implement it. here is a drawing
    upload_2017-3-28_17-35-21.png

    I did not draw the front surface subdivision but was also the intention to have multiple possibilities in xyz or a combination of all. In this way, you can fix the radius in in X and Y and for the front face give a different smaller value. Useful for the instrument. But mu skills at the moment are not at the level to implement it.

    I post here the idea: Now if you replace the simple section with catmull-clark subdivision, then you obtain a very nice looking hard surface object. Because you have 2 type of radius: one along the surface and the other that runs along the edges of the given angle (in the corners). With a very little information, you are getting a lot of smooth curve surface detail in your subdivision. And that game object will look more industrial. In general Industrial object are made by radius.

    02 Instruments SoaringSimulator.jpg
     
    Last edited: Apr 20, 2017
    cdarklock likes this.
  24. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,501
    Anyway, @neginfinity did you find any Catmull-Clark subdivision solution for Unity? It can be nice to apply it in the LOD0. I wish not to make the subdivisions in Blender or Rhino. I wish that my LOD is increased and reduce when the engine is installed (maybe a substance shade?)
     
  25. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,572
    ...

    At the time of posting this question I was not interested in having subdivision surface solution in unity but was instead looking for a solution that would allow making organic/character models - using subdivision surfaces - using absolute minimum number of control points. I.e., a modeling technique.

    Eventually I let the idea go due to reasons mentioned by @Martin_H .

    Unity supports subdivision through hull shaders/tesselators (on both OpenGL/DirectX), however it only works on triangle domain which greatly limits its applications. Quad domain would be a much better idea, but it is not supported, plus the way triangulation is done in hardware tesselator is... awkward.

    I suppose one could either abuse geometry shaders for purposes of different tesselation, or attempt to perform tesselation via a compute shader.

    Speaking of the screenshots you posted.... catmull clark subdivision, when applied to a cube would form a sphere, and when applied to a square, it would form a circle. In both cases subdivided surface would go below original bounds, so the shapes you posted do not really resemble catmull-clark/subdivision.

    However, overall the pictures (the part where the shape has flat surface) strongly resemble "Edge Crease" technique which is already present in Blender 3d:
    subdiv.png
    ^^^ This is a catmull-clark subdivided cube. Wireframe indiates original mesh.

    This is a blender-specific feature, which, according to at least some people, is not normally present in other packages.
     
    AlanMattano and Martin_H like this.
  26. ippdev

    ippdev

    Joined:
    Feb 7, 2010
    Posts:
    3,853
    C4D has had weighted HYPERNurbs since 2010.
     
  27. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,572
    Nurbs are not catmull-clark subdivision.

    Either way the reason why I wrote that is because I received adivce not to rely on edge-creases too much, since they're normally absent from other packages. Haven't checked every package out there, so I don't know how true is that.
     
  28. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    Even if they all had it there would be no standardized way of transfering the information via exchange formats (afaik at least) and you can't rely on their implementation to behave the same. I occasionally will still use them if it happens to be a very convenient solution for what I want to do with an edge, but I can be fairly certain that I don't need to exchange the files with other people.
     
  29. ippdev

    ippdev

    Joined:
    Feb 7, 2010
    Posts:
    3,853
    And the C4D Nurbs are not nurbs but parametric generators.
     
  30. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,501
    No... "Edge Crease" technique work well for my character
    But not for industrial design as for example the watch, helmet, etc... [the picture you post] converts it into a bubble gum soft elliptical surface that contains not radius or surface of second-degree.
    example of industrial radius surface of second-degree..



    I make 3d since 80s Alias 90s then maya, max, rhino, cinema4d, ZBrush blender. And also work close modeller making cars in catia and a lot of other more professional surface modellers specific for industrial designing and making ferraris, wally etc. For industrial design game objects, we need a solution that scales up the quads and that do not use a 4 degree elliptical soft surface. Is missing this component in the 3d software industry probably because is more for game design and game workflow was needing less poly than industrial design. But now my soaring simulator has the same amount of poly than my industrial design presentations and is good for a 2020 game.

    For making 3d I'm using Blender subdivision modifier tool.

    Going up from low poly we need something new. A soft that scales up low poly in different ways conserving UV and geometry surface degree. Or if is a character makes a 5 6 7 degrees surface interpolation. Probably we can ask same game asset developer to create a good automatic subdivision modifier. I will ask Chris West if he can do something.

    I did not test it, but lLook this...
    https://forum.unity3d.com/threads/krabl-mesh-processors-released.220686/page-2#post-3040743
     
    Last edited: Apr 21, 2017
  31. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,572
    True, catmull clark is not suitable for this.

    Few things, though .... isn't a standard practice for those kind of surfaces to use constructive solid geometry based approach? (then again, blender has fairly poor support for both parametric objects and CSG).

    I also vaguelly recall a package called Rhino3d which - if I remember it correctly - was a heavily parametric application centered around NURBS.
     
    Martin_H likes this.
  32. Per

    Per

    Joined:
    Jun 25, 2009
    Posts:
    460
    A compensation factor can be added to control points to offset them when they're created and try to maintain the surface curvature, however unless the other points can also be changed the fitting will always have marked differences due to the fundamental problems with all cubic interpolations.

    It's much easier to opt for NURBs surfaces instead, of course b-splines are quadratics too, but the hull's control points exist on the surface rather than some distance away and as the values are weighted (not dissimilar algorithmically to bezier handles) it's quite possible to conform with a fairly low cost calculation when adding in control points.

    For NURBs modelers I'd recommend Moi over Rhino, it's developed by an ex Rhino dev but is IMO much friendlier and has rather good import and export options. If you do use NURBs be aware that unless you build your own NURBs import and rendering you will likely face some heavy teselation bills in your game engine. MOI exports very clean geo, but that doesn't mean you shouldn't be prepared for some heavy decimation and optimization sessions in your immediate future. OTOH you were talking about using subdivision surfaces so I'm guessing you're already not that worried about heavy geo.
     
  33. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,501
    In a game, we need to ship surface with a higher range of LOD as possible. From a square up to the heaviest LOD geo that that hardware can support.

    My 2017 workflow for my industrial photorealistic game object is:
    • Alias Catia SolidEdg Maya Rhino Grasshopper or other similar NURBS type surface. If you wish IMO
    • convert the surface into a fixed number of triangles inside that 3d or Rhino modeller. [ link list ]
    • Inside ZBrush retopology
    • Or in Blender (or 3DMax) make one more time the surface and within 1 2 3 levels of subdivision surface.
    • Make the UV in Blender and paint it in Substance Painter
    • Import into Unity LOD component the default simple mesh plus the subdivision surface.
    This last point, It is stupid to ship the subdivision surface in the game because is smarter to apply the subdivision in the game at first start. And for this, you need a better FBX with advanced features.

    I use Rhino to convert IGES into mesh because conserves pretty well the normal map. But, the process conversion takes too much time, fail in same cases. When retopo or making the mesh in Blender I lose the radius feeling in the process. I loose completely the real shape in same cases.

    In the FBX component is missing standardised information about how to scale subdivide up LOD for each individual triangle or quad loop. Or for each edge loop how to apply the radius in the chamfered corner. And / Or there is no software to make simple shapes and just apply radius... And this can be optimised
    @neginfinity ...if you apply or Catmull-Clark to a box you obtain a sphere. If you apply Catmull-Clark to only a square corner or edge (only a portion corner) you obtain a radius. So if you extend it to more edge loops you obtain radius. Doo-sabin is an alternative.
    Conclusion: An extra information in the FBX can help a lot here to ship simple geometry and helps also in the creation of complex accurate geometry in a much simple way.
     
    Last edited: Apr 22, 2017