Commit Graph

68 Commits

Author SHA1 Message Date
Mai Lavelle
352ee7c3ef Cycles: Remove ccl_fetch and SOA 2017-03-08 00:52:41 -05:00
Sergey Sharybin
14a55bc059 Cycles: Fix shadowing variable which also causes use of uninitialized variable
Was causing wrong aperture for panorama cameras.

Seems to be a regression in 371d357.
2016-10-24 14:04:31 +02:00
Sergey Sharybin
48997d2e40 Cycles: Cleanup, style 2016-10-24 12:26:12 +02:00
371d3570e0 Fix Cycles address space OpenCL error after recent fix. 2016-10-22 23:36:30 +02:00
9d0ac94d52 Fix T49750: Cycles wrong ray differentials for perspective and stereo cameras. 2016-10-22 16:37:26 +02:00
Scott Wu
7fec7eee20 Cycles: use near clipping distance in panorama camera.
Reviewed By: sergey, brecht, dfelinto

Differential Revision: https://developer.blender.org/D1952
2016-10-15 00:26:59 +02:00
Mai Lavelle
013b46d6bd Cycles: Replace object index hack with actual checks for SD_TRANSFORM_APPLIED
Using ones complement for detecting if transform has been applied was confusing
and led to several bugs. With this proper checks are made.

Also added a few transforms where they were missing, mostly affecting baking
and displacement when `P` is used in the shader (previously `P` was in the
wrong space for these shaders)

Also removed `TIME_INVALID` as this may have resulted in incorrect
transforms in some cases.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2192
2016-09-11 13:49:05 -04:00
Sergey Sharybin
6353ecb996 Cycles: Tweaks to support CUDA 8 toolkit
All the changes are mainly giving explicit tips on inlining functions,
so they match how inlining worked with previous toolkit.

This make kernel compiled by CUDA 8 render in average with same speed
as previous kernels. Some scenes are somewhat faster, some of them are
somewhat slower. But slowdown is within 1% so far.

On a positive side it allows us to enable newer generation cards on
buildbots (so GTX 10x0 will be officially supported soon).
2016-08-01 15:54:29 +02:00
Sergey Sharybin
700722f686 Cycles: Cleanup, indent nested preprocessor directives
Quite straightforward, main trick is happening in path_source_replace_includes().

Reviewers: brecht, dingto, lukasstockner97, juicyfruit

Differential Revision: https://developer.blender.org/D1794
2016-03-25 13:55:42 +01: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
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
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
c9365e25a9 Cycles: Cleanup, spelling and indentation 2016-01-14 17:01:56 +05:00
Campbell Barton
0ded953eea Cleanup: warning/spelling 2016-01-09 22:56:43 +11:00
Sergey Sharybin
ade35bac93 Cycles: Implement rolling shutter effect
This is an attempt to emulate real CMOS cameras which reads sensor by scanlines
and hence different scanlines are sampled at a different moment in time, which
causes so called rolling shutter effect. This effect will, for example, make
vertical straight lines being curved when doing horizontal camera pan.

This is controlled by the Shutter Type option in the Motion Blur panel.

Additionally, since scanline sampling is not instantaneous it's possible to have
motion blur on top of rolling shutter.

This is controlled by the Rolling Shutter Time slider which controls balance
between pure rolling shutter effect and pure motion blur effect.

Reviewers: brecht, juicyfruit, dingto, keir

Differential Revision: https://developer.blender.org/D1624
2015-12-31 20:44:27 +05:00
Sergey Sharybin
6a529e14f4 Cycles: Support user-defined shutter curve
Previously shutter was instantly opening, staying opened for the shutter time
period of time and then instantly closing. This isn't quite how real cameras
are working, where shutter is opening with some curve. Now it is possible to
define user curve for how much shutter is opened across the sampling period
of time.

This could be used for example to make motion blur trails softer.
2015-10-28 02:43:06 +05:00
Dalai Felinto
58133d4ab2 Fix T45721: Panoramic render in Cycles camera : depth of field issue with bump maps - patch by Brecht Van Lommel 2015-08-07 15:04:12 -03: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
George Kyriazis
7f4479da42 Cycles: OpenCL kernel split
This commit contains all the work related on the AMD megakernel split work
which was mainly done by Varun Sundar, George Kyriazis and Lenny Wang, plus
some help from Sergey Sharybin, Martijn Berger, Thomas Dinges and likely
someone else which we're forgetting to mention.

