Commit Graph

5667 Commits

Author SHA1 Message Date
Sergey Sharybin
1c4f21f85e Cycles: Initial support of 3D textures for CUDA rendering
Supports both smoke/fire and point density textures now.

Reduces number of textures available for sm_20 and sm_21, but you have
to compromise somewhere on such a limited hardware.

Currently limited to linear interpolation only, and decoupled ray
marching is not supported yet. Think those could be considered just a
further improvement.

Some quick example:

  https://developer.blender.org/F282934

Code is minimal and we can fully consider it a fix for missing
support of 3D textures with CUDA.

Reviewers: lukasstockner97, brecht, juicyfruit, dingto

Reviewed By: brecht, juicyfruit, dingto

Subscribers: mib2berlin

Differential Revision: https://developer.blender.org/D1806
2016-02-15 21:26:29 +01:00
Martijn Berger
b5171e250c Make cycles standalone link again 2016-02-15 21:00:25 +01:00
Sergey Sharybin
c93069083e Cycles: Tweaks for 32bit CUDA binaries
Tweak some inline policies. Not totally crazy yet, and in fact we now
have one less ifdef statement now.
2016-02-15 19:11:02 +01:00
Sergey Sharybin
1336e97b12 Cycles: Use CUDA_64_BIT_DEVICE_CODE to detect which CUDA architecture to use
It is initialized based on size of pointer, which matches our previous
behavior, but using it in Cycles side allows to cross-compile CUDA
binaries.
2016-02-15 19:08:36 +01:00
Sergey Sharybin
06743f4018 Cycles: Make guarded allocator compatible with MSVC2015 2016-02-15 18:33:36 +05:00
Sergey Sharybin
6371fccdbe Cycles: Fix guarded allocator issues on Windows
The issue was caused by static vectors allocating some internal
data using rebound element allocator for them, which was causing
access to a non-initialized statistics objects and was failing a
lot when switching Blender to a fully guarded allocation.

Additionally, we were not able to free that internal memory before
Blender exits, which was causing false-positive memory leak prints.

Now we're not using GuardedAllocator for those proxy containers.

Ideally this should be done as a GuardedAllocator::rebind, but
it didn't work for vector<bool> because it seems some internal
parts are converting bool to char32_t, which either makes it so
we can't use GuardedAllocator for those vectors or the compiler
get's confused when we're trying explicitly allow GuardedAllocator
for rebind<char32_t>.

This with current approach we should be fine for the release.
2016-02-15 11:46:13 +01:00
Sergey Sharybin
7d85da882b Cycles: Fix infinite recursion of md5 calculation on Windows
Was caused by some safety things of making sure we've for NULL
terminator for the buffer when doing mbs<->wcs conversion, but
it turns out this simply confuses str::string and it can no
longer have proper .size(). Let's assume behavior of string
allocation is same all over the std, and we can avoid having
that extra null-terminator allocated.
2016-02-14 21:08:11 +05:00
701a4a4e09 Fix cmd+z for undo not working when editing text objects on OS X. 2016-02-13 22:54:02 +01:00
88770bed7c Fix T47393: mouse wheel scroll no longer zooms with mighty mouse on OS X.
Hopefully this is the last fix, using the method explained here:
https://forums.developer.apple.com/thread/31536
2016-02-13 16:07:55 +01:00
Thomas Dinges
6a593aba44 Cleanup: Move Cycles sky model data to util. 2016-02-13 13:41:40 +01:00
Sergey Sharybin
d1dd893487 Cycles: Remove meaningless expression 2016-02-13 13:29:50 +01:00
Sergey Sharybin
89b1f042cf Cycles: Fix compilation error on Windows 2016-02-13 13:29:13 +01:00
Sergey Sharybin
69dc0c3192 Cycles: Fixes for Burley BSSRDF
There are several fixes in here, which hopefully will make the shader
working correct without too much magic in there.

First of all, this commit brings BURLEY_TRUNCATE down from 30 to 16
which reduces noise a lot. It's still higher than original truncate
from Brecht, but this reduces PDF value at a cutoff distance by an
order of magnitude (now it's 0.008387, previously it was 0.063521
for the albedo of 0.8 and radius 1.0). This should converge to a
proper result faster and don't have artifacts.

