Commit Graph

60592 Commits

Author SHA1 Message Date
Campbell Barton
abbd82a504 Use looptri for mesh remapping 2015-07-23 15:10:12 +10:00
Campbell Barton
8155d25d39 Utility function to get poly -> looptri mapping 2015-07-23 15:08:27 +10:00
Campbell Barton
60822ec183 Use looptri for BVH raycast (simple cases) 2015-07-23 14:41:09 +10:00
Campbell Barton
717046ad2a Use looptri for volume snapping 2015-07-23 14:41:09 +10:00
Campbell Barton
748899a50a Missed adding BVH callbacks in recent commit 2015-07-23 14:41:09 +10:00
Campbell Barton
0bf2b207e2 Add missing break checking for tangents 2015-07-23 11:51:03 +10:00
Campbell Barton
368bd34573 Mesh Deform: support for ngons when binding
Weights were calculated using tessellation data, giving slightly uneven weighting.
Now only use tessellation for ray-cast but weight the influences from the original polygons.

Also cache arrays from derived-mesh, they we're called each intersection.
2015-07-23 11:30:47 +10:00
Antony Riakiotakis
0b7d0f913d Fix weight painting + mask not drawing in latest master.
Same issue as vertex painting - though one might wonder if we really
need to set material on such occasions.
2015-07-22 16:58:18 +02:00
Antony Riakiotakis
0795f62ddf GPU debug: Only flush stderr if needed. 2015-07-22 13:57:57 +02:00
Campbell Barton
5983280b4f Use looptri for MeshDeform modifier 2015-07-22 21:40:45 +10:00
Campbell Barton
b604d5ade0 Add bvhtree_from_mesh_looptri utility function 2015-07-22 21:40:45 +10:00
Campbell Barton
b305041ce6 Add DM_get_looptri_array utility function 2015-07-22 21:40:41 +10:00
Campbell Barton
a6f00bb75c Use doxy sections in bvhutils 2015-07-22 21:32:14 +10:00
Campbell Barton
df41f7bf4f Use const for BVH mesh arrays 2015-07-22 21:32:14 +10:00
Campbell Barton
f9a6780dc6 Cleanup: use struct for storing callback data 2015-07-22 21:32:14 +10:00
Sergey Sharybin
75d1723518 OpenSubdiv: Optimize speed of topology refiner construction
Now the conversion code uses mesh element mapping to speed up lookups.
Gives really nice speed improvement here, but the cost is higher memory
usage during refiner construction.

On the dragon scene here topology refiner construction time goes down
from 5 seconds to around 0.01.

