Commit Graph

15 Commits

Author SHA1 Message Date
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
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
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
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
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
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
Sergey Sharybin
c17cb50ae2 OpenSubdiv: Make more flexible C-API to specify FVar interpolation 2018-07-10 14:40:45 +02:00
Sergey Sharybin
164575af29 OpenSubdiv: Properly respect Subdivide UVs option 2016-07-22 17:53:00 +02:00
Sergey Sharybin
aa316c73e0 OpenSubdiv: Prepare majority of things to have proper subdivided UV
Mainly the changes are related on establishing API to feed UV islands
to OpenSubdiv, so it will know all the connectivity information and
will be able to do proper interpolation.

Island calculation is currently rather slow, not sure how to make it
fast and not use lots of allocations.

Shouldn't be THAT bad, since this code is only runs once when creating
OSD mesh, and it's probably still faster than our orientation code.
2016-07-21 12:34:57 +02:00
Sergey Sharybin
f0f60d775d OpenSubdiv: Initial work to support UV maps in textured OSD viewport
A bit work in progress, currently the following limitations:

- Texture shading only, Material shading will come later

- No UVs subdivision yet

- Always uses active UV and currently changing active UV will
  not properly update the viewport.

Well, need to start somewhere :)
2016-07-20 14:16:38 +02:00
Mike Erwin
f9e8de0b26 minor cleanup: spelling/wording 2015-11-14 13:48:15 -05:00
Sergey Sharybin
f1e68474e0 OpenSubdiv: Support for multiple materials in solid shading mode
Implementation is less optimal compared to non-opensubdiv drawing but
it is now as good as we can do it without affecting on how patches are
being created by OpenSubdiv.
2015-08-25 15:11:56 +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