Commit Graph

5712 Commits

Author SHA1 Message Date
Campbell Barton
b10e3cc997 Cleanup: warning 2016-03-13 15:15:38 +11:00
Sergey Sharybin
b20f12d835 Cycles: Some typo fixes 2016-03-12 15:01:20 +05:00
Sergey Sharybin
d652833a17 Cycles: Support parallel convergence mode for spherical stereo 2016-03-12 15:01:20 +05:00
Sergey Sharybin
6b91fb706d Cycles: Optimize derivatives calculation by using pre-calculated dx/dy
We've got pixel-wide world-space derivatives which we can use in the
perspective camera sampling. This allows to get rid of two calls to
transform_direction() function.

In theory we can save two transform_perspective() calls if we'll also
save pre-calculated camera-space dx/dy.
2016-03-12 15:01:20 +05:00
Sergey Sharybin
a8c87bad22 Cycles: Cleanup, spherical_stereo_direction will return normalized direction
Previously each call of this function was followed by a normaliztion, now it
is done in the function itself with an according note around the function.
2016-03-12 15:01:20 +05:00
Thomas Dinges
93895420eb Cycles: Do no limit viewport samples to USHRT_MAX when value is at 0.
We don't limit manually setting higher values, this was probably overlooked here.

Found by @Blendify in IRC.
2016-03-11 21:36:07 +01:00
Sergey Sharybin
758b20b8ca Cycles: One more optimization fix, derivatives used to be calculated without aperture
At this point it's totally unclear why we're ignoring aperture and and rolling shutter
now for derivatives calculation but do not ignore direction change caused by stereo.
2016-03-11 15:23:31 +05:00
Sergey Sharybin
e7eb91365b Cycles: Fix bug calculating dP for perspective camera
Was introduced by recent optimization. Not really sure derivatives are
intended to work like this, but better to stick to what Dalai had
originally for now.
2016-03-11 14:45:35 +05:00
Sergey Sharybin
ebe306b8d2 Cycles: Cleanup, redundant normalization 2016-03-11 14:45:35 +05:00
Martijn Berger
b5b269ac11 Fix compilation of cycles standalone and network device 2016-03-11 10:00:47 +01:00
Sergey Sharybin
0922b6d6de Cycles: Fix border render after spherical stereo commit
Buffer params needs to know camera's border, otherwise it'll create full buffer.

There might be some issues with stereo camera still, but in worst case it'll
only update camera twice as far as i can tell. Not ideal, but better than no
border render at all.
2016-03-11 12:58:28 +05:00
Sergey Sharybin
814fa06851 Cycles: Optimize spherical stereo position when no spherical stereo is used 2016-03-10 22:03:03 +05:00
Sergey Sharybin
59a7204797 Cycles: Simplify perspective camera derivatives calculation
Probably some further simplification is possible, will look into this later.
Alternatively will get rid of KernelCamera.{dx, dy}.
2016-03-10 21:48:12 +05:00
Dalai Felinto
de7a8af793 Multi-View: Cycles - Spherical Stereo support (VR Panoramas)
This is a new option for panorama cameras to render
stereo that can be used in virtual reality devices

The option is available under the camera panel when Multi-View is enabled (Views option in the Render Layers panel)

Known limitations:
------------------
* Parallel convergence is not supported (you need to set a convergence distance really high to simulate this effect).

* Pivot was not supposed to affect the render but it does, this has to be looked at, but for now set it to CENTER