Currently only AMD cards are enabled for the new split kernel, but it is
possible to force split opencl kernel to be used by setting the following
environment variable: CYCLES_OPENCL_SPLIT_KERNEL_TEST=1.

Not all the features are supported yet, and that being said no motion blur,
camera blur, SSS and volumetrics for now. Also transparent shadows are
disabled on AMD device because of some compiler bug.

This kernel is also only implements regular path tracing and supporting
branched one will take a bit. Branched path tracing is exposed to the
interface still, which is a bit misleading and will be hidden there soon.

More feature will be enabled once they're ported to the split kernel and
tested.

Neither regular CPU nor CUDA has any difference, they're generating the
same exact code, which means no regressions/improvements there.

Based on the research paper:

  https://research.nvidia.com/sites/default/files/publications/laine2013hpg_paper.pdf

Here's the documentation:

  https://docs.google.com/document/d/1LuXW-CV-sVJkQaEGZlMJ86jZ8FmoPfecaMdR-oiWbUY/edit

Design discussion of the patch:

  https://developer.blender.org/T44197

Differential Revision: https://developer.blender.org/D1200
2015-05-09 19:52:40 +05:00
Sergey Sharybin
d69c80f717 Cycles: Presumably correct workaround for addrspace in camera motion blur 2015-05-09 19:04:19 +05:00
Thomas Dinges
60679a171d Revert "Cleanup: Simplify camera sample motion blur code."
This reverts commit 8197f0bb645f73f41071daaccf205a7583e695f5.
2015-02-26 13:27:02 +01:00
Thomas Dinges
8197f0bb64 Cleanup: Simplify camera sample motion blur code. 2015-02-26 10:30:01 +01:00
Sergey Sharybin
09893ec7fc Cycles: Workaround for NVidia OpenCL compilation
It was complaining about explicit __constant to __private memory conversion,
which is now worked around using implicit conversion.

It's not a real fix i'm afraid and i'm still failing to build OpenCL kernel
with latest Linux drivers, but maybe it'll let someone else to investigate
what causes compiler to run out of memory?
2015-02-21 12:35:06 +05:00
Sergey Sharybin
54fd3f36a0 Fix T43195: Cycles uses clipping sphere instead of clipping plane
Basically the title tells it all, now Cycles uses proper clipping plane,
matching other render engines.
2015-01-14 02:34:49 +05:00
Thomas Dinges
ee36e75b85 Cleanup: Fix Cycles Apache header.
This was already mixed a bit, but the dot belongs there.
2014-12-25 02:50:24 +01:00
Dalai Felinto
146ed67d55 Cycles Aperture Ratio - option to produce anamorphic bokeh
Thanks for Aldo Zang for the help with the fix for the panorama/fisheye
depth of field calculation and the overall math.

Reviewed By: sergey, dingto

Subscribers: juicyfruit, gregzaal, #cycles, dingto, matray

Differential Revision: https://developer.blender.org/D753
2014-08-27 10:51:50 +02:00
Dalai Felinto
517094a697 Cycles: new camera_direction_from_point
Reviewers: brecht

Differential Revision: https://developer.blender.org/D556
2014-05-27 11:09:36 -03:00
e8b1cfed0a Cycles code refactor: replace magic ~0 values in the code with defines. 2014-03-29 13:03:47 +01:00
99f5993088 Cycles code refactor: improve vertex motion attribute storage and export.
This now supports multiple steps and subframe sampling of motion.

There is one difference for object and camera transform motion blur. It still
only supports two steps there, but the transforms are now sampled at subframe
times instead of the previous and next frame and then interpolated/extrapolated.
This will give different render results in some cases but it's more accurate.

Part of the code is from the summer of code project by Gavin Howard, but it has
been significantly rewritten and extended.
2014-03-29 13:03:46 +01:00
c18712e868 Cycles: change __device and similar qualifiers to ccl_device in kernel code.
This to avoids build conflicts with libc++ on FreeBSD, these __ prefixed values
are reserved for compilers. I apologize to anyone who has patches or branches
and has to go through the pain of merging this change, it may be easiest to do
these same replacements in your code and then apply/merge the patch.

Ref T37477.
2013-11-18 08:48:15 +01:00
Brecht Van Lommel
b9ce231060 Cycles: relicense GNU GPL source code to Apache version 2.0.
More information in this post:
http://code.blender.org/