This kind of reverts fix for T47356, but after additional thinking
came to conclusion Burley is not being totally smooth, it is about
giving less waxy results which it's kind of doing in the file.

Second of all, this commit fixes burley_eval() to use normalized
diffusion reflectance. This matches the way we calculate CDF and
solves numeric instability close to 0, making PDF profile looking
closer to other SSS profiles:

  https://developer.blender.org/F282355
  https://developer.blender.org/F282356
  https://developer.blender.org/F282357

Reviewers: brecht

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D1792
2016-02-13 13:29:13 +01:00
Thomas Dinges
83dc288689 Cleanup: Remove some OIIO code for versions prior to 1.5. 2016-02-13 13:21:47 +01:00
Sergey Sharybin
ae635771b2 Cycles: Fix crash caused by the guarded allocation commit
C++ requires specific alignment of the allocations which was not an
issue when using GCC but uncovered issue when using Clang on OSX.
Perhaps some versions of Clang might show errors on other platforms
as well.
2016-02-13 12:35:33 +01:00
Sergey Sharybin
1477028ea3 Cycles: Fix compilation error with MinGW
Was using some C++0 which we don't officially enabled yet.
2016-02-12 20:21:13 +01:00
Sergey Sharybin
c8d2bc7890 Cycles: Always use guarded allocator of vectors
We don't have vectors re-allocation happening multiple times from inside
a loop anymore, so we can safely switch to a memory guarded allocator for
vectors and keep track on the memory usage at various stages of rendering.

Additionally, when building from inside Blender repository, Cycles will
use Blender's guarded allocator, so actual memory usage will be displayed
in the Space Info header.

There are couple of tricky aspects of the patch:

- TaskScheduler::exit() now explicitly frees memory used by `threads`.
  This is needed because `threads` is a static member which destructor
  isn't getting called on Blender's exit which caused memory leak print
  to happen.

  This shouldn't give any measurable speed issues, reallocation of that
  vector is only one of fewzillion other allocations happening during
  synchronization.

- Use regular guarded malloc (not aligned one). No idea why it was
  made to be aligned in the first place. Perhaps some corner case tests
  or so. Vector was never expected to be aligned anyway. Let's see if
  we'll have actual bugs with this.

Reviewers: dingto, lukasstockner97, juicyfruit, brecht

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D1774
2016-02-12 15:43:26 +01:00
Sergey Sharybin
28604c46a1 Cycles: Make Blender importer more forward compatible
Basically the idea is to make code robust against extending
enum options in the future by falling back to a known safe
default setting when RNA is set to something unknown.

While this approach solves the issues similar to T47377,
but it wouldn't really help when/if any of the RNA values
gets ever deprecated and removed. There'll be no simple
solution to that apart from defining explicit mapping from
RNA value to Cycles one.

Another part which isn't so great actually is that we now
have to have some enum guards and give some explicit values
to the enum items, but we can live with that perhaps.

Reviewers: dingto, juicyfruit, lukasstockner97, brecht

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D1785
2016-02-12 15:27:33 +01:00
Thomas Dinges
164dfbeb50 Cycles: Remove some ifdefs for OSL < 1.7.1.
That means that we now only support OSL 1.7.1 or newer. Please update libs or re-run install-depsh.sh.
2016-02-11 13:58:50 +01:00
Sergey Sharybin
10cc4ae359 Cycles: Fix typo in network device
Spotted by jesterKing, thanks!
2016-02-11 13:05:55 +01:00
Sergey Sharybin
5237937a08 Cycles: Fix an AttributeErro exceptionr on missing object context
This happens when the properties panel is pinned to the material tab.

Patch by Ralf Hölzemer (aka cheleb), thanks!

Differential Revision: https://developer.blender.org/D1776
2016-02-10 10:35:39 +01:00
Aaron Carlisle
15f76ca072 Update link to avoid redirect 2016-02-10 01:05:10 +01:00
Sergey Sharybin
5a45ccaf3e Fix T47377: Newer file crashes at render on official 2.76b version
Really annoying bug, the code was not forward compatible at all and
resulted in crash. And it is really good to keep at least one release
forward compatibility so possible regressions could be verified easily.