* Derivatives in perspective camera need to be pre-computed or we shuld get rid of kcam->dx/dy (Sergey words, I don't fully grasp the implication shere)

* This works in perspective mode and in panorama mode. However, for fully benefit from this effect in perspective mode you need to render a cube map. (there is an addon for this, developed separately, perhaps we could include it in master).

* We have no support for "neck distance" at the moment. This is supposed to help with objects at short distances.

* We have no support to rotate the "Up Axis" of the stereo plane. Meaning, we hardcode 0,0,1 as UP, and create the stereo pair related to that. (although we could take the camera local UP when rendering panoramas, this wouldn't work for perspective cameras.

* We have no support for interocular distance attenuation based on the proximity of the poles  (which helps to reduce the pole rotation effect/artifact).

THIS NEEDS DOCS - both in 2.78 release log and the Blender manual.
Meanwhile you can read about it here: http://code.blender.org/2015/03/1451

This patch specifically dates from March 2015, as you can see in the code.blender.org post. Many thanks to all the reviewers, testers and minor sponsors who helped me maintain spherical-stereo for 1 year.

All that said, have fun with this. This feature was what got me started with Multi-View development (at the time what I was looking for was Fulldome stereo support, but the implementation is the same). In order to make this into Blender I had to make it aiming at a less-specic user-case	 Thus Multi-View started. (this was December 2012, during Siggraph Asia and a chat I had with Paul Bourke during the conference). I don't have the original patch anymore, but you can find a re-based version of it from March 2013, right before I start with the Multi-View project https://developer.blender.org/P332

Reviewers: sergey, dingto

Subscribers: #cycles

Differential Revision: https://developer.blender.org/D1223
2016-03-10 09:28:29 -03:00
Sergey Sharybin
5adfdd965a Fix T47681: Bump node doesn't work with SSS shader when using OSL 2016-03-07 15:32:46 +05:00
Campbell Barton
b8417501ab Cleanup: suspicious use of commas 2016-03-04 16:38:41 +11:00
Sergey Sharybin
3d3d491d40 Cycles: Fix wrong default value for volume samples 2016-03-02 14:53:36 +05:00
Sergey Sharybin
87c8ff0164 Cycles: Fix compilation error of certain OpenCL split kernels 2016-02-28 16:53:38 +01:00
Thomas Dinges
79c8eed843 Cleanup: Update Cycles standalone copyright info. 2016-02-27 13:07:32 +01:00
Sergey Sharybin
b6d9cbe654 Cycles: Fix bug in CMJ pattern when number of samples is 1
It was wrongly considering 1 is a power of 2. While it is a correct thing
(1 == 2^0) it's not what the math in some later formulas expects.
2016-02-24 14:23:45 +01:00
Sergey Sharybin
d3fa1bd4d5 Fix warnings reported by MSVC
Mainly it's related on a bad practice in SDL to force-define __SSE__
and __SSE2__ flags which generates quite some warnings and causes too
much noise.

There are some other warnings fixed. Should be no functional changes.

NeXyon, please check the changes in audaspace :)
2016-02-23 09:44:54 +01:00
Lukas Stockner
c359343f8d Fix T43388, fix T40369: Cycles baking not antialiasing textures.
This re-enables the AA jittering, but with proper clamping so that u >= 0,
v >= 0 and u+v <= 1.

Differential Revision: https://developer.blender.org/D1254
2016-02-21 15:10:51 +01:00
Sergey Sharybin
5f613f7b5d OCIO: Disable the warnings related on C4251
Those warnings are trigerred by stl classes in OCIO's public interface.

To quote MSDN: "C4251 can be ignored if you are deriving from a type in
the Standard C++ Library"

This is the only instance where those warnings hunts us, so for now we
can keep it all local in intern/opencolorio but this might be changed
in the future.
2016-02-20 14:06:11 +05:00
Sergey Sharybin
b2655167c6 GHost: Avoid macro re-definition by undefining the macro first
Should b totally harmless since the define was overriten anyway.
2016-02-20 14:06:10 +05:00
Sergey Sharybin
b30ab24fb8 Cycles: Avoid re-definition of math cnstants with MSVC 2016-02-20 14:06:05 +05:00
Sergey Sharybin
7c76479d5f Fix compilation error with FFmpeg and Ubuntu Trusty
Seems this is a confusion between Libav which was silently used
by Ubuntu instead of FFmpeg.
2016-02-19 22:05:06 +01:00
3c4f971392 Workaround for T47213: branched path sampling issues with CUDA 7.5. 2016-02-19 00:49:24 +01:00
Sergey Sharybin
da81227e54 Cycles: Fix wrong sample all direct/indirect settings on sm_50 and higher
Seems to be some compiler fault which leads to a wrong flag being used,
making it so wrong number of samples is used for the background.

This should in theory fix issue reported in T47213.
2016-02-18 16:29:35 +01:00
Lukas Stockner
a8fe3a1cee Fix T47461: Different results on CPU and GPU when using Branched Path Tracing
The issue here was actually somewhere else - the attached scene from the report used a light falloff node in a sunlamp (aka distant light).
However, since distant lamps set the ray length to FLT_MAX and the light falloff node squares this value, it overflows and produces a NaN
weight, which propagates and leads to a NaN intensity, which is then clamped to zero and produces the black pixels.

To fix that issue, the smoothing part of the light falloff is just ignored if the smoothing term isn't finite (which makes sense since
the term should converge to 1 as the distance increases).
The reason for the different results on CPUs and GPUs is not perfectly clear, but probably can be explained with different handling of
Inf/NaN edge cases.

