Commit Graph

149 Commits

Author SHA1 Message Date
Sergey Sharybin
05ee67a7c8 OpenSubdiv: Make internal evaluator aware of batched evaluation
Allows to pass multiple patch coordinates for evaluation.
2019-10-30 15:15:55 +01:00
Sergey Sharybin
ca3a96c243 OpenSubdiv: Use more generic access to patch coordinates
Saves another unnecessary temporary data copy during evaluation.
2019-10-30 15:15:55 +01:00
Sergey Sharybin
d3c87876c9 OpenSubdiv: Cleanup, remove old compatibility code
Consider that all builders have face-varying evaluation now.
2019-10-30 15:15:55 +01:00
Sergey Sharybin
5843827fb9 OpenSubdiv: Cleanup, remove unused class 2019-10-30 15:15:55 +01:00
Sergey Sharybin
4227a35b32 OpenSubdiv: Avoid unnecessary memory copies
Make evaluator itself to write directly to the output buffer.

Brings unmeasurable speedup and makes it possible to simplify
some buffer class logic.
2019-10-30 15:15:55 +01:00
Sergey Sharybin
31873218b2 OpenSubdiv: Use smaller buffer sizes and strides
We currently don't support interleaved varying data, so can make
some buffer smaller.
2019-10-30 15:15:55 +01:00
Sergey Sharybin
b4fb3db559 OpenSubdiv: Cleanup, remove unused PatchBuffer class 2019-10-30 15:15:55 +01:00
Sergey Sharybin
8e470033ab OpenSubdiv: Cleanup, remove unused evaluator member 2019-10-30 15:15:55 +01:00
Sergey Sharybin
7dda8f7faf OpenSubdiv: Cleanup, remove unused static methods 2019-10-30 15:15:55 +01:00
Campbell Barton
312075e688 CMake: add missing headers, use space before comments 2019-10-29 01:33:44 +11:00
Sergey Sharybin
0cc45eaac4 OpenSubdiv: Add accessor to vertex edges via refiner C-API 2019-10-03 12:36:01 +02:00
Campbell Barton
fb9024bded Fix error in opensubdiv topology refiner face matching check 2019-10-03 07:32:28 +10:00
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
Campbell Barton
47adab4f99 CMake: prepare for BLENDER_SORTED_LIBS removal
No functional change, this adds LIB definition and args to cmake files.
Without this it's difficult to migrate away from 'BLENDER_SORTED_LIBS'
since there are many platforms/configurations that could break when
changing linking order.

Manually add and enable WITHOUT_SORTED_LIBS to try building
without sorted libs (currently fails since all variables are empty).
This check will eventually be removed.

See T46725.
2019-04-14 15:37: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
ab5e69e660 Cleanup: remove contributors for CMake files
Following removal from C source code.

See: 8c68ed6df16d8893
2019-02-05 09:10:32 +11: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
Campbell Barton
1450a37555 CMake: add missing headers 2018-09-06 21:23:25 +10: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
010e24a95c OpenSubdiv: Remove UV coordinates from converter
Converter only defines topology, not coordinates or (face)varying data.
2018-07-16 11:12:02 +02:00