Commit Graph

52 Commits

Author SHA1 Message Date
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
Brecht Van Lommel
0d6976ad0c Fix #32900: object motion blur not working on the GPU. To make this work I disabled motion
blurring of scale animation, probably not a big loss in practice since it's not so common
to animate this, can be added back later.
2012-11-29 00:43:50 +00:00
Brecht Van Lommel
3a67122aef Fix #33256: cycles Z pass for orthographic camera was not right, now is more
useful for e.g. fog in compositing.
2012-11-21 13:00:57 +00:00
Brecht Van Lommel
6915394a3b Attempts to fix CUDA issues on sm 2.0 cards, still no luck getting motion blur
working, but this should make it not crash.

Also fix for wrong shutter time, should have been shorter.
2012-10-17 22:48:29 +00:00
Brecht Van Lommel
94f869a256 Cycles: camera motion blur enabled.
Still more work needed to get object motion blur ready.
2012-10-09 18:37:14 +00:00
Brecht Van Lommel
3f3fec37e5 Fix cycles panorama camera not working with depth of field, patch by
Daniel M. Basso, thanks!
2012-09-17 11:25:29 +00:00
Brecht Van Lommel
022d12a721 Fix most of #31307: cycles panorama camera not working correct with speed
vectors and window texture coordinates. Only for Fisheye Equisolid it's
still not working correct yet. Patch from Dalai with modifications.
2012-05-07 10:53:09 +00:00
Brecht Van Lommel
c0331cfc09 Cycles: minor refactoring of fisheye code to fit code style. 2012-05-05 19:44:35 +00:00
Dalai Felinto
d7fbe03a8a Fisheye Camera for Cycles
For sample images see:
http://www.dalaifelinto.com/?p=399 (equisolid)
http://www.dalaifelinto.com/?p=389 (equidistant)

The 'use_panorama' option is now part of a new Camera type: 'Panorama'.
Created two other panorama cameras:

- Equisolid: most of lens in the market simulate this lens - e.g. Nikon, Canon, ...)
             this works as a real lens up to an extent. The final result takes the
             sensor dimensions into account also.
             .:. to simulate a Nikon DX2S with a 10.5mm lens do:
                 sensor: 23.7 x 15.7
                 fisheye lens: 10.5
                 fisheye fov: 180
                 render dimensions: 4288 x 2848

- Equidistant: this is not a real lens model. Although the old equidistant lens simulate
               this lens. The result is always as a circular fisheye that takes the whole sensor
               (in other words, it doesn't take the sensor into consideration).
               This is perfect for fulldomes ;)

               For the UI we have 10 to 360 as soft values and 10 to 3600 as hard values (because we can).


Reference material:
http://www.hdrlabs.com/tutorials/downloads_files/HDRI%20for%20CGI.pdf
http://www.bobatkins.com/photography/technical/field_of_view.html

Note, this is not a real simulation of the light path through the lens.
The ideal solution would be this:
https://graphics.stanford.edu/wikis/cs348b-11/Assignment3
http://www.graphics.stanford.edu/papers/camera/


Thanks Brecht for the fix, suggestions and code review.
Kudos for the dome community for keeping me stimulated on the topic since 2009 ;)

Patch partly implemented during lab time at VisGraf, IMPA - Rio de Janeiro.
2012-05-04 16:20:51 +00:00
Brecht Van Lommel
1e2afcddd3 Fix #31168: cycles mask layer should only affect objects for camera rays.
Fix: texture coordinate normal output was not correct, still changed under
object transform.
2012-05-02 09:33:45 +00:00
Brecht Van Lommel
1d8c798188 Cycles: support for motion vector and UV passes.
Most of the changes are related to adding support for motion data throughout
the code. There's some code for actual camera/object motion blur raytracing
but it's unfinished (it badly slows down the raytracing kernel even when the
option is turned off), so that code it disabled still.

Motion vector export from Blender tries to avoid computing derived meshes
when the mesh does not have a deforming modifier, and it also won't store
motion vectors for every vertex if only the object or camera is moving.
2012-04-30 12:49:26 +00:00
Brecht Van Lommel
f7078dcbe2 Cycles: remove a few usages of double, to fix opencl warnings. 2012-04-30 10:03:13 +00:00
Brecht Van Lommel
93df58160e Fix #30966: cycles nan mesh vertices got set to (0, 0, 0), now remove them instead. 2012-04-16 08:35:21 +00:00
Brecht Van Lommel
b26d3f371a Fix #30603: cycles incorrect ray differentials when rendering with panorama
camera, causing bump map issues.
2012-03-20 19:32:12 +00:00
Brecht Van Lommel
4a90339519 Cycles: support for camera rendering an environment map with equirectangular
environment map, by enabling the Panorama option in the camera.

http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Camera#Panorama

The focal length or sensor settings are not used, the UI can be tweaked still to
communicate this, also panorama should probably become a proper camera type like
perspective or ortho.
2012-02-28 16:44:54 +00:00
Brecht Van Lommel
40259cfe7b Cycles: avoid using float3 in kernel constant memory, just so we're sure alignment
is working compatible between cpu and gpu.
2011-12-20 12:25:45 +00:00
Brecht Van Lommel
47853bf6f6 Cycles: OpenCL tweaks
* Reduce kernel arguments size, helps compile for apple nvidia.
* Fix use of unitialized variable in displace kernel.
* Use build flags in opencl kernel md5 hash.
* Reorganize code for kernel feature #defines a bit.
2011-11-22 13:15:19 +00:00