Also, to notice issues like these faster in the future, kernel_asserts were added that evaluate as false as soon as a non-finite intensity is produced.
2016-02-18 01:23:38 +01:00
Sergey Sharybin
8cab327316 Cycles: Make CUDA 7.5 officially recommended
This was a hard decision, because going newer CUDA toolkit makes
rendering up to 5% slower. But on another hand, it solves major
speed regressions (up to 30%) with branched path tracing on a
top level cards.

Neither of those regressions have a meaningful and sane workaround
from the code itself.

Toolkit 6.5 could still be used, but it's no longer recommended one.
2016-02-17 15:18:56 +01:00
Sergey Sharybin
3857b4600f Cycles: Don't silence unused macro, remove the macro instead
It's not really handy to silence something unused hoping for it'll be
used in the future. We can end up with quite some silencing then.

Also made this flag which i find rather useless to NOT cause -Werror
in Cycles code.
2016-02-17 12:40:56 +01:00
Campbell Barton
d4e5e94ec7 Cleanup: unused define warning 2016-02-17 21:39:23 +11:00
Campbell Barton
88d4d0d070 Cleanup: OSL style 2016-02-17 21:39:23 +11:00
Sergey Sharybin
d6b77450ce Fix T47447: Cycles crash when reaching texture limit with 3D textures 2016-02-17 11:43:03 +01:00
Sergey Sharybin
4431caae1a Some more tweaks to make linking to a shared FFmpeg-3.0 happy 2016-02-17 10:48:46 +01:00
Lukas Stockner
8d95178c0b Fix T47411: Cycles portals luminance artifacts
When using multiple portals, scene areas behind one of the portals were rendered darker than they should.
The reason for that is a pretty stupid mistake: Since portals are only used at positions that aren't behind them,
only portals that are used should be accounted for in the PDF calculation. That was actually the case, but the final
divide incorrectly divided by the total amount of portals, not the amount of visible ones.

Another issue with areas behind portals was the PDF evaluation function.
The new evaluation code is shorter, simpler and fixes this issue.

Also, the threshold for the distance check was increased to avoid artifacts where portals touch a surface.
2016-02-17 03:06:30 +01:00
0ccae52394 Fix OpenCL kernel build errors after recent 3D texture changes. 2016-02-17 01:38:55 +01:00
833eb863eb Fix (harmless) assert in BVH spatial splits with Visual Studio debug builds. 2016-02-17 00:07:35 +01:00
Campbell Barton
1c958f5bef Cleanup: avoid -Wnarrowing warning 2016-02-17 05:18:47 +11:00
Sergey Sharybin
480b814e02 Cycles: Remove back some tweaks for inline policies
While kernel compiles fine, it seems generated binary is not really correct.
2016-02-16 17:25:58 +01:00
Sergey Sharybin
d0246d5f30 Cycles: Some cleanup, should be no functional changes
Addressing meaningful feedback from coverity.
2016-02-16 15:33:00 +01:00
Sergey Sharybin
63b60be6d7 Fix T47427: Crash caused by OSL 2016-02-16 13:38:07 +01:00
Thomas Dinges
ab5417870d Cleanup: Typo. 2016-02-16 13:00:44 +01:00
Sergey Sharybin
c5e1781944 Cycles: Fix crash when trying to render after re-enabling the addon 2016-02-16 12:47:31 +01:00
Sergey Sharybin
0b03785eb5 Make Blender compilable with FFmpeg-3.0
While it's not something we'll be using for the official release,
it's nice to support new libraries at least on "it compiles" level,
so it's not that many frustrated developers around.

Nexyon, please have a look into Audaspace changes :)
2016-02-16 12:34:15 +01:00
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