The idea now is to use new property name for the pixel filter type,
but keep old property around for a couple of releases, so we have at
least some forward compatibility.

Don't like this situation at all, but seems it's least of the evil
we can choose.

Thanks Brecht for the review!
2016-02-10 04:10:52 +05:00
Sergey Sharybin
ba9992aa91 Cycles: Cleanp, avoid direct calls of RNA_enum_get, we've got utility for that 2016-02-10 03:27:07 +05:00
e927f8b424 Fix T47370: untranslateable bake panel strings.
Reorder buttons a bit so that these strings are not even needed, makes more
sense to have this grouped anyway.
2016-02-09 19:47:49 +01:00
Sergey Sharybin
2ac88328b0 Cycles: Fix Burley's CDF truncation after recent radius fix
This is all not really ideal, but good enough for tonight.
More thoughts and investigation tomorrow!
2016-02-08 21:50:38 +01:00
Sergey Sharybin
dae8326d1e Fix T47356: Too sharp falloww with Burley BSSRDF
After the clamping commit we need to bump BURLEY_TRUNCATE
constant a bit, otherwise mean free path does not really
match the disk radius needed for importance sampling.
2016-02-08 14:54:11 +01:00
Sergey Sharybin
578f70f288 Cycles: Fix access uninitialized light after recent refactor/fixes 2016-02-07 06:20:06 +05:00
Sergey Sharybin
e360080a04 Cycles: Refactor the way how we exclude light from the device
This unifies things around ignoring light due to lack of scene
contribution or due to other optimization tricks.
2016-02-07 02:21:38 +05:00
7faa9d1304 Fix T46550: Cycles combined baking black in some cases.
Now pass_filter is modified to have exactly the flags for the light components
that need to be baked, based on the shader type. This simplifies the logic.
2016-02-06 21:02:02 +01:00
Sergey Sharybin
c502114ee1 Cycles: Solve issues with auto-disabled MIS
There were two issues:

1. Memory leak: std:;erase does not call delete on the
   pointer (which is actually a good idea),

2. After MIS was disabled in viewport render there was
   no way to bring MIS back.

Now instead of removing light from the scene data we
kind of tagging it for an ignore. Possible cleanup
would be to add Light::is_enabled and use that instead
of passing weird and wonderful function arguments.
2016-02-06 20:43:44 +01:00
Sergey Sharybin
f25f7c8030 Cycles: Re-implement some utilities to avoid use of boost
The title says it all actually, the idea is to make Cycles
only requiring Boost via 3rd party dependencies like OIIO
and OSL.

So now there are only few places which still uses Boost:

- Foreach, function bindings and threading primitives.

  Those we can easily get rid with C++11 bump (which seems
  inevitable sooner or later if we'll want ot use newer
  LLVM for OSL),

- Networking devices

  There's no quick solution for those currently, but there
  are some patches around which improves serialization.

Reviewers: juicyfruit, mont29, campbellbarton, brecht, dingto

Reviewed By: brecht, dingto

Differential Revision: https://developer.blender.org/D1764
2016-02-06 19:19:20 +01:00
Sergey Sharybin
7623d3e071 Cycles: Add some utility tests using GTests
This is an initial move to have unittests to at least cover
utility functions, which then could be extended further to
test such areas as shader optimization and such.

Currently only based on initial "infrastructure" layout and
writing tests needed to test the no-boost patch.

Note: This patch starts to use "<dir>/<header>.h" notation
for the include statements which i just got used to do in
other projects. Something what would be cool to use globally
in the code eventually.

Reviewers: dingto, juicyfruit, lukasstockner97, brecht

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D1770
2016-02-06 19:19:20 +01:00
Sergey Sharybin
a90d5cd692 Cycles: Remove workaround for MSVC2010 and Boost
We've upgraded to Boost-1.60 and MSVC2013 since the workaround
was originally committed. After checks with current compiler and
libraries the original bug is no longer happening.

This will make string comparison much faster in Windows, solving
synchronization bottlenecks of fewzillion objects.