Thanks to all contributes for giving their permission!
2013-08-18 14:16:15 +00:00
Brecht Van Lommel
3a89f98a24 Fix #36053: slow GPU render with panorama camera + depth of field. 2013-07-10 17:25:52 +00:00
Brecht Van Lommel
c53b20b683 Cycles: window texture coordinates now work with orthographic cameras, this
was an old issue since the first version.
2013-06-08 10:51:33 +00:00
Thomas Dinges
9e4914e055 Cycles:
* Revert r57203 (len() renaming)
There seems to be a problem with nVidia OpenCL after this and I haven't figured out the real cause yet. 
Better to selectively enable native length() later, after figuring out what's wrong. 

This fixes [#35612].
2013-06-04 17:20:00 +00:00
Thomas Dinges
c5ed6765b9 Cycles / Math functions:
* Rename some math functions:
len -> length
len_squared -> length_squared
normalize_len -> normalize_length

* This way OpenCL uses its inbuilt length() function, rather than our own. The other two functions have been renamed for consistency. 
* Tested CPU, CUDA and OpenCL compile, should be no functional changes.
2013-06-02 20:39:32 +00:00
Thomas Dinges
1f3bf34ccd Cycles :
* Use is_zero(a) rather than dot(a, a) == 0, saves some calculations.
2013-05-14 18:31:55 +00:00
Thomas Dinges
d46480377c Cycles / Orthographic Camera:
* Avoid one unneeded division by 1.0f and save one variable assignment.
2013-05-12 17:14:01 +00:00
Brecht Van Lommel
838949c3e7 Fix #35207: addition to previous fix to avoid OSL getting uninitialized
ray differentials for lighting, which could cause bad texture filtering
artifacts or performance.
2013-05-03 21:34:51 +00:00
Gaia Clary
92b6365e21 fix: #34871 Cycles/CUDA/sm_35: Build problems probably due to issues with float3 operators (on windows?) 2013-04-06 11:52:40 +00:00
Brecht Van Lommel
54363910bc Attempt to fix #34871: random CUDA 3.5 compile failure due to recent change. 2013-04-04 23:52:33 +00:00
Brecht Van Lommel
4c8e70d049 Fix #34700: orthographic camera DOF was still not working correct. 2013-04-03 17:32:30 +00:00
Brecht Van Lommel
de9dffc61e Cycles: initial subsurface multiple scattering support. It's not working as
well as I would like, but it works, just add a subsurface scattering node and
you can use it like any other BSDF.

It is using fully raytraced sampling compatible with progressive rendering
and other more advanced rendering algorithms we might used in the future, and
it uses no extra memory so it's suitable for complex scenes.

Disadvantage is that it can be quite noisy and slow. Two limitations that will
be solved are that it does not work with bump mapping yet, and that the falloff
function used is a simple cubic function, it's not using the real BSSRDF
falloff function yet.

The node has a color input, along with a scattering radius for each RGB color
channel along with an overall scale factor for the radii.

There is also no GPU support yet, will test if I can get that working later.

Node Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Nodes/Shaders#BSSRDF

Implementation notes:
http://wiki.blender.org/index.php/Dev:2.6/Source/Render/Cycles/Subsurface_Scattering
2013-04-01 20:26:52 +00:00
Brecht Van Lommel
40b05d364e Cycles: code refactoring to add generic lookup table memory. 2013-04-01 20:26:43 +00:00
Brecht Van Lommel
5dbe5fc496 Fix #34700: cycles depth of field now works with orthographic cameras too. 2013-03-21 02:38:11 +00:00
Brecht Van Lommel
543e06ce0e Fix #33915: tweak self intersection epsilon for motion blur a bit further, still
had some cases where there were artifacts. Also fix rendering error with shutter
time set to 0.
2013-01-23 16:56:02 +00:00
Brecht Van Lommel
ad10cbf04a Cycles: multiple importance sampling for lamps, which helps reduce noise for
big lamps and sharp glossy reflections. This was already supported for mesh
lights and the background, so lamps should do it too.

This is not for free and it's a bit slower than I hoped even though there is
no extra BVH ray intersection. I'll try to optimize it more later.

* Area lights look a bit different now, they had the wrong shape before.
* Also fixes a sampling issue in the non-progressive integrator.
* Only enabled for the CPU, will test on the GPU later.
* An option to disable this will be added for situations where it does not help.

Same time comparison before/after:
http://www.pasteall.org/pic/show.php?id=43313
http://www.pasteall.org/pic/show.php?id=43314
2013-01-09 21:09:20 +00:00