Commit Graph

5204 Commits

Author SHA1 Message Date
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
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
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
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
Bastien Montagne
6190d75b5a Usual UI messages fixes. 2015-07-20 22:22:31 +02:00
Antony Riakiotakis
ed3b19f46d Ugly hack to avoid GLEW context error printing when initializing GLX. 2015-07-20 14:56:36 +02:00
Sergey Sharybin
87328bde47 Fix T45218: Crash when trying to open System in the User preferences
Fix T45381: Crash Blender 2.75 in Win7 x64 AMD card

The issue is basically caused by graphics card driver which crashes when
querying OpenCL platforms. This isn't something we can really solve from
the CLEW side, because opencl.dll does exist in old driver and even has
all the needed symbols, but first ever call to clGetPlatformIDs crashes.

While rest of the blender works fine with those older ATI/AMD cards it's
really needed to solve crashes of OpenCL device enumeration.

Solution here is to force disable OpenCL platforms if we've detected that
display card is using old ATI/AMD driver. It's not really proper solution
so it's done in the python side where it's easy to do tweaks. Reasoning
behind this change is:

- If one uses really old driver it's likely because it's the latest one
  he/she can ever to install (because of discontinued support from AMD).

- If old card is used it's likely to not have dedicated GPUs for rendering.

- Even if there's a dedicated GPU device enumeration is likely to crash
  because of attempt to query OpenCL from the old card.

There are still some tweaks needed likely, but this commit should make
some of the configurations to work.
2015-07-20 12:46:56 +02:00
Antony Riakiotakis
bd28c25f9b Fix broken GLEW initialization. Initialize GLEW twice, once to get GLX
extensions, once to get final context extensions.

Not so nice because we get a warning on startup from GLEW, but at least
it GL extensions should work now.
2015-07-20 12:35:58 +02:00
Antony Riakiotakis
422ffd252a Pixel format selection now favours a format with a number of samples
closer to the one requested on Windows.

Patch D1384 by Benoit Bolsee.
2015-07-20 10:59:30 +02:00
Campbell Barton
e5e9fbfaf0 Replace MFace use by MLoopTri w/ remash modifier
D1419 by @lichtwerk
2015-07-20 14:42:35 +10:00
Campbell Barton
86e6d6695e GHOST/X11: Support GLX-Context flags
GHOST_ContextGLX was incomplete, ignoring profile-mask and profile-flags.
2015-07-20 13:32:20 +10:00
Campbell Barton
cd91fd655d GHOST: use simple stack array for glx attributes 2015-07-20 11:45:42 +10:00
Campbell Barton
98bf205c39 GHOST: correct GLX flag w/ WITH_GL_PROFILE_CORE
note that this is currently ignored, but better at least build for now.
2015-07-20 11:32:49 +10:00
Sergey Sharybin
4bca8a6bc5 Fix T45484: Regression OpenCL split: access violation
That was a primary school error caused by moving statements inside assert()
which effectivly disabled crucial code in release builds.
2015-07-18 23:30:19 +02:00
Sergey Sharybin
faeac63f68 Cycles: Fix compilation of OpenCL kernel after point density commit 2015-07-18 23:10:46 +02:00
Sergey Sharybin
9b40616249 Cycles: Point density texture support
This commit implements point density texture for Cycles shading nodes.

It's done via creating voxel texture at shader compilation time, Not
totally memory efficient, but avoids adding sampling code to kernel
(which keeps render time as low as possible), In the future this will
be compensated by using OpenVDB for more efficient storage of sparse
volume data.

Sampling of the voxel texture is happening at blender side and the
same code is used as for Blender Internal's renderer.

This texture is controlled by only object, particle system and radius.
Linear falloff is used and there's no turbulence. This is because
falloff is expected to happen using Curve Mapping node. Turbulence
will be done as a distortion on the input coordinate. It's already
possible to fake it using nose textures and in the future we can add
more proper turbulence distortion node, which then could also be used
for 2D texture mapping.