Thanks Martin Felke (aka scorpion81) for the tests!
2016-02-06 15:56:47 +01:00
e602fe60c0 Code cleanup: resolve minor Cycles todo's. 2016-02-06 11:56:37 +01:00
d5e929a9d3 Code cleanup: remove unused Cycles code from BVH cache. 2016-02-06 11:55:35 +01:00
4443bb8922 Fix Burley BSSRDF NaNs and fireflies.
Explicitly truncate to Rm same way as the Gaussian BSSRDF, and use safe_sqrtf()
to be sure in case of float precision issues.
2016-02-06 11:52:43 +01:00
Thomas Dinges
a6ca8a1b73 Cleanup: Remove support for OSL versions < 1.6.
We can get rid of more ifdefs once all platforms are on OSL 1.7 soon.
2016-02-06 00:07:20 +01:00
Thomas Dinges
66a9698978 Cycles: Change several default values (second batch).
This change the following values:
- World settings:
	- Use MIS: On
	- MIS Samples: 1
	- MIS Resolution: 1024

Enabling World MIS per default won't make simple backgrounds (flat background color) slower,
see previous commit. This gets disabled internally if World MIS is not actually needed.
2016-02-05 22:45:36 +01:00
Thomas Dinges
469447f707 Cycles: Auto disable World MIS, if we only use a simple color.
When World MIS is enabled by the user, we now check if we actually need it.
In case of a simple node setup (no procedurals, no HDRs..) we auto disable MIS internally to save render time.

This change is important for upcoming default changes.
2016-02-05 22:13:51 +01:00
Thomas Dinges
ca88bc5ac1 Cleanup: Rename has_heterogeneous_volume variable.
No functional changes, this change is done for consistency of upcoming changes.
2016-02-05 21:33:37 +01:00
Sergey Sharybin
c53c8df6d9 Cycles: ifdef some extra code when building split kernels 2016-02-05 14:11:16 +01:00
Sergey Sharybin
24ae7b9035 Cycles: Don't gray out integrator settings when userprefs are set to OpenCL but scene is set to CPU 2016-02-05 13:40:51 +01:00
Sergey Sharybin
e688a62712 Cycles: Fix for initial guess of the radius for Burley BSSRDF
The value was too high, causing bad Newton iteration step.
Now the value is not so good, but it's still within 9 iterations
and those high number of iterations are only happening in
approx 1% of input values.
2016-02-05 10:06:08 +01:00
Thomas Dinges
da7ddb69e9 Cycles / OSL: Updare stdosl.h to 1.7.1.
This updates our file to OSL 1.7.1, which comes with some new inbuilt
features:

- linearstep()
- smooth_linearstep()

- hash()
- getchar()
2016-02-05 00:05:26 +01:00
Thomas Dinges
fc3db32f04 Cleanup: Update BSSRDF code comment. 2016-02-04 22:42:55 +01:00
Sergey Sharybin
3e7389eaf2 Cycles: Speedup of Christensen-Burley SSS falloff function
The idea is simply to pre-compute fitting and parameterization
in the bssrdf_setup() function and re-use the values in both
sample() and eval().

The only trick is where to store the pre-calculated values and
the answer is inside of ShaderClosure->custom{1,2,3}. There's
no memory bump here because we now simply re-use padding fields
for the pre-calculated values. Similar trick we can do for other
BSDFs.

Seems to give nice speedup up to 7% here on my desktop with
Core i7 CPU, SSE4.1 kernel.
2016-02-04 15:29:58 +01:00
Thomas Dinges
f250aa9d86 Fix T47323, no Fac output in Magic texture (OSL). 2016-02-04 14:08:36 +01:00
Sergey Sharybin
ad26407b52 Cycles: Implement approximate reflectance profiles
Using this paper:

  http://graphics.pixar.com/library/ApproxBSSRDF/paper.pdf

This model gives less blurry results than the Cubic and Gaussian
we had implemented:

- Cubic: https://developer.blender.org/F279670
- Burley: https://developer.blender.org/F279671

The model is called "Christensen-Burley" in the interface, which
actually should be read as "Physically based" or "Realistic".

Reviewers: juicyfruit, dingto, lukasstockner97, brecht

Reviewed By: brecht, dingto

Subscribers: robocyte

Differential Revision: https://developer.blender.org/D1759
2016-02-04 13:27:23 +05:00
Sergey Sharybin
24eecb00de Cycles: Correction to asserts, they will never trigger before 2016-02-03 15:01:26 +01:00