Commit Graph

14 Commits

Author SHA1 Message Date
Sergey Sharybin
fa4172c28c OpenSubdiv: Make sure faces are exported with consistent normal
This is currently a requirement of OpenSudiv and original orientation code
was depending on this quite a lot.

This makes mesh conversion and comparison slower but solves some crashes.
With some trickery it could be optimized and become closer to original
performance.

Probably Campbell has some nice ideas here as well :)
2015-08-06 09:49:13 +02:00
Sergey Sharybin
3aa2dd74b5 OpenSubdiv: Correction to vert edge/face orientation code
non-manifold case didn't start ordering from the correct edge.
2015-08-03 14:27:34 +02:00
Sergey Sharybin
4bf26fda97 OpenSubdiv: Mark non-manifold verts as sharp 2015-08-03 14:27:31 +02:00
Sergey Sharybin
dd1e7f16ca OpenSubdiv: Work on better vert edge/face orientation code
Previous version of code didn't handle cases like hourglass connectivity
with loose edge. The new code is supposed to handle all this cases.
2015-08-03 14:27:31 +02:00
Sergey Sharybin
5c7cdfcb42 OpenSubdiv: Remove debug-only leftover 2015-07-30 10:22:31 +02:00
Sergey Sharybin
7380166db2 OpenSubdiv: Workaround for vertices which are adjacent to several manifold islands 2015-07-29 18:41:05 +02:00
Sergey Sharybin
26c1ae81be OpenSubdiv: Proper detection of crease changes 2015-07-29 18:05:29 +02:00
Sergey Sharybin
48c2f7b288 OpenSubdiv: Some debug-only code sneaked into previous commit 2015-07-29 17:43:43 +02:00
Sergey Sharybin
51c1927ccb OpenSubdiv: Make topology orientation optional 2015-07-29 17:41:57 +02:00
Sergey Sharybin
717a303a18 OpenSubdiv: Fixes for crease in non-manifold meshes
Basically non-manifold edges are expected to be sharp by OpenSubdiv.

There\s still some work required, see the inlined comment.
2015-07-29 17:38:06 +02:00
Sergey Sharybin
b8e2b8ae8a OpenSubdiv: Rework vert-edge and vert-face ordering
Now the code survives multiple non-manifolds happening on the vert.

Still not totally optimal but at least gives much better mesh support.
2015-07-29 17:13:15 +02:00
Sergey Sharybin
af6bbab5b4 OpenSubdiv: Fix for weirdly ordered lines 2015-07-29 17:13:15 +02:00
Sergey Sharybin
3d36489672 OpenSubdiv: Commit of OpenSubdiv integration into Blender
This commit contains all the remained parts needed for initial integration of
OpenSubdiv into Blender's subdivision surface code. Includes both GPU and CPU
backends which works in the following way:

- When SubSurf modifier is the last in the modifiers stack then GPU pipeline
  of OpenSubdiv is used, making viewport performance as fast as possible.

  This also requires graphscard with GLSL 1.5 support. If this requirement is
  not met, then no GPU pipeline is used at all.

- If SubSurf is not a last modifier or if DerivesMesh is being evaluated for
  rendering then CPU limit evaluation API from OpenSubdiv is used. This only
  replaces the legacy evaluation code from CCGSubSurf_legacy, but keeps CCG
  structures exactly the same as they used to be for ages now.

This integration is fully covered with ifdef and not enabled by default
because there are several TODOs to be solved first:

- Face varying data interpolation is not really cleanly implemented for GPU
  in OpenSubdiv 3.0. It is also not implemented for limit evaluation API.

  This basically means we'll have really hard time supporting UVs.

- Limit evaluation only works with adaptivly subdivided meshes so far, which
  basically means all the points of CCG are pushed to the limit. This gives
  different result from old code.

- There are some serious optimizations possible on the topology refiner
  creation, which would speed up initial OpenSubdiv mesh creation.

- There are some hardcoded asumptions in the GPU and DerivedMesh areas which
  could be generalized.

  That's something where Antony and Campbell can help, making it so the code
  is structured in a way which is reusable by all planned viewport projects.

- There are also some workarounds in the dependency graph to make sure OpenGL
  buffers are only freed from the main thread.

Those who'll be wanting to make experiments with this code should grab dev
branch (NOT master) from

  https://github.com/Nazg-Gul/OpenSubdiv/tree/dev

There are some patches applied in there which we're working on on getting
into upstream.
2015-07-20 22:29:26 +02:00
Sergey Sharybin
a040157e5d OpenSubdiv: Add new OpenSubdiv related files
This includes C-API bindings in intern/opensubdiv and CMAke module
which finds the OpenSubdiv library. This filea are not in use so
far, making it a separate commit to make actual integration commit
more clear.
2015-07-20 22:29:25 +02:00