Particle color support is done by Lukas, thanks!
2015-07-18 22:49:10 +02:00
Sergey Sharybin
7d10798af2 Cycles: Add voxel texture sampler shader node
The idea of this node is to sampling of 3D voxels at a given coordinate
supporting different mapping strategies (world space mapping, object
local space etc).

Currently not in use, it's a preparation step for supporting point density
textures.
2015-07-18 22:09:20 +02:00
Sergey Sharybin
92a37993a5 Cycles: Camera frustum space object culling scene simplification
The idea is to give artists a simplier way to control memory usage in such
scenes as grass fields by doing automatic object culling based on whether
object is visible in the frame or not.

This is controlled on per-object level. In order to use this option few steps
are required:

- Enable Simplify in scene settings

- Enable Camera Cull option in the Simplify panel

- Set camera cull margin (measured in relative value to the render resolution)
  This setting is used to avoid possible flickering caused by changes in shadow
  which are cast by objects outside of the frame.

- Enable Camera Cull for objects which are desired to be culled
  (object culling option could be found in Option panel in object buttons).

There is still room for improvements, but this worked quite well during
Gooseberry open movie project, so think it's useful feature even in it's current
non-ideal state.
2015-07-18 18:17:22 +02:00
Sergey Sharybin
2ccfbf2f81 Cycles: Commit file missing from conditionally compiling baking kernel 2015-07-18 16:26:41 +02:00
Sergey Sharybin
cf14437ac9 Cycles: Log requested device features
Useful to have this always logged because otherwise it's needed to remove cached
kernels and check build flags to see which features are enabled.
2015-07-18 16:02:09 +02:00
Sergey Sharybin
45b5bf034b Cycles; Make baking a feature-specific option
This means render devices now might skip building baking kernels in cases when
only actual render-related functionality is used.

For now it's only implemented for OpenCL split kernel device and mainly needed
to work around some compiler-specific bugs which crashes on building the kernel.

Using OpenCL for baking might still crash the driver, but at least there is now
higher probability of that GPU will be usable to render the scene.

Real fix should actually be done in the driver side.
2015-07-18 16:02:08 +02:00
Sergey Sharybin
36a952e3e4 Cycles: Use feature-selective base kernel compilation when using split kernel
The idea is to make all kernels as small as possible to work around possible
issues with buggy drivers which might fail building feature-complete kernels.

It's indeed just a workaround to make at last simple test scenes to render
on OpenCL. Real fix should happen from the driver side.
2015-07-18 16:02:08 +02:00
Sergey Sharybin
5e4a8c6a87 Cycles: Some cleanup if OpenCL base kernel load_kernel()
Hopefully makes it less clumzy, should be no functional changes still.
2015-07-18 16:02:08 +02:00
Sergey Sharybin
025eda57da Cycles: Make OpenCL cache follow out code style a bit closer 2015-07-18 16:02:08 +02:00
Campbell Barton
ecb3e0fe73 Cleanup: whitespace & break placement 2015-07-18 19:03:22 +10:00
Sergey Sharybin
2199a3e38b CMake: Add option to enable -Werror cflag in some areas
It is rather annoying attitude nowadays to use const qualifier all over the
place, including using it for multi-dimensional arrays. This isn't really
supported in GCC prior to version 5.0 because it considers such an arrays
to be a "pointer to a const pointer" which gives implicit casting errors.

It's not possible to disable this particular type of warnings treated as
errors in any GCC version prior to 5.0 as well, meaning currently usage of
-Werror globally in Blender code is not possible at all.

This commit makes it possible to use -Werror in areas which are complaint
with older GCC versions. New advanced CMake options are:

- WITH_COMPOSITOR_WERROR
- WITH_LIBMV_WERROR
- WITH_CYCLES_WERROR
2015-07-18 10:49:51 +02:00
Campbell Barton
086ae3ea04 Cleanup: whitespace, wrong indent level 2015-07-18 18:42:59 +10:00
Campbell Barton
752eb64d60 Cleanup: whitespace (CMake) 2015-07-18 18:42:35 +10:00
Stefan Werner
51385f6fe8 Fix T45447: Area light importance sampling improvement
Turning on importance sampling on area lights increases noise on diffuse
surfaces. This was caused by PDF calculated for an intersected point on
light instead of original light position.

