Commit Graph

35 Commits

Author SHA1 Message Date
ae6300a8b7 Fix T66022: crash adding subdivision surface modifier to some meshes
This reverts commit 7c9f64d00835:
"Fix T63766: Multiresolution behavior when using crease edge"
2019-06-23 00:03:36 +02:00
Sergey Sharybin
7c9f64d008 Fix T63766: Multiresolution behavior when using crease edge
Switch to Gregory basis patches which are tangent continuous across their
boundaries.

Originally we've used BSpline basis patches to be more compatible with the
old subdivision code, but a lot of things changed anyway.
2019-06-21 15:37:46 +02:00
Campbell Barton
a1ef2e4b16 Cleanup: comment, RNA spelling 2019-06-17 12:52:20 +10:00
Campbell Barton
4439e5d0ba Cleanup: add trailing commas to avoid right shift 2019-04-18 17:19:44 +02:00
Campbell Barton
e12c08e8d1 ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.

For details on usage and instructions for migrating branches
without conflicts, see:

https://wiki.blender.org/wiki/Tools/ClangFormat
2019-04-17 06:21:24 +02:00
Sergey Sharybin
9d1cab2eba Fix T63030: Edge crease is not applied for boundary edges
Caused by missing vertex sharpness comparison in the topology
comparator.
2019-03-28 11:49:08 +01:00
Campbell Barton
6cbb4c576a Cleanup: manually remove header text not handled by automation 2019-02-02 01:49:31 +11:00
Sergey Sharybin
baa5fe1bfc Cleanup: Spelling in comment 2019-01-23 10:27:55 +01:00
Sergey Sharybin
a8902ab49a Fix T58640: Round corner in edge crease of subdivided surfaces
Fix T60502: Creasing behavior on 2.8 seams wrong

Was a mistake in a boundary vertices sharpness calculation.
2019-01-22 15:35:30 +01:00
Sergey Sharybin
0ec77aaea5 Cleanup: space after template bracket 2019-01-22 13:51:21 +01:00
Sergey Sharybin
6ae72d2d41 OpenSubdiv: Remove topology orientation code
It is no longer used and has some issues in corner cases
which are not handled in a way which OpenSubdiv expects.
2019-01-16 11:00:43 +01:00
Sergey Sharybin
4fe6a2d950 OpenSubdiv: Implement UV topology comparison 2019-01-16 11:00:43 +01:00
Sergey Sharybin
e064777cac OpenSubdiv: Correct topology cpmparator
This fixes following errors:

- The code didn't work correctly for edges reconstructed by
  the OpenSubdiv's topology refiner (due to indexing
  difference).

- Sharpness of non-manifold and boundary edges was not
  working correctly.
2019-01-16 11:00:42 +01:00
Sergey Sharybin
5a794c9685 OpenSubdiv: Use own utility header
Replaces direct access to std.
2019-01-16 11:00:42 +01:00
Sergey Sharybin
f36f60543f OpenSubdiv: Cleanup, indentation 2019-01-16 11:00:42 +01:00
Sergey Sharybin
f19b3f9b77 OpenSundiv: Simplify tweaking of shared stencil/patch settings 2019-01-07 10:33:40 +01:00
Sergey Sharybin
a2a8e71210 OpenSubdiv: API, expose vertex boundary interpolation option
Only affects internal API, bout could be exposed as an option for
the compatibility reasons with other software.

Is a part of some ongoing development of multires, but might or
might not be used.
2018-10-31 17:47:40 +01:00
Sergey Sharybin
de811518c0 OpenSubdiv: Cleanup, the TODO was actually solved 2018-09-26 11:52:06 +02:00
Sergey Sharybin
3a15834d63 OpenSubdiv: Cleanup 2018-09-26 10:21:34 +02:00
Sergey Sharybin
8196b9d7bc OpenSubdiv: Add extra base level queries to topology refiner 2018-09-20 15:39:41 +02:00
Sergey Sharybin
4dfc846fe3 OpenSubdiv: Disable varying elements interpolation
We currently don't use those. Skipping creation of stencils for
them gives about 7% speedup of evaluation creation.
2018-09-04 12:38:54 +02:00
Sergey Sharybin
3c04ef63f8 Cleanup: Typo in comment 2018-09-04 12:30:06 +02:00
Sergey Sharybin
f8a499b596 OpenSubdiv: Add stub implementation of C-API
C-API is way smaller than the rest of the code which uses it.
So better to conditionally compile stub implementation than
to keep adding ifdef everywhere.
2018-08-13 12:37:18 +02:00
Sergey Sharybin
33fbc4fbea OpenSubdiv: Fix typo in crease comparison 2018-08-13 12:37:00 +02:00
Sergey Sharybin
200212079d Subsurf: Better crease which represents sharp edges
Enabled infinite sharp patches for topology refiner and evaluator,
which allows to have sharp edge at first subdivision level.

