Commit Graph

84 Commits

Author SHA1 Message Date
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
e1fd7b9ca9 Cycles: Report currently sampling tile when CPU is working on the last tile
This is mainly useful for the render farms output when logging might stop at
the "Path Tracing Tile N/N" string, which makes it a bit difficult to follow
what exactly is happening (node going crazy, hardware issues or just last tile
is too much heavy).

This is more like an experiment, might be changed in the future.
2015-06-18 16:15:37 +02:00
Sergey Sharybin
27ed75271c Cycles: Make hair, object and motion blur selective compiled into OpenCL
This features are now based on the scene settings, so scenes without those features
used are rendered even faster.

This gives about 30% speedup on the AMD A10 APU here, but at the same time it does
not mean such an improvement will happen on all the hardware. That being said, the
Tonga device here seems to have no measurable difference.

In any case it seems handy to have for the future, when we'll want to support SSS
in the kernel or to port selective compilation/split kernel to CUDA devices.
2015-06-08 11:15:39 +02:00
Sergey Sharybin
3127d47029 Cycles: Fix wrong max nodes group used for the viewport render 2015-06-01 19:49:53 +05:00
Sergey Sharybin
da34136de1 Cycles: Check for validity of the tiles arrays in progressive refine
In certain configurations (for example when start resolution is set to small
value for background render and progressive refine enabled) number of tiles
might change in the tile manager. This situation will confuse progressive
refine feature and likely cause crash.

We might also add some settings verification in the session constructor, but
having an assert with brief explanation about what's wrong should already be
much better than nothing.
2015-05-19 12:42:07 +05:00
Sergey Sharybin
f868be6295 Cycles: Check for whether update/write callbacks are set prior to calling them
This changes the progressive refine part, regular update was already checking
for whether callbacks are set.
2015-05-19 12:42:07 +05: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
f680c1b54a Cycles: Communicate number of closures and nodes feature set to the device
This way device can actually make a decision of how it can optimize the kernel
in order to make it most efficient.
2015-05-09 19:28:00 +05:00
Sergey Sharybin
17c95d0a96 Cycles: Add utility function to count maximum number of closures used by session
This will be used by split kernel in order to compile most optimal kernel.

Maximum number of closures is actually being cached in the session, so viewport
rendering will not trigger kernel re-loading when number of closures goes down.
2015-05-09 19:17:49 +05:00
Sergey Sharybin
b3299bace0 Cycles: Pass requested tile size to the device via device task
This is currently unused but crucial for things like calculating amount of
device memory required to deal with the tasks.

Maybe not really best place to store it, but consider it good enough for now.
2015-05-09 19:09:07 +05:00
Sergey Sharybin
0e4ddaadd4 Cycles: Change the way how we pass requested capabilities to the device
Previously we only had experimental flag passed to device's load_kernel() which
was all fine. But since we're gonna to have some extra parameters passed there
it makes sense to wrap them into a single struct, which will make it easier to
pass stuff around.
2015-05-09 19:05:49 +05:00
Sergey Sharybin
d0aae79505 Cycles: More instant feedback on progressive rendering for first sample
Main purpose of this change is to make material preview appearing more
instant after the shader tweaks.
2015-04-06 19:28:25 +05:00
Sergey Sharybin
5ff132182d Cycles: Code cleanup, spaces around keywords
This inconsistency drove me totally crazy, it's really confusing
when it's inconsistent especially when you work on both Cycles and
Blender sides.

Shouldn;t cause merge PITA, it's whitespace changes only, Git should
be able to merge it nicely.
2015-03-28 00:15:15 +05:00
Sergey Sharybin
888d810185 Cycles: Use lower progressive update timeout for preview rendering
This ways previews are refreshing with the same ratio as job was expecting
this to happen, giving more instant feedback on the changes.
2015-02-21 17:30:29 +05:00
Lukas Stockner
193871ae7d Cycles: Ignore preprocessing time in ETA calculation
This patch makes Cycles ignore the time spent in BVH construction etc. when
estimating the remaining time. Considering that the remaining time is calculated
based on the average time per tile so far, as far as I understand it makes no
sense to include the preprocessing time.

Reviewers: sergey, #cycles

Reviewed By: sergey, #cycles

Subscribers: sergey

Projects: #cycles

Differential Revision: https://developer.blender.org/D895
2015-01-14 23:14:16 +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
Sergey Sharybin
bd0b9ed0c0 Cycles: Add dedicated Progress::set_error() call
Currently it acts the same as set_cancel(), but this way we're able to
distinguish situations when rendering was aborted by user demand (for
example pressing Esc in standalone renderer) or if something went horribly
wrong (for example out of VRAM error).
2014-12-05 22:15:04 +05:00
0d9e6a736a Fix T40262: cycles GPU bake crash due to kernels not loaded, randomly due to thread timing. 2014-05-19 19:33:09 +02:00
Dalai Felinto
eec3eaba08 Cycles Bake
Expand Cycles to use the new baking API in Blender.

It works on the selected object, and the panel can be accessed in the Render panel (similar to where it is for the Blender Internal).

It bakes for the active texture of each material of the object. The active texture is currently defined as the active Image Texture node present in the material nodetree. If you don't want the baking to override an existent material, make sure the active Image Texture node is not connected to the nodetree. The active texture is also the texture shown in the viewport in the rendered mode.

Remember to save your images after the baking is complete.

Note: Bake currently only works in the CPU
Note: This is not supported by Cycles standalone because a lot of the work is done in Blender as part of the operator only, not the engine (Cycles).

Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Bake

Supported Passes:
-----------------
Data Passes
 * Normal
 * UV
 * Diffuse/Glossy/Transmission/Subsurface/Emit Color

Light Passes
 * AO
 * Combined
 * Shadow
 * Diffuse/Glossy/Transmission/Subsurface/Emit Direct/Indirect
 * Environment

Review: D421
Reviewed by: Campbell Barton, Brecht van Lommel, Sergey Sharybin, Thomas Dinge

Original design by Brecht van Lommel.

The entire commit history can be found on the branch: bake-cycles
2014-05-02 21:19:09 -03:00
eecc426d86 Fix cycles standalone file saving not taking number of samples into account properly. 2014-04-16 15:28:24 +02:00
976f59ab8c Fix cycles standalone not writing images in background mode properly. 2014-04-15 15:19:23 +02:00
2ab9a0ff09 Fix cycles standalone not saving renders in background mode. 2014-04-14 14:11:07 +02:00
Sergey Sharybin
74518b2826 Fix T39420: Cycles viewport/preview flickers, when moving mouse across editors
Issue was caused by the wrong usage of OCIO GLSL binding API. To make it
work properly on pre-GLSL-1.3 drivers shader is to be enabled after the
texture is binded to the opengl context. Otherwise it wouldn't know the
proper texture size.

This is actually a regression in 2.70 and to be ported to 'a'.
2014-03-26 15:58:53 +06:00
Martijn Berger
85a0c5d4e1 Cycles: network render code updated for latest changes and improved
This actually works somewhat now, although viewport rendering is broken and any
kind of network error or connection failure will kill Blender.

* Experimental WITH_CYCLES_NETWORK cmake option
* Networked Device is shown as an option next to CPU and GPU Compute
* Various updates to work with the latest Cycles code
* Locks and thread safety for RPC calls and tiles
* Refactored pointer mapping code
* Fix error in CPU brand string retrieval code

This includes work by Doug Gale, Martijn Berger and Brecht Van Lommel.

Reviewers: brecht

Differential Revision: http://developer.blender.org/D36
2013-12-07 12:26:58 +01:00
Brecht Van Lommel
60e5abe71f Fix a few issues reported by coverity scan. 2013-09-03 22:39:21 +00:00
Brecht Van Lommel
29f6616d60 Cycles: viewport render now takes scene color management settings into account,
except for curves, that's still missing from the OpenColorIO GLSL shader.

The pixels are stored in a half float texture, converterd from full float with
native GPU instructions and SIMD on the CPU, so it should be pretty quick.
Using a GLSL shader is useful for GPU render because it avoids a copy through
CPU memory.
2013-08-30 23:49:38 +00:00
Brecht Van Lommel
01e22d1b9f Cycles: more code refactoring to rename things internally as well. Also change
property name back so we keep compatibility.
2013-08-23 14:34:34 +00: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
Thomas Dinges
8cda3264bd Code cleanup:
* Some typo fixes.
2013-08-13 08:43:31 +00:00
Thomas Dinges
a18112249d Cycles / Non-Progressive integrator:
* Non-Progressive integrator is now available on the GPU (CUDA, sm_20 and above). 

Implementation details:
* kernel_path_trace() has been split up into two functions:
kernel_path_trace_non_progressive() and kernel_path_trace_progressive().

* We compile two CUDA kernel entry functions (in kernel.cu) for the two integrators, they are still inside one .cubin file but due to the kernel separation there should be no performance problem. I tested with the BMW file on my Geforce 540M and the render times were the same for 100 samples (1.57 min in my case).

This is part of my GSoC project, SVN merge of r59032 + manual merge of UI changes for this from my branch.
2013-08-09 18:47:25 +00:00
Thomas Dinges
51a3371d87 Code cleanup / Cycles:
* Use USHRT_MAX rather than manual value, suggested by Campbell.
2013-07-19 22:56:54 +00:00
Thomas Dinges
fd1d4151f1 Fix for [#36216] Viewport render with CMJ sampler and unlimited passes freezes
* If Preview Samples are set to 0 (unlimited) it now assumes 65536 instead of INT_MAX. 

This doesn't affect regular sampling, you can still enter fixed values of 100k or whatever.
2013-07-19 14:00:53 +00:00
Brecht Van Lommel
0309f442bb Render stats text: show elapsed time for blender internal, hide useless "Single Layer"
at the start, more clearly indicate what the render time of the last frame was, some
other tweaks for consistency.
2013-06-24 22:41:24 +00:00
Brecht Van Lommel
b20a7e01d0 Cycles: experimental correlated multi-jittered sampling pattern that can be used
instead of sobol. So far one doesn't seem to be consistently better or worse than
the other for the same number of samples but more testing is needed.

The random number generator itself is slower than sobol for most number of samples,
except 16, 64, 256, .. because they can be computed faster. This can probably be
optimized, but we can do that when/if this actually turns out to be useful.

Paper this implementation is based on:
http://graphics.pixar.com/library/MultiJitteredSampling/

Also includes some refactoring of RNG code, fixing a Sobol correlation issue with
the first BSDF and < 16 samples, skipping some unneeded RNG calls and using a
simpler unit square to unit disk function.
2013-06-07 16:06:22 +00:00
Thomas Dinges
11707119de Cycles:
* Code cleanup, remove unused "resolution" variable from the DeviceTask class, was never used.
2013-05-14 21:18:20 +00:00
Stuart Broadfoot
638b084f82 Cycles Hair: Strand Minimum Pixel Size
Code is added to restrict the pixel size of strands in cycles. It works best with ribbon primitives and a preset for these is included. It uses distance dependent expansion of the strands and then stochastic strand removal to give a fading. To prevent a slowdown for triangle mesh objects in the BVH an extra visibility flag has been added. It is also only applied for camera rays.

The strand width settings are also changed, so that the particle size is not included in the width calculation. Instead there is a separate particle system parameter for width scaling.
2013-04-15 21:38:31 +00:00
Brecht Van Lommel
7404c1a553 Fix another part of #34877: cycles progress status text not showing correct with
per render layer samples in addition to the progress bar.

Also fixed job progress bar not working at all on high DPI / retina, was so small
the actual progress was not visible.
2013-04-05 17:57:26 +00:00
Sergey Sharybin
ae385fb61c Correction for fix #34205: Zooming in rendered mode during update out of sync with intended zoom
Didn't initially notice one possibility when GPU render would fail here,
2013-02-13 07:50:41 +00:00
Sergey Sharybin
b3b9931276 Fix #34205: Cycles: Zooming in rendered mode during update out of sync with intended zoom
Made sure no pause_cond.wait() happens at the same time as session as resetting.
2013-02-12 13:06:52 +00:00
Brecht Van Lommel
d686b1c20f Fix small memory leak in cycles tile render, a few bytes for each tile.
Reported by "aquo" on IRC.
2013-02-06 21:32:34 +00:00
Campbell Barton
296444e1dc style cleanup: some warnigs & spelling. 2013-02-06 14:02:19 +00:00
Thomas Dinges
41c588256b Cycles / Tile Rendering:
* Added new option to chose the tile order.
In addition to the "Center" method, 4 new methods are available now, like Top -> Bottom and Right -> Left. 

Thanks to Sergey for code review and some tweaks!
2013-01-07 19:55:49 +00:00
Sergey Sharybin
2e0e2cb170 Highlight currently rendering tiles
This commit implements highlight of tiles which are being currently
rendered for both Blender Internal and Cycles (and should be possible
to use it for other external engines as well).

Couple of implementation details:

- Added one extra boolean flag to render engine which should be set
  to truth if render engine wants to highlight tiles. If so, property
  use_highlight_tiles should be set to True.

- Render Part's ready boolena was changed by status enum, which could
  be NONE, IN_PROGRESS and READY. All render part with IN_PROGRESS
  status will be highlighted in image editor.

- For external engines render part's status is filling in automatically.
  Initially all render parts has got NONE status, then one external
  engine acquire render result, corresponding part will change status
  to IN_PROGRESS. As soon as render result is finished, corresponding
  render part will change status to FINISHED

  This should make it easy to highlight tiles for other engines as well.
2013-01-01 16:15:13 +00:00
Brecht Van Lommel
bb0195e039 Fix #33337: cycles crash with progressive refine and multiple render layers. 2012-11-28 19:57:29 +00:00
Campbell Barton
1c1e7a0237 avoid divide by zero in cycles progress calculation 2012-11-13 01:53:07 +00:00
Sergey Sharybin
76525d5398 Cycles: persistent images option
This option enables keeping loaded images in the memory in-between
of rendering.

Implemented by keeping render engine alive for until Render structure
is being freed.

Cycles will free all data when render finishes, optionally keeping
image manager untouched. All shaders, meshes, objects will be
re-allocated next time rendering happens.

Cycles cession and scene will be re-created from scratch if render/
scene parameters were changed.

This will also allow to keep compiled OSL shaders in memory without
need to re-compile them again.

P.S. Performance panel could be cleaned up a bit, not so much happy
     with it's vertical alignment currently but not sure how to make
     it look better.

 P.P.S. Currently the only way to free images from the device is to
       disable Persistent Images option and start rendering.
2012-11-09 08:46:53 +00:00
Campbell Barton
353ad46e10 code cleanup: quiet double promotion warnings 2012-11-07 23:52:33 +00:00
Brecht Van Lommel
204113b791 Fix #33107: cycles fixed threads 1 was still having two cores do work,
because main thread works as well.
2012-11-07 21:00:49 +00:00
Sergey Sharybin
6eec49ed20 Cycles: memory usage report
This commit adds memory usage information while rendering.

It reports memory used by device, meaning:

- For CPU it'll report real memory consumption
- For GPU rendering it'll report GPU memory consumption, but it'll
  also mean the same memory is used from host side.

This information displays information about memory requested by Cycles,
not memory really allocated on a device. Real memory usage might be
higher because of memory fragmentation or optimistic memory allocator.

There's really nothing we can do against this.

Also in contrast with blender internal's render cycles memory usage
does not include memory used by scene, only memory needed by cycles
itself will be displayed. So don't freak out if memory usage reported
by cycles would be much lower than blender internal's.

This commit also adds RenderEngine.update_memory_stats callback which
is used to tell memory consumption from external engine to blender.
This information is used to generate information line after rendering
is finished.
2012-11-05 08:04:57 +00:00