Patch by Stefan with some own modifications.
2015-07-16 08:33:13 +02:00
Sergey Sharybin
548e650252 Cycles: Merging of patch from OSX went wrong in the previous change
That's what happens when you can't commit from a system you're making
changes at and someone is behind your back...

Sorry for the noise.
2015-07-15 15:12:19 +02:00
Sergey Sharybin
2b97ad348c Cycles: Missed this in the previous commit 2015-07-15 15:11:02 +02:00
Sergey Sharybin
56bf25d219 Cycles: Enable OpenCL rendering on Apple OSX
Requires having latest El Capitan beta 3 OSX due to ome crucial fixes made in the
compiler. Supports same features as NVidia OpenCL apart from CMJ (there's no
experimental feature set support in megakernel yet).

Uses megakernel internally, which works much better than the split kernel. Split
kernel is not supported on OSX still, needs to be investigated still.

Some more details can be found there:

  http://wiki.blender.org/index.php/Dev:2.6/Source/Render/Cycles/OpenCL#AMD_on_OSX
2015-07-15 14:20:59 +02:00
Sergey Sharybin
a79d47b14e Cycles: Add logging to detected OpenCL platforms and devices
Happens on verbosity level 2, should help looking into some of the
bug reports in the tracker.
2015-07-14 09:56:00 +02:00
Sergey Sharybin
9f63cbf4a7 Fix T45333: Volume Scatter crash blender 2015-07-13 18:54:26 +05:00
Sergey Sharybin
686e8e452c Fix T45390: Cycles experimental displacement method ignores scaling when render
From artists perspective it makes sense to always apply displacement in a local
space.

TODO: Double-check that BVH is being packed properly. From quick tests seems it's
all fine, but might be missing some obvious failure still.
2015-07-13 15:24:56 +02:00
Thomas Dinges
d54e77b66d Cycles: Expose "Max Bounces" for the world light.
When using MIS, the world is treated as regular light and in this case
we can now also limit the maximum amount of bounces, the background light
will contribute to the scene.

This can improve performance in some cases, where it's e.g. sufficient to
only have a contribution on first 1-2 bounces.
Examples can be found in the differential.

Differential revision: https://developer.blender.org/D1399
2015-07-12 17:56:54 +02:00
Sergey Sharybin
3dc86f586c Cycles: Add debug print about CLEW initialization status 2015-07-07 14:37:12 +02:00
Sergey Sharybin
37539962fe Cycles: Add an option to force disable all OpenCL devices
This way it's possible to disable OpenCL devices for AMD devices
which are considered whitelisted.
2015-07-07 14:18:45 +02:00
Campbell Barton
72565fbf30 Cleanup: style, spelling 2015-07-06 17:45:11 +10:00
Thomas Dinges
8d15cad449 Cleanup: Typo in comment. 2015-07-04 13:17:29 +02:00
Sergey Sharybin
36426c3ee2 Cycles: Code cleanup, double semicolon 2015-07-03 15:44:57 +02:00
Sergey Sharybin
c864f5d140 Cycles: Error enqueueing split kernels should no longer cause infinite loop 2015-07-03 12:13:38 +02:00
Sergey Sharybin
659e5234af Cycles: Use explicit indices for split kernel queues 2015-07-03 11:05:28 +02:00
Sergey Sharybin
b9f89b1647 Cycles: Code cleanup in split kernel, whitespaces 2015-07-03 11:03:56 +02:00
Antony Riakiotakis
626a287c89 Support debug contexts on win32 2015-07-02 20:06:02 +02:00
Antony Riakiotakis
00808eb39a Make OpenGL debug contexts a flag --debug-gpu instead of a compile time
option.

This makes sense, since contexts get created at runtime, there is little
reason to require recompilation for this.

Only works on linux currently, will be doing more OSs later
2015-07-02 19:30:17 +02:00