Also tweaked crease export from Blender to OpenSubdiv to have more
artistic control over the whole 0..1 range.
2018-08-02 12:24:55 +02:00
Sergey Sharybin
86270b60db Subsurf: Evaluate all UV layers
Before that it was only first UV layer which was properly evaluated,
the rest were ignored. Now all layers are being properly handled.
2018-08-01 18:43:03 +02:00
Sergey Sharybin
5b3b0ed54f Subsurf: Add API to provide vertex sharpness
Currently unused, added for the future and API completeness.
2018-08-01 18:42:59 +02:00
Sergey Sharybin
ec4ba68730 Subsurf: Fix/workaround crashes and failures with non-manifold geometry
The idea is simple: do not provide full topology to OpenSubdiv, leave
edges creation to OpenSubdiv itself. This solves issues with non-manifold
meshes which were known to fail, including the ones from T52059.

On a positive side we can simplify our side of converter, keeping code
shorter.

it is still possible that we'll need to ensure all loops has same
winding, but that is less things to worry about.
2018-08-01 18:42:59 +02:00
Sergey Sharybin
ebbeddd2f4 Subsurf: Use edge sharpness directly from converter
Seems it's behaving correct now, surely more tests needed, but
this is required for now to move forward.
2018-08-01 18:42:59 +02:00
Sergey Sharybin
08e6bccdf4 Subsurf: Support subdivision of loose elements
Applies to vertices and edges. Biggest annoyance here is that OpenSubdiv's
topology converter expects that there is no loose geometry, otherwise it
is getting confused.

For now solution is to create some sort of mapping from real Mesh vertex
and edge index to a non-loose-index. Now the annoying part is that this
is an extra step to calculate before we can compare topology, meaning FPS
will not be as great as if we knew for sure that topology didn't change.

Loose edges subdivision is different from what it used to be with old
subdivision code, but probably nice feature now is that endpoints of loose
edges are stay at the coarse vertex locations. This allows to have things
like plane with hair strands, without need to duplicate edge vertices at
endpoints.

All this required some re-work of topology refiner creation, which is now
only passing edges and vertices which are adjacent to face. This is how
topology refiner is supposed to be used, and this is how its validator
also works. Vertices which are adjacent to loose edges are marked as
infinite sharp. This seems to be good-enough approximation for now. In the
future we might tweaks things a bit and push such vertices in average
direction of loose edges, to match old subdivision code closer.
2018-08-01 18:42:59 +02:00
Sergey Sharybin
c64262a05a OpenSubdiv: Add API to evaluate face-varying data
There are move changes along the line to keep everything
working from from C.
2018-07-18 15:42:49 +02:00
Sergey Sharybin
e142339162 Fix compilation with older OpenSubdiv libraries
Only fixes compilation error, the functionality will be limited.

Currently we don't care that much, since all the work is done in
the branch anyway.

Later on when we'll know which fixes we need to apply on top of
latest OpenSubdiv library we will call a library upgrade.
2018-07-16 12:55:39 +02:00
Sergey Sharybin
775c4eb903 OpenSubdiv: Remove one more unused file 2018-07-16 12:34:19 +02:00
Sergey Sharybin
d3674587b2 OpenSubdiv: Remove unused file 2018-07-16 12:33:32 +02:00
Sergey Sharybin
d920382046 OpenSubdiv: Re-work C-API integration
Main goal is to make API simpler to follow (at least ion terms what
is defined/declared where, as opposite of handful big headers which
includes all the declarations), and also avoid a big set of long and
obscure functions.

Now C-API files are split into smaller ones, following OpenSubdiv
behavior more closely, and also function pointers in structures
used a lot more, which shortens functions names,

UV integration part in GL Mesh is mainly stripped away, it needs
to be done differently. On a related topic, UV coordinates API in
converter needs to be removed as well, we do not need coordinates,
only island connectivity information there.

Additional changes:

- Varying interpolation in evaluator API are temporarily disabled,
  need to extend API somewhere (probably, evaluator's API) to inform
  layout information of vertex data (whether it contains varying
  data, width, stride and such).

- Evaluator now can interpolate face-varying data.
  Only works for adaptive refiner, since some issues in OpenSubdiv
  itself.

Planned changes:

- Remove uv coordinates from TopologyConverter.
- Support evaluation of patches (as opposite to individual coordinates
  as it happens currently).
- Support more flexible layout of varying and face-varying data.
  It is stupid to assume varying is 3 floats and face-varying 2 floats.
- Support of second order derivatives.
- Everything else what i'm missing in this list.
2018-07-16 09:52:37 +02:00