It's possible to reduce the memory footprint by allocating mapping in
stages (don't allocate all of them at once, but do it on demand only
and free them after they're not needed anymore).
2015-07-22 12:51:10 +02:00
Sergey Sharybin
461340525e OpenSubdiv: Resolve crash when trying to do weight mcol 2015-07-22 12:01:38 +02:00
Bastien Montagne
945f32e66d Fix crash with recent refactor of customdata writing.
Caused by own rBff3d535bc2a6309 - since we now only write the exact amount of layers
needed to store saved customdata, we have to adjust CustomData->maxlayer too.

Otherwise, on next read, customdata code believes it has more layers allocated than
actual number.

Issue reported by Campbell over IRC, thanks.
2015-07-22 11:58:18 +02:00
Campbell Barton
cf6002737d Don't make Python classes of StructRNA on startup
This gives small start time speedup, classes are lazy loaded instead.

Keep existing behavior in debug builds to catch any errors early.
2015-07-22 19:51:03 +10:00
Sergey Sharybin
3dd8f287e1 Render preview: Make preview render database lazily loaded
Gives about 5-10% of startup time improvement here.
2015-07-22 11:25:21 +02:00
Sybren A. Stüvel
ec8b7edf53 Fix: solved issue with "make doc_py"
The error was "ValueError: Function <function normal_at_I0D at 0x7f2aad1feb70>
has keyword-only arguments or annotations, use getfullargspec() API which can
support them", and was first seen in eeeb845d33e81afbc8ed127e6ab4ae7b18472a54
2015-07-22 10:31:31 +02:00
Sergey Sharybin
e3461a02ac Fix T43779: Cycles texture interpolation issues
That was basically not an issue with interpolation, but rather missing wrapping
options and periodic wrapping was always used.

It's still a bit questionable why certain graphics cards were doing clamping in
the file from the report, that's not something what is expected to happen from
the settings of textures being passed to GPU. In any case this issue i still
didn't manage to reproduce on any of the available GPUs, might be something
related on driver glitch or so.

In any case CPU now should behave just fine, rest of the issues we'll need to be
able to reproduce first.
2015-07-21 22:13:25 +02:00
Sergey Sharybin
f2c54df625 Cycles: Expose image image extension mapping to the image manager
Currently only two mappings are supported by API, which is Repeat (old behavior)
and new Clip behavior. Internally this extension is being converted to periodic
flag which was already supported but wasn't exposed.

There's no support for OpenCL yet because of the way how we pack images into a
single texture.

Those settings are not exposed to UI or anywhere else and there should be no
functional changes so far.
2015-07-21 21:58:19 +02:00
Sergey Sharybin
dc3563ff48 Cycles: Implement camera zoom motion blur
Works totally similar to camera motion blur and majority of the changes are
related on just passing extra arguments to sync() functions.

Couple of things still to look into:

- Motion pass will not include motion caused by the zoom.
- Only perspective cameras are supported currently.
- Motion is being interpolated on projected coordinates, which might give
  different results from constructing projection matrix from interpolated
  field of view.

  This could be good enough for us, but we need to consider improving this
  at some point.

Reviewers: juicyfruit, dingto

Reviewed By: dingto

Differential Revision: https://developer.blender.org/D1383
2015-07-21 17:40:03 +02:00
Antony Riakiotakis
1df42798d4 Try to remap buffer before rejecting.
I suspect code here can be cleaned up but for now try this.
Alternatively we can check for errors around buffer allocation
but this needs bigger changes.
2015-07-21 16:41:13 +02:00
Sybren A. Stüvel
89e5c75666 Added Action.fcurves.find(data_path, array_index=0)
Finding a specific F-Curve is often needed in Python, and usually
consists of a construct like:

```
 [fcurve
  for fcurve in ob.animation_data.action.fcurves
  if fcurve.data_path == "location"][1]
```

This can now be written as
`ob.animation_data.action.fcurves.find('location', 1)`

This new function `Action.fcurves.find()` is still O(N) in the number
of FCurves in the Action, but at least it allows us to remove
boiler-plate code. It is also faster than the Python equivalent, as
only the found F-Curve is converted to Python.

Reviewers: campbellbarton, aligorith

Reviewed By: aligorith

Differential Revision: https://developer.blender.org/D1427
2015-07-21 16:01:26 +02:00
Antony Riakiotakis
e7fc8d98f5 Failure to alllocate vertex buffer would not fall back to vertex array
properly.

This should fix failure to use vertex arrays in OSX with high
polycounts.

Note this will not suffice as a fix when we move to VBOs exclusively
(GL 3+), we'll have to think of some way to separate huge meshes to many
VBOs.
2015-07-21 15:42:11 +02:00
Sybren A. Stüvel
78041fa14a Fix: fixed UI description of Action.new() function 2015-07-21 14:44:48 +02:00
Campbell Barton
9ae39a1312 Math Lib: use vector funcs for isect_line_line_v2_point 2015-07-21 21:49:29 +10:00
Bastien Montagne
ff3d535bc2 Fix T45471: Blend file: Bad old_addr handling in mesh's customdata writing.
Issue is rather well explained in T45471: our current customdata writing code easily generates several different blocks in blend file with same 'old' address. This is bad, because those addresses are used as 'uid' during reading process (it kind of work in Blender's own reading process, by mere luck mostly, but breaks the file specs).

Solution (suggested by Campbell, thanks) implemented by this patch is to avoid duplicating everything, and instead just overwrite what we needs to skip some cdlayers on write:
* the CustomData's `totlayer` number;
* the CustomData's `layers` array of CustomDataLayer (keeping its original address using the `writestruct_at_address` helper).

New design allows us to get completely rid of the no_free flag stuff in `write_customdata()`.

Note that this implies written data is **not** directly valid from Blend PoV, since its written typemap does not match written layers (this is not an issue because typemap is rebuilt on read anyway - and it's easy to fix this if really needed).

Also, the backward compatibility saving of mface data remains an issue here, see comment in code.

Reviewers: sergey, campbellbarton

Projects: #bf_blender

Maniphest Tasks: T45471

Differential Revision: https://developer.blender.org/D1425
2015-07-21 12:02:11 +02:00
Sergey Sharybin
b91d64a3d1 Cycles: Another attempt to solve CUDA compilation errors on 32bit platforms 2015-07-21 11:42:59 +02:00
Sergey Sharybin
b0df19667f Fix T45317: Cycles material preview unnecessarily re-rendering
The issue was caused by wrong fix for T22741 which forced redraws on any window
event, like Expose. Use proper NV_WM | ND_UNDO listener instead,
2015-07-21 11:26:42 +02:00
Bastien Montagne
b23c6c430f Fix assert in Outliner. 2015-07-21 10:43:22 +02:00
Sergey Sharybin
7ae44e8a30 Cycles: Workaround for sm_50 on 32bit platform
Basically this commit totally disables new SVN Voxel node, which solves some
of the compiler's issues.
2015-07-21 10:18:04 +02:00
Campbell Barton
23831b2161 Cleanup: style 2015-07-21 17:29:23 +10:00
Campbell Barton
ae00011956 Fix T45496: Crash loading file during preview
Regression from multi-view
2015-07-21 16:02:27 +10:00
Campbell Barton
9eb6dcbb46 Fix T45453: Driver button's ignore DPI 2015-07-21 15:30:34 +10:00
Campbell Barton
a48db0894a Fix T45363: Bone attrs ignore editing all selected 2015-07-21 15:22:32 +10:00
Campbell Barton
39cf1de33d Fix Clear vertex group ignoring selected option
Thanks to @chadf for spotting
2015-07-21 14:35:48 +10:00
Campbell Barton
9dc9f84740 Fix T45458: Edge Slide Mirror doesn't preserve UVs 2015-07-21 14:15:31 +10:00
Campbell Barton
5e1a8055f4 Fix T45361: Camera does not rotate in walk mode 2015-07-21 13:02:11 +10:00
Campbell Barton
3c911ff8a5 Fix T45450: Loop-select fails to cycle between overlapping edges 2015-07-21 12:27:41 +10:00
Campbell Barton
1d9fbdc9a0 Fix T45455: Select linked issue w/ hidden faces 2015-07-21 12:02:11 +10:00
Campbell Barton
1d02d34de9 Fix T45434: GPencil on editmode surface fails
Z-offset use for drawing & picking was problematic for extracting locations from depth values.

Use flag to optionally disable.
2015-07-21 11:12:39 +10:00
Campbell Barton
ef950d6937 Fix T45502: Crash showing thumbnails 2015-07-21 10:01:42 +10:00
Campbell Barton
2bfa950438 Cleanup: warning 2015-07-21 09:54:23 +10:00
Campbell Barton
b5f282b211 Remove nonnull attribute, NULL arg is valid here. 2015-07-21 09:41:48 +10:00
Sergey Sharybin
30772b6f09 SCons: Weirdly enough at some point scons became broken in OpenSubdiv branch 2015-07-20 22:43:13 +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
2466c4f8ce OpenSubdiv: Add OpenSubdiv files which are related on the CCGSubSurf and GPU
Those files are still not in use (SCons will tyr to compile new CCGSubSurf files
but no code will be in use at all because those new files are fully wrapped by
ifdef WITH_OPENSUBDIV check).
2015-07-20 22:29:25 +02:00