Commit Graph

1070 Commits

Author SHA1 Message Date
Brecht Van Lommel
58a290234b Cycles: ray visibility options now work for lamps and mesh lights, with and without
multiple importance sampling, so you can disable them for diffuse/glossy/transmission.

The Light Path node here is still weak and does not give this info. To make that
work we'd need to evaluate the shader multiple times which is slow and we can't
detect well enough when it is actually needed.
2013-06-07 18:59:23 +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
Brecht Van Lommel
d835d2f4e6 Code cleanup: avoid some warnings due to implicit uint/int/float/double conversion. 2013-06-07 16:06:17 +00:00
Brecht Van Lommel
a604fb730d Cycles: mist pass added, with start/depth/falloff control. If the pass is
enabled in a render layer a Mist Pass panel will be shown in the world
properties.
2013-06-07 12:45:26 +00:00
Brecht Van Lommel
e66f3eb499 Cycles: GLSL materials now can use multiple UV maps with the attribute node. 2013-06-05 15:54:39 +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
Brecht Van Lommel
5d18bef762 Fix #35614: cycles objects on mask layer in render layers were writing passes
such as motion/uv/normal but they should have been excluded from them.
2013-06-04 15:41:45 +00:00
Brecht Van Lommel
3fe117bd3d Fix build error on non-x86 architectures as pointed out by Jochen Schmitt. 2013-06-04 11:21:13 +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
0fa08424b7 Code cleanup / Cycles:
* Avoid 2 int castings in hair code and fix some comments.
2013-06-02 14:52:29 +00:00
Thomas Dinges
e46a8f5d76 Fix for #35591:
* Cycles Mix closure could render strange effects, when the user entered a value out of the 0...1 range. This was already clamped for OSL, clamp for SVM as well.
2013-06-01 12:23:49 +00:00
Brecht Van Lommel
0ad88d1001 Fix another windows / msvc build error. 2013-06-01 02:39:34 +00:00
Brecht Van Lommel
4f056d1be7 Fix windows / msvc build error. 2013-06-01 02:28:57 +00:00
Brecht Van Lommel
2d0a586c29 Cycles OpenCL: keep the opencl context and program around for quicker rendering
the second time, as for example Intel CPU startup time is 9 seconds.

* Adds an cache for contexts and programs for each platform and device pair,
  which also ensure now no two threads try to compile and write the binary cache
  file at the same time.
* Change clFinish to clFlush so we don't block until the result is done, instead
  it will block at the moment we copy back memory.
* Fix error in Cycles time_sleep implementation, does not affect any active code
  though.
* Adds some (disabled) debugging code in the task scheduler.

Patch #35559 by Doug Gale.
2013-05-31 16:19:03 +00:00
Thomas Dinges
b0cf3a342d Cycles:
* Move some hair width related code into a dedicated branch.
* Don't calculate time/lens RNG when Motion Blur or Depth of Field are disabled
2013-05-30 11:05:02 +00:00
Campbell Barton
225c5fee6b move BLO_sys_types.h -> BLI_sys_types.h (it had nothing todo with loading)
remove MEM_sys_types.h which was a duplicate.
2013-05-28 19:35:26 +00:00
Brecht Van Lommel
27b8ea476d Cycles OpenCL: disable requirement of enabling Experimental, environment varibale
already adds an extra step. Also list all features for OpenCL AMD to make testing
easier.
2013-05-28 17:37:24 +00:00
Brecht Van Lommel
33d609144e Cycles: normal maps are now backwards compatible again after recent fix, with
a separate Blender Object/World Space that is compatible with Blender render
baking and uses the YZ flipping convention.
2013-05-28 14:24:03 +00:00
Brecht Van Lommel
601b8c1041 Fix #35505: cycles object space normal mapping did not match blender internal.
Now it uses the same (strange) YZ flipping convention.
2013-05-27 17:48:02 +00:00
Thomas Dinges
722680d7cf Cycles / OpenCL:
* Use advanced shading for nvidia as well, works fine on my Geforce 540M with sm_21. 
I tested the files from regression suite.
2013-05-27 17:13:36 +00:00
Brecht Van Lommel
4bdb54a76e Cycles OpenCL: patch #35514 by Doug Gale
* Support using devices from all OpenCL platforms, so that you can use e.g. both
  Intel and NVidia OpenCL implementations if you have them installed.
* Fix compile error due to missing fmodf after recent math node change.
* Enable advanced shading for Intel OpenCL.
* CYCLES_OPENCL_DEBUG environment variable for generating debug symbols so you
  can debug with gdb. This crashes the compiler with Intel OpenCL on Linux though.
  To make this work the preprocessed kernel source code is written out, as gdb
  needs this.
* Show OpenCL compiler warnings even if the build succeeded.
* Some small fixes to initialize cdDevice to NULL, add missing NULL check when
  creating buffer and add missing space at end of build options for Apple OpenCL.
* Fix crash with multi device + opencl, now e.g. CPU + GPU render should work.

I did a few tweaks to the code and also:

* Fix viewport render failing sometimes with Apple CPU OpenCL, was not taking
  workgroup size limits into account properly.
* Add compile error when advanced shading in the Blender binary and OpenCL kernel
  are not in sync.
2013-05-27 16:21:07 +00:00
Thomas Dinges
e51ee75e82 Cycles / Passes:
* Some closures (Toon, Diffuse Ramp) were not assigned to a CLOSURE_IS_* define, which made them invisible on render passes.
* Westin closures had wrong type, Sheen is Diffuse, Backscatter is Glossy.
2013-05-27 11:33:17 +00:00
Thomas Dinges
9c6deff652 Cycles / Fresnel:
* Avoid redundant assignment and use correct Normal for Ray Differentials.
2013-05-26 22:34:45 +00:00
Thomas Dinges
d76570c071 Cycles / Hair:
* Fix a condition in the hair BVH code.
2013-05-26 22:13:59 +00:00
Thomas Dinges
2efe0f6733 Cycles / OSL:
* Rename fresnel_dielectric() to fresnel_dielectric_cos() to match SVM, easier when searching code. 
* Also remove an old code comment in bsdf_reflection.h from Cycles branch days.
2013-05-26 17:10:22 +00:00
Thomas Dinges
9bf7a2a8c4 Cycles / Wireframe node:
* Make sure we have valid geometry data, fixes a crash with Lamp objects.

Reported by lichtwerk in IRC, thanks!
2013-05-25 13:34:21 +00:00
Thomas Dinges
99b325cebf Cycles / Toon BSDF:
* Added a toon bsdf node to Cycles. This was already available as OSL only closure, but is now available inside the SVM backed as well, for CPU and GPU rendering. 
* There are 2 variations available, diffuse and glossy toon, selectable via a menu inside the node. 

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

Example render & blend file:
http://www.pasteall.org/pic/show.php?id=51970
http://www.pasteall.org/blend/21579
2013-05-23 17:45:20 +00:00
Thomas Dinges
6b7d2ed8b6 Code cleanup / Cycles:
* Use M_2PI_F in more places and do multiplication instead of division in gradient texture.
2013-05-21 13:22:11 +00:00
Thomas Dinges
54bb3077e1 Code cleanup / Cycles:
* Re-use already defined Westin closure class.
2013-05-21 13:15:27 +00:00
Brecht Van Lommel
b11dc51974 Fix compiler warnings with westin OSL code. 2013-05-21 10:13:47 +00:00
Thomas Dinges
3758193c18 Cycles / Wireframe node:
* Added a wireframe node (Input category) to get access to Mesh wireframe data. 
The thickness can be controlled via a "Size" parameter, and is available in world units (default) and screen pixel size. 
* Only the triangulated mesh is available now, quads is for later. 

Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Nodes/More#Wireframe

Render and Example file:
http://www.pasteall.org/pic/show.php?id=51731
http://www.pasteall.org/blend/21510
2013-05-20 15:58:37 +00:00
Thomas Dinges
38dc85f296 Math Node:
* Added a Modulo operation to the math node, available in Compositor, Shader and Texture Nodes.
2013-05-20 14:38:47 +00:00
Thomas Dinges
289ca57e7a Code Cleanup / Cycles:
* Remove an unused parameter from Checker texture and correct a typo in license header.
2013-05-20 00:26:48 +00:00
Thomas Dinges
d12a5d8d63 Cycles:
* Fix OSL compilation for scene_intersect(), when __Hair__ was disabled.
2013-05-18 22:40:21 +00:00
Thomas Dinges
eaf493d323 Cycles / OSL:
* Added Westin Sheen and Westin Backscatter closures for testing, useful for Cloth like effects. 

Only available via OSL, added an example OSL shader to the Templates (Text Editor).
2013-05-18 14:36:03 +00:00
Thomas Dinges
75e36650e3 Code cleanup / Cycles:
* Simplify shaperadius() function a bit to avoid castings.
* Style cleanup 1.f -> 1.0f, to follow rest of Cycles code.
2013-05-18 11:04:29 +00:00
Bastien Montagne
9d567dd366 This commit addresses the somewhat weak handling of stackless textures in Blender with default (BI) renderer. To do so, it's defining an "other" texture context, and when in this one, it switches to using the "new shading" texture handling already known with Cycles engine.
So now, in the new "other" tex context, you can (depending on active data) have direct access to modifiers', force's or brushes' textures...

I also refactored a bit how texture contexts are handled (once again, we had some quite similar code in both space_buttons and RNA sources). This should also solve some harmless glitches like "no texture context selected in UI" sometimes when you remove data related to current texture (see e.g. after removing the material from default cube, in startup scene).

This usage of two different systems for textures, and the handling of switches between them, has been a bit tricky to get working right, but it is OK now I think. I also had to add a bool flag to buttons space, SB_TEX_USER_LIMITED (use_limited_texture_context in RNA), which indicates "new shading" texture code whether it has to ignore materials, lamps etc. (BI) or not (Cycles).

Btw, pinned textures from modifiers/force/etc. were also broken (showing nothing), now it should work too.

Thanks to Brecht for reviewing.
2013-05-17 07:10:10 +00:00
Thomas Dinges
616bc9d68f Code cleanup / Cycles:
* Put render resolution x/y into a function.
2013-05-16 21:53:21 +00:00
Thomas Dinges
8e487bebd3 Cycles / BSSRDF:
* Avoid one max() call for the bssrdf radius, the if condition already checks for values < BSSRDF_MIN_RADIUS.
2013-05-16 18:39:45 +00:00
Campbell Barton
f334df5624 code cleanup: double promotion warnings. 2013-05-16 17:20:56 +00:00
Thomas Dinges
34ba69d576 * This is embarrassing... 2013-05-16 15:59:05 +00:00
Thomas Dinges
4475de5bd8 Cycles:
* Revert part of r56832, if code gets more complicated, it's better to keep it more logical here.
2013-05-16 15:47:09 +00:00
Thomas Dinges
9b59e2b95a Code cleanup / Cycles:
* Some simplification of closure code (Velvet and Toon).
2013-05-15 20:38:17 +00:00
Brecht Van Lommel
693f687ebf Fix cycles CUDA error with world multiple importance sampling, after recent OpenCL fixes. 2013-05-15 19:02:30 +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
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
Brecht Van Lommel
cd3283f573 Cycles CUDA: in case of cryptic error messages in the console, refer to wiki
documentation for possible solutions.
2013-05-13 21:36:48 +00:00
Thomas Dinges
d76b758f23 Cycles:
* Fix compile error, when building with __KERNEL_SSE__
2013-05-13 15:31:59 +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
Thomas Dinges
7636aeffe1 Cycles / Math:
* Add M_2PI_F and M_4PI_F constants and use them inside the codebase.
2013-05-12 14:13:29 +00:00