Commit Graph

4659 Commits

Author SHA1 Message Date
Sergey Sharybin
faa10d1ced Cycles: optimization of panoramic camera in volume
Now we do much better preliminary check for panoramic camera is inside the
volume object boundings.

Also we're now cacheing the has_volume in the mesh, which makes it unneeded
iterations for each object's shaders.

Should be no functional changes, just faster sync and panoramic-in-volume
rendering.
2014-10-02 20:45:30 +02:00
Campbell Barton
927099ceb8 Cleanup: style 2014-09-30 02:04:34 +10:00
Sergey Sharybin
d41f99ac57 Cycles: Correct object flags bitfield, was missing negative scale there
It's quite a few of circumstances to be met to hit the case when render
wouldn't be correct.

Better to be ported to the final release.
2014-09-28 14:13:36 +06:00
Sergey Sharybin
21825c4359 Cycles: Avoid temp variable in camera-in-volume check
Was a left-over from some experiments, no need it with the current
implementation, and likely wouldn't need in the future.
2014-09-28 02:35:37 +06:00
Sergey Sharybin
53b05e4f06 Cycles: Cleanup of the SSS volume stack update code
Was a leftover after the changed scene_intersect() which used to
be ifdefed depending on the __HAIR__ in the original patch.
2014-09-28 02:19:17 +06:00
Sergey Sharybin
4832538ad0 Cycles: Keep STACK_MAX_HITS private in kernel_shadow
This way adding record_all for other things becomes easier and doesn't
lead to naming conflicts.
2014-09-26 14:23:48 +06:00
Thomas Dinges
ff4a867dc0 Code style. 2014-09-26 02:04:40 +02:00
0b12e61040 OpenNL: modify SuperLU to use doubles rather than floats, for better precision.
This helps to improve the accuracy of UV unwrapping and laplacian deform for
high poly meshes, which could get warped quite badly. It's not much slower,
doubles are pretty fast on modern CPUs, but it does double memory usage. This
seems acceptable as otherwise high poly meshes would not work correctly anyway.

Fixes T39004.
2014-09-26 00:04:10 +02:00
32f83a298c Fix build errors in atomic ops and warning in aligned malloc on OS X. 2014-09-25 23:59:38 +02:00
Sergey Sharybin
2307bd7174 Cycles: Keep ccl_always_inline always inlining the stuff
It works around strange shading bug when building with MSVC.
If such weirdeness continues, we perhaps would need to use
proper inline flags all the time.

Anyway, lets see how things will behave now.
2014-09-26 02:03:49 +06:00
Sergey Sharybin
0929821590 Cycles: Accidentally inverted the logic of NDEBUG macro 2014-09-26 01:34:43 +06:00
Sergey Sharybin
4735fdc280 Cycles: Better feedback about experimental features being used
Instead of having a label which basically duplicated the information
about experimental feature set being used (which had a bug because
it claimed experimental GPU kernel is used even if compute device is
CPU btw) now we've got an enum item icon.

So once you switched to experimental feature set you'll see an
exclamation mark icon in the enum, so you know something might be
unstable or slow.
2014-09-26 01:02:28 +06:00
Sergey Sharybin
faf4f29cc0 Guardedalloc: Implement atomic peak memory update
Updating maximum requires a bit of a cycle which usually does 1 iteration only,
sometimes needs a bit more but seems there's no speed regressions.

For now the code is commented out. This way it's easier for others to verify
there's no speed regressions.

Reviewers: campbellbarton

Differential Revision: https://developer.blender.org/D626
2014-09-26 00:40:53 +06:00
Sergey Sharybin
37f3843ab0 Atomics: Add CAS (compare-and-swap) functions 2014-09-26 00:33:04 +06:00
Sergey Sharybin
b90d849171 Cycles: Fix for the MSVC which doesn't have default osteram constructor 2014-09-26 00:27:04 +06:00
Thomas Dinges
38a54f4e01 Cycles: Make CUDA backend aware of sm_52 (Maxwell).
In order to compile the new kernel you need to specify sm_52 in SCons / CMake, and use CUDA Toolkit 6.5.19, from here: https://developer.nvidia.com/cuda-downloads-geforce-gtx9xx

Note: sm_52 is not enabled per default yet, so it won't be bundled with the Buildbot builds. That will be addressed later.
2014-09-25 20:07:50 +02:00
Sergey Sharybin
fe731686fb Cycles: Add support for cameras inside volume
Basically the title says it all, volume stack initialization now is aware that
camera might be inside of the volume. This gives quite noticeable render time
regressions in cases camera is in the volume (didn't measure them yet) because
this requires quite a few of ray-casting per camera ray in order to check which
objects we're inside. Not quite sure if this might be optimized.

But the good thing is that we can do quite a good job on detecting whether
camera is outside of any of the volumes and in this case there should be no
time penalty at all (apart from some extra checks during the sync state).

For now we're only doing rather simple AABB checks between the viewplane and
volume objects. This could give some false-positives, but this should be good
starting point.

Need to mention panoramic cameras here, for them it's only check for whether
there are volumes in the scene, which would lead to speed regressions even if
the camera is outside of the volumes. Would need to figure out proper check
for such cameras.

There are still quite a few of TODOs in the code, but the patch is good enough
to start playing around with it checking whether there are some obvious mistakes
somewhere.

Currently the feature is only available in the Experimental feature sey, need
to solve some of the TODOs and look into making things faster before considering
the feature is ready for the official feature set. This would still likely
happen in current release cycle.

Reviewers: brecht, juicyfruit, dingto

Differential Revision: https://developer.blender.org/D794
2014-09-25 23:28:01 +06:00
Sergey Sharybin
ccc5983e2b Fix T39823: SSS scatter doesn't update volume stack, causing shading artifacts
Basically the title says it all, we need to update volume stack when doing ray
scatter for SSS. This leads to speed regressions in cases scene does have both
volume and SSS (performance in case there's no SSS or no volume should be the
same).

We might try optimizing kernel_path_subsurface_update_volume_stack() a bit by
either recording all intersections or using some more appropriate visibility
flags.

Reviewers: brecht, juicyfruit, dingto

Differential Revision: https://developer.blender.org/D795
2014-09-25 23:17:45 +06:00
Sergey Sharybin
d165b1b266 Cycles: Add method to dump current shader graph to the graphiz file
This is rather useful to see how good optimization went and so.

Currently uses quite simple notation: shader nodes are nodes on the
graph, connects between graph nodes are named by the sockets names,
so i.e. connection between BSDF and Mix would be named bsdf:closure1.

Could be improved in the feature to draw fancier graph, but it's good
enough already.

Use in the following way:
- To create graphix file call graph->dump_graph("graph.dot")
- To visualize the grapf call: dot -Tpng graph.dot -o graph.png
2014-09-25 17:08:32 +06:00
Sergey Sharybin
b3d414cc21 Cycles: Don't inline functions for debug CPU kernel
Nobody will use debug mode for benchmarks anyway and this way it's much easier
to set breakpoints on inlined functions to catch all their usages.
2014-09-25 17:08:32 +06:00
Sergey Sharybin
13d8671a1a Cycles: Add support of Glog logging
This commit makes it possible to use Glog library for the debug logging.
For now only possible when using CMake and in order to use the logging
the WITH_CYCLES_LOGGING configuration variable is to be enabled.

When this option is not enabled or when using Scons there's no difference
in Cycles behavior at all, when using logging and no output to the console
impact is gonna to be minimal.

This is done in order to make it possible to have debug logging persistent
in code (without need to add it when troubleshooting some bug and removing
it afterwards).

For now actual logging is not placed yet, only all the functions needed for
the logging are written and so.
2014-09-25 17:08:32 +06:00
Jens Verwiebe
faaf0c719f OSX: ensure windows are restored at their saved position,
meaning here we need to take docksize into account
2014-09-24 20:55:48 +02:00
Martijn Berger
25ec0d97f9 make "tri_shader" an int instead of a float
tri_shader does no longer need to a float.

Reviewers: dingto, sergey

Reviewed By: dingto, sergey

Subscribers: dingto

Projects: #cycles

Differential Revision: https://developer.blender.org/D789
2014-09-24 13:34:28 +02:00
Thomas Dinges
cbffc7499e Cycles: Shader Graph Optimization for Mix RGB nodes.
Basically the same as AC2c58e96685e8, but for Mix RGB Shaders, in case we use the Mix type. This way the node can be used as texture switch for example, setting the Factor to 0.0 or 1.0, without wasting extra memory / render time.
2014-09-24 12:52:36 +02:00
Thomas Dinges
1b5ec32ed9 Cleanup: Avoid some defines for scene_intersect(), related to Min Width. 2014-09-24 11:32:29 +02:00
Sergey Sharybin
362b0239fe Fix typo in previous commit
Buttons are too much close to each other on the keyboards!
2014-09-23 23:09:44 +06:00
Sergey Sharybin
e422e56db0 Move versioning code under the subversion check 2014-09-23 22:56:37 +06:00
Thomas Dinges
2ed1b67835 Fix T41912, OpenCL compile error when building without __SVM__
Thanks to Vitaliy Filippov for the patch.
2014-09-23 12:54:16 +02:00
Thomas Dinges
31da72545e Cycles: Backward compatibility code for the Clamp splitting in 2.70.
If an older file (< 270) had clamp enabled, with e.g. a value of 2.0, Direct and Indirect clamp are now automatically set to 2.0 as well.
2014-09-19 22:25:36 +02:00
Thomas Dinges
0542442310 Cycles: Add a UI warning, in case the experimental GPU kernel is used.
The experimental kernel is slower and can cause issues on some cards still, so better communicate it well.
2014-09-19 22:25:35 +02:00
Thomas Dinges
75b61f5346 Cycles: Remove unused Mix Shaders from the ShaderGraph, instead of only relinking.
Differential revision: https://developer.blender.org/D796
2014-09-19 13:21:25 +02:00
Thomas Dinges
40a1c7b9c7 Cleanup: Indentation and Whitespace. 2014-09-19 12:57:09 +02:00
Nathan Letwory
d04e488273 Add texture coordinate export. 2014-09-19 10:44:42 +03:00
Campbell Barton
8c3daab298 Cleanup: style, spelling 2014-09-18 09:37:49 +10:00
Campbell Barton
0e0e528ea4 Cleanup: pep8 2014-09-17 18:36:17 +10:00
Sergey Sharybin
c9f0c20e48 Cycle: Add a bit of explanation why we're using such a dirty hack 2014-09-16 12:46:31 +06:00
Campbell Barton
106ea0b20b Cleanup: sync map_to_sphere, UNLIKELY xy zero case 2014-09-16 12:41:16 +10:00
Jens Verwiebe
0c3ff81e79 Cycles: tentative fix get rid of os-specific issue in struct ShaderClosure ( aligment issues due order ) 2014-09-15 21:20:24 +02:00
Thomas Dinges
03ce9882af Fix T41839, OpenCL error.
Also some style fixes, we don't do the "put as much as possible in 1 line" contest.
2014-09-15 14:22:39 +02:00
Thomas Dinges
89b62804dc Followup for last commit, we can break the loop, once we have a match. 2014-09-11 15:02:19 +02:00
Thomas Dinges
61e58c378a Fix T41784, Re-enabling transparent shadows in Cycles doesn't work correctly 2014-09-11 14:51:48 +02:00
Thomas Dinges
da3be518b6 Comment out SVM fresnel_conductor() function for now, still unused. 2014-09-07 21:13:00 +02:00
Thomas Dinges
aa8d25bf09 Cycles / OSL: Add a conductive fresnel shader template.
This adds a fresnel conductive OSL preset to the Text Editor. Based on a patch by Lukas Stockner.
Differential revision: https://developer.blender.org/D145

See the differential for details.
2014-09-07 18:28:59 +02:00
Campbell Barton
2e560ebb95 No need for try/except in D766 2014-09-07 12:05:44 +10:00
Thomas Dinges
50d6067f4e Cycles: Several fixes for Presets.
* Fix caustic properties, was not updated.
* Remove wrong items, leftovers from panel splitting.
* Add missing items. Even if the bundled presets do not set those, a user expects that all properties inside the panel are taken into account, when adding a new preset.
2014-09-07 04:03:23 +02:00
Thomas Dinges
1ff83d8a37 Cycles: Fix Caustic tooltips.
Now that the option has been reversed, the tooltips should be changed too.
Thanks to David Black, for bringing this up!
2014-09-07 01:36:00 +02:00
Sergey Sharybin
f670a8aeaa Fix T41709: Bump not rendered correctly behind transparency using Branched Path Tracing 2014-09-06 18:16:38 +06:00
Sergey Sharybin
1b319669d0 Cycles: Workaround cuda 6.5 compiler bug with sm_50 2014-09-06 15:10:17 +06:00
Sergey Sharybin
769ba42899 Cycles: Fix for the BSDF evaluation init 2014-09-06 14:30:58 +06:00
Thomas Dinges
8243c55f14 Cycles: Split caustics option, to allow separate control for Reflection and Refraction caustics.
This way artists can only disable/enable refraction or reflection caustics.
See Cycles logs for an example: http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.72/Cycles

Differential revision: https://developer.blender.org/D766
2014-09-05 20:39:35 +02:00
Thomas Dinges
cdd1d5a93c Cycles: Initial support for volume ray visibility.
This adds a new "Volume Scatter" option to the "Ray Visibility" panels and can be used to e.g. exclude lamps from having an influence on the volume. See release logs for an example: http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.72/Cycles

Differential revision: https://developer.blender.org/D771
2014-09-05 16:17:39 +02:00
Sergey Sharybin
fbed2047c8 Fix wrong track of the memory when doing device vector resize before freeing it
This is rather legit case which happens i.e. when having persistent images enabled
and session is updating the lookup tables.

Now device_memory keeps track of amount of memory being allocated on the device,
which makes freeing using the proper allocated size, not the CPU side buffer
size.
2014-09-04 17:25:12 +06:00
Thomas Dinges
c670ceb562 Cleanup: Code deduplication for similar passes. 2014-09-04 01:00:40 +02:00
Sergey Sharybin
f7062ff3ed Fix T41693: Volumes get brightened with extra volume samples on GPU + BPT 2014-09-03 21:28:43 +06:00
Thomas Dinges
00acf4b816 Cleanup: Use function call and delete obsolete comment. 2014-09-02 23:26:49 +02:00
Sergey Sharybin
6212b7302c Cycles: Rebuild BVH from scratch if loading cache failed
Before this Cycles used to try using the cache even so it knew for the
fact that reading it from the disk failed. This change doesn't make it
more stable if someone will try to trick Cycles and give malformed data
but it solves general cases when Blender crashed during the cache write
and will preserve rendering from crashing when trying to use that partial
cache.
2014-09-01 18:05:10 +06:00
Thomas Dinges
35bc266de7 Cleanup: Silence compiler warning. 2014-09-01 02:49:28 +02:00
Thomas Dinges
1f19a093aa Cycles: Always assign the proper value for volume bounces.
I don't see a reason not to do this, and this also fixes update problems when 3D View rendering is running (no volume shader), and then a volume shader gets added.
2014-08-31 14:00:51 +02:00
Thomas Dinges
204e1e0a18 Fix Cycles Integrator presets, not taking Volume bounces into account. 2014-08-30 16:48:44 +02:00
Sergey Sharybin
d438208474 Cycles: Fix triangle ribbons hair in viewport and ortho camera
There were several issues involved into triangle ribbons hair:

- Even for the viewport rendering the blender scene camera was
  used for orientation. This made hair triangles oriented to
  the scene camera, not to the viewport camera.

- Triangle orientation was actually supposing the camera is
  perspective. Triangles weren't oriented properly for the
  orthographic camera resulting in different hair width across
  it's length.

This issues are solved now, but there are some related TODOs:

- Rotating viewport doesn't re-orient the triangles, so after
  viewport navigation hair might not look correct. However,
  with this fix toggling viewport render (to force hair sync)
  makes viewport render correct.

  This isn't so much trivial fix, would require making BVH
  aware of the dynamic triangle orientation, so they get
  properly oriented without full hair re-sync.

- Panorama camera behavior didn't change but looks like it
  should, however not really sure atm what's the right thing
  to do here.
2014-08-29 16:44:16 +06:00
Sergey Sharybin
2b15c012c2 Followup for the previous commit: apparently for CMake py files are hardcoded 2014-08-28 19:49:20 +06:00
Sergey Sharybin
21a7433faa Fix T41473: Cycles volume rendering is too dark
The issue was caused by the changed defaults from the Cycles side.
Because of those properties being saved as an IDProp and not being
saved to the file, every change to the defaults would ruin someone's
day updating the values.

Added a bpy.app.handler.version_update which is run after the regular
do_versions() are done and could be sued by the scripts to apply
versioning code on their settings.

Reviewers: campbellbarton

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D761
2014-08-28 18:59:24 +06:00
Sergey Sharybin
d84c15696b Fix T41601: Correlated multi-jitter with high samples "hangs"
Issue was caused by the precision issues which made sdivm by 1 under
it's actual value. We can try to do some eps magic, but from the tests
on laptop and desktop doing integer division is not slower than using
floats here.
2014-08-28 15:15:59 +06:00
Campbell Barton
3f2cf6da6f Cleanup: remove _DEBUG define usage 2014-08-27 18:59:32 +10: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
Thomas Dinges
24ea3ab1a9 Cleanup: intrin.h is already included via util_optimization.h. 2014-08-27 03:22:36 +02:00
Sergey Sharybin
e827d904ae Move include outside of the CCL namespace 2014-08-27 00:11:06 +06:00
Thomas Dinges
fb3f32760d Cycles: Add an experimental CUDA kernel.
Now we build 2 .cubins per architecture (e.g. kernel_sm_21.cubin, kernel_experimental_sm_21.cubin).
The experimental kernel can be used by switching to the Experimental Feature Set: http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Experimental_Features

This enables Subsurface Scattering and Correlated Multi Jitter Sampling on GPU, while keeping the stability and performance of the regular kernel.

Differential Revision: https://developer.blender.org/D762
Patch by Sergey and myself.

Developer / Builder Note:
CUDA Toolkit 6.5 is highly recommended for this, also note that building the experimental kernel requires a lot of system memory (~7-8GB).
2014-08-26 17:02:26 +02:00
Sergey Sharybin
44fc0ddee9 Cycles: Use compiler intrinsics for clz/ctz in CMJ code for MSVC 2014-08-26 14:22:08 +06:00
Thomas Dinges
e2c412f8cc Cycles: Make Correlated Multi Jitter a regular feature.
It can be helpful in some cases and it works properly, so no need to hide it behind the experimental flag anymore. It's only enabled for the CPU though.
2014-08-26 03:45:50 +02:00
Thomas Dinges
8d0b3e9902 Cycles: Enable Volumetric Rendering on GPU.
Limitations:
* Smoke/Fire rendering is *not* supported on GPU yet, that is also documented here: http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Materials/Volume
* Decoupled Ray Marching is also not supported yet, so no Equi-Angular and MIS sampling yet.

Note for Builders and Developers:
* Make sure to use the CUDA Toolkit 6.5 from now on. 6.0 might still work, but can cause slower renders.
2014-08-25 17:23:06 +02:00
Sergey Sharybin
2a44844870 Fix T41532: Some files bounce back and forth between 'packing BVH nodes' and 'Copying Transforms to Device'
This was originally caused by a6ae12a where i didn't foresee unclear distinguishing
between empty and non-synced meshes will give issues for the viewport. They're the
same for final rendering, but for viewport we need to be accurate here.
2014-08-25 14:05:00 +06:00
Thomas Dinges
ae31b25fb5 Cycles: Fix wrong Volume Scattering in Branched Path integrator, when building without Decoupled Ray Marching.
The wrong throughput was used here.
2014-08-24 23:08:07 +02:00
Thomas Dinges
a25484eefa Cleanup: Remove unused variable in kernel_path_volume_bounce(). 2014-08-24 23:06:30 +02:00
Thomas Dinges
031620aba2 Cycles: Avoid redundant call to volume_stack_is_heterogeneous() for Distance Sampling. 2014-08-24 16:15:57 +02:00
Thomas Dinges
c89287e057 Cycles: Avoid call to volume_stack_sampling_method() on GPU, Decoupled is required for Equi-Angular/MIS. 2014-08-24 15:58:41 +02:00
Thomas Dinges
8ed818e0a1 Cycles: Remove Volume Nodes GPU warning and gray out Sampling Method button when using GPU. 2014-08-24 14:54:48 +02:00
Thomas Dinges
a0600debda Fix T41541: Cuda renders objects in black with MIS enabled in world setting
Issue introduced in 8d3cc431d7fdcc9f3243cc24dfdcb94124be0993, parameter mismatch.
2014-08-22 20:10:01 +02:00
Sergey Sharybin
4ff4bfcb9c Cycles: DPX is saved in the sRGB space and need to be converted to linear
This at least applies to DPX saved from within blender, which is 1st prio
to support working reliably.
2014-08-22 23:53:29 +06:00
Sergey Sharybin
7c052a8877 Cycles: Fix wrong image update tagging, float vs. byte images 2014-08-22 17:36:00 +06:00
Thomas Dinges
603348c56e Cycles: Drop support for CUDA 5.0 Toolkit, only 6.0 and 6.5 (recommended) are supported now. 2014-08-21 23:35:20 +02:00
Sergey Sharybin
2e5e1e2028 Fix T41267: Wrong light distribution with when having objects with motion blur 2014-08-21 17:57:02 +06:00
Campbell Barton
d93c07d987 Cleanup 2014-08-21 09:23:07 +10:00
Thomas Dinges
ccf7b391cd Further cleanup for defines:
* Merge Texture defines
* Remove Normal Map define.
2014-08-20 23:27:59 +02:00
Thomas Dinges
161815576f Cleanup: Remove __ANISOTROPIC__ define.
That was only needed in the beginning, when we did not had support for tangents. It's time to clean some of the defines up, it's getting a bit too much.
2014-08-20 23:23:14 +02:00
Thomas Dinges
187d77612b Code refactor: Split __VOLUME__ defines in Cycles.
* __VOLUME__ is basic volume support with Emission and Absorption.
* __VOLUME_SCATTER__ enables volume Scattering support.
* __VOLUME_DECOUPLED__ enables Decoupled Ray Marching.
2014-08-20 23:15:30 +02:00
Thomas Dinges
075f6eff74 Cycles: Further tweak for Decoupled Ray Marching
Avoid some if checks when probalistic_scatter is false.

Differential Revision: https://developer.blender.org/D743
2014-08-20 22:59:08 +02:00
Sergey Sharybin
7bc87a372e Fix T40962: Ashikhmen Shirley shader fireflies 2014-08-19 20:58:58 +06:00
Dalai Felinto
8d3cc431d7 Fix T41471 Cycles Bake: Setting small tile size results in wrong bake with stripes rather than the expected noise pattern
This problem was introduced in 983cbafd1877f8dbaae60b064a14e27b5b640f18
Basically the issue is that we were not getting a unique index in the
baking routine for the RNG (random number generator).

Reviewers: sergey

Differential Revision: https://developer.blender.org/D749
2014-08-19 11:40:33 +02:00
Sergey Sharybin
adb08def61 Fix T39630: Mouse Wheel doesn't detect Multi Window Focus 2014-08-18 20:50:57 +06:00
Sergey Sharybin
a6ae12aa62 Fix T41474: Second renderlayer doesnt render if first one has 'Use Surfaces' disabled 2014-08-18 18:59:44 +06:00
Campbell Barton
bba80ed7af Cleanup 2014-08-17 12:18:40 +10:00
Bastien Montagne
fe2b461398 Fix poll func of CYCLES_OT_use_shading_nodes.
Operators' poll func might be called from anywhere in Blender, so they should
not make any assumption about available context. material, lamp and world
are specific to context from Properties space...
2014-08-16 22:42:02 +02:00
Campbell Barton
88ee650263 Comments 2014-08-16 10:51:07 +10:00
Bastien Montagne
9a29b0f155 Fix compilation on linux (implicit conversion from double/float to size_t treated as error here). 2014-08-15 15:44:50 +02:00
Dalai Felinto
983cbafd18 Final Fix T41222 Blender gives weird ouput when baking (4096*4096) resolution on GPU
It now uses the tile size to split the job. For CPU this may add
overhead, but for GPU this is highly needed.

Reviewers: sergey

Differential Revision: https://developer.blender.org/D690
2014-08-15 11:27:42 +02:00
Dalai Felinto
2c5b6859d9 Revert "Fix T41222 Blender gives weird output when baking (4096*4096) resolution on GPU"
This reverts commit a48b372b04421b00644a0660bfdf42229b5ffceb.

Leaving only the part that fix device_multi.cpp
2014-08-15 11:27:42 +02:00
Thomas Dinges
5bdea81319 Cycles: Don't check closure flag in kernel_volume_decoupled_scatter(), we check this before the function already. 2014-08-14 21:25:52 +02:00
Thomas Dinges
32a5313b41 Cycles: Optimize Equi-Angular sampling using binary range search.
Patch by Lukas Tönne and myself.
2014-08-14 20:21:36 +02:00
Thomas Dinges
5af00a3d12 Cycles: Optimization for Heterogeneous Volume Shadows.
* Don't compute expf() for every step, instead sum the intermediate values and calculate it every N (8 for now) steps. This helps a few percent (~5% on a cube with wave texture) in my tests here.
2014-08-14 20:09:25 +02:00
Thomas Dinges
8ff3cf3e56 Cleanup: typos and extra brackets. 2014-08-14 16:31:53 +02:00
Thomas Dinges
5a74fe63d0 Cycles: Avoid intermediate function when we sample all lamps. 2014-08-14 16:09:40 +02:00
Thomas Dinges
6e5d188d17 Cycles: Avoid segment NULL check, we access it before this function already. 2014-08-14 15:52:19 +02:00
Sergey Sharybin
c256072e91 Cycles: Correction to previous commit -- forgot to take instancing into account 2014-08-14 11:48:50 +06:00
Jens Verwiebe
fc2b6a2b9d OSX: fix paranthesis in last commit 2014-08-13 15:32:35 +02:00
Jens Verwiebe
3bbba7d2b1 OSX: add a fix for lion_fs loosing handles after calling fs from key shortcut, also reenabled lion_fs for OSX >= 10.9 again 2014-08-13 15:27:41 +02:00
Sergey Sharybin
bfaf4f2d0d Fix T41219: Cycles backface detection doesn't work properly
Root of the issue goes back to the on-fly normals commit and the
latest fix for it wasn't actually correct. I've mixed two fixes
in there.

So the idea here goes back to storing negative scaled object flag
and flip runtime-calculated normal if this flag is set, which is
pretty much the same as the original fix for the issue from me.

The issue with motion blur wasn't caused by the rumtime normals
patch and it had issues before, because it already did runtime
normals calculation. Now made it so motion triangles takes the
negative scale flag into account.

This actually makes code more clean imo and avoids rather confusing
flipping code in mesh.cpp.
2014-08-13 16:35:54 +06:00
Sergey Sharybin
2eebe611e4 Fix T40717: Screen does not update while scrolling or zooming with touchpad on a laptop
This is rather workaround solution for now, which seems to
work and it's not that huge to maintain (one liner apart from
the comment).

Idea is to make sure PeekMessage peeks the message when window
proc receives WM_MOUSEWHEEL (some touchpad drivers seems to
swallow the messages making it so PeekMessage doesn't get
anything).
2014-08-13 13:49:30 +06:00
Campbell Barton
7df4fc5eaf Spelling 2014-08-13 09:34:37 +10:00
Campbell Barton
dfd9bfd3a8 Spelling 2014-08-13 08:38:16 +10:00
Sergey Sharybin
794277f8b6 Stupid MSVC replaces tabs to spaces spontaneously :S 2014-08-12 16:51:37 +06:00
Sergey Sharybin
0fc4289c39 Console detection now works reliably when starting blender-app directly 2014-08-12 16:48:46 +06:00
Tamito Kajiyama
7b1234be1c Removed/disabled debugging code. 2014-08-12 10:10:37 +09:00
Tamito Kajiyama
c38e80d632 WIP commit just for a record of a working snapshot of code revisions for node-based textured strokes. 2014-08-12 10:10:35 +09:00
Tamito Kajiyama
1741df1e36 Removed debug prints. 2014-08-12 10:10:11 +09:00
Tamito Kajiyama
f75d87bd76 Initial implementation of Cycles materials for Freestyle stroke rendering. 2014-08-12 10:10:06 +09:00
Campbell Barton
d124bd1cd4 Spelling 2014-08-12 10:31:07 +10:00
Campbell Barton
afe8a4040f Fix uninitialized memory use 2014-08-12 08:21:02 +10:00
Sergey Sharybin
8bed4e6040 Fix T41362: CPU and GPU rendering gives different results
We can't really make CPU and GPU results look the same in all possible
circumstances, but here we can make them look close enough to each other
by making it so sobol pattern for bounce number is the smae for both
CPU and GPU.

This makes CPU and GPU render results look the same with low number of
samples, high number of samples was never an issue.
2014-08-11 22:29:27 +06:00
Antony Riakiotakis
028fd29eeb Pie Menus C code backend.
This commit merges the code in the pie-menu branch.

As per decisions taken the last few days, there are no pie menus
included and there will be an official add-on including overrides of
some keys with pie menus. However, people will now be able to use the
new code in python.

Full Documentation is in http://wiki.blender.org/index.php/Dev:Ref/

Thanks:
Campbell Barton, Dalai Felinto and Ton Roosendaal for the code review
and design comments

Jonathan Williamson, Pawel Lyczkowski, Pablo Vazquez among others for
suggestions during the development.

Special Thanks to Sean Olson, for his support, suggestions, testing and
merciless bugging so that I would finish the pie menu code. Without him
we wouldn't be here. Also to the rest of the developers of the original
python add-on, Patrick Moore and Dan Eicher and finally to Matt Ebb, who
did the research and first implementation and whose code I used to get
started.
2014-08-11 11:02:26 +02:00
Martijn Berger
c020bd2e73 Cycles OpenCL error to string removed in favour of the same function in clew. 2014-08-09 14:27:40 +02:00
Sergey Sharybin
57c4871146 Tweaks to the recent wrapper on windows
- Forgot to handle command line arguments

- Because of the fact we need to be able to
  use stdout and stderr we need to use regular
  console application for the wrapper.

- Because of using regular application for the
  wrapper we need to check forparent PID in the
  isStartedFromCommandPrompt().

I really hope it's not gonna to become any more
complicated.
2014-08-08 00:22:57 +06:00
Thomas Dinges
e3ed13cbd4 Cleanup: Remove special code for Visual Studio 2008.
Goodbye VC2008, it has been a pleasure (more or less) :D SCons / CMake cleaenup will follow.
Differential Revision: https://developer.blender.org/D715
2014-08-07 13:52:15 +02:00
Jens Verwiebe
c0c037f41d OSX/clang: Fix T41123, crashing osl when optimization level > O0 is used for osl_shaders.cpp 2014-08-06 13:25:06 +02:00
Martijn Berger
4cf531f7a0 Fix T41318: API change in OSL, I see no other cases but there might be 2014-08-05 23:49:42 +02:00
Campbell Barton
ea9d94cf28 Spelling 2014-08-06 05:41:14 +10:00
Dalai Felinto
a48b372b04 Fix T41222 Blender gives weird output when baking (4096*4096) resolution on GPU
In collaboration with Sergey Sharybin.

Also thanks to Wolfgang Faehnle (mib2berlin) for help testing the
solutions.

Reviewers: sergey

Differential Revision: https://developer.blender.org/D690
2014-08-05 13:50:50 -03:00
Sergey Sharybin
a192facd8c Fix T41276: OSL bug in getmessage ("trace", "geom:name" , output) 2014-08-05 17:54:08 +06:00
Sergey Sharybin
b3e3ca7464 Fix T41318: OSL broken on Linux kubuntu 14.04
Now for real, hopefully.
2014-08-05 15:53:00 +06:00
Martijn Berger
b9e4929846 Fix: T41318
OSL compiler signature changed with 1.5.
2014-08-05 11:11:52 +02:00
Sergey Sharybin
77b7e1fe9a Deduplicate CUDA and OpenCL wranglers
For now it was mainly about OpenCL wrangler being duplicated
between Cycles and Compositor, but with OpenSubdiv work those
wranglers were gonna to be duplicated just once again.

This commit makes it so Cycles and Compositor uses wranglers
from this repositories:

  - https://github.com/CudaWrangler/cuew
  - https://github.com/OpenCLWrangler/clew

This repositories are based on the wranglers we used before
and they'll be likely continued maintaining by us plus some
more players in the market.

Pretty much straightforward change with some tricks in the
CMake/SCons to make this libs being passed to the linker
after all other libraries in order to make OpenSubdiv linked
against those wranglers in the future.

For those who're worrying about Cycles being less standalone,
it's not truth, it's rather more flexible now and in the future
different wranglers might be used in Cycles. For now it'll
just mean those libs would need to be put into Cycles repository
together with some other libs from Blender such as mikkspace.

This is mainly platform maintenance commit, should not be any
changes to the user space.

Reviewers: juicyfruit, dingto, campbellbarton

Reviewed By: juicyfruit, dingto, campbellbarton

Differential Revision: https://developer.blender.org/D707
2014-08-05 13:57:50 +06:00
Campbell Barton
88a0d5ebe8 Make CHECK_TYPE_NONCONST macro portable
also replace __typeof -> typeof
2014-08-02 18:08:44 +10:00
Campbell Barton
9c3025cd26 Spelling 2014-08-02 16:53:52 +10:00
Thomas Dinges
59f4ba854b Cycles: Update stdosl.h for OSL 1.5. 2014-08-01 15:23:58 +02:00
Sergey Sharybin
42aef164f4 Fix T41197: Blender freezes to infinite loop when switching to PAUSED Cycles rendered viewport 2014-08-01 16:57:43 +06:00
Sergey Sharybin
eb016eb3ae Fix T41258: Crash when entering edit mode while viewport render is enabled
The issue was caused by the render engine loading edit mesh, which re-allocates
mesh array which might be referenced by other object's derived meshed.

Worst thing about this is that updating render engine happens from the end of
scene update function, after all the objects are updated and so. This is needed
so render engine gets the update objects which is correct.

The only proper way to solve the issue is to make it so viewport engine does not
leave objects in inconsistent state, meaning nobody will reference to freed data.

In order to reach this we do edit mesh loading before running objects update so
all the objects which uses that mesh will have proper references in the derived
mesh.

This also solves old creepyness which happened before when having single object
in edit mode. tweaking it will calculate derived mesh as a part of scene update,
then this derived mesh will be freed by edit mesh loading and viewport will be
creating derived mesh again.

Now render engine is expected to do nothing with meshes which are in edit mode,
but they still need to load edit data for non0meshes. It's not really easy to
do from the BKE level because needed functions are implemented in the editor.

Thanks Campbell for the review!

Differential Revision: https://developer.blender.org/D697
2014-07-31 20:25:11 +06:00
Dalai Felinto
5c3c3abb45 Cycles Bake: use size_t instead of width, height
(original patch by Sergey Sharybin)

Note: RNA API can't use size_t at the moment. Once it does this patch
can be tweaked a bit to fully benefit from size_t larger dimensions.
(right now num_pixels is passed as int)

Reviewed By: sergey, campbellbarton
Differential Revision: https://developer.blender.org/D688
2014-07-31 00:35:17 -03:00
Sergey Sharybin
946f291c46 Fix T41174: Tangent space required UV map in Cycles
Now Cycles behaves in the same way as BI in terms of using
sphere projection of orco coordinates if there's no UV map
when calculating tangent space.
2014-07-29 16:08:47 +06:00
Martijn Berger
65bf694331 Implement get_split_task_count to make device_network compile again. 2014-07-29 07:40:04 +02:00
Sergey Sharybin
34937f6547 Fix T41139: Cycles Hair BSDF roughness problem 2014-07-27 19:51:28 +06:00
Campbell Barton
648ee669b7 Style cleanup GHOST/Win32 2014-07-27 13:40:39 +10:00
Jens Verwiebe
333aaca294 OSX/GHOST: Using lion_fullscreen suffers from an uncovered problem when called from operator, disabled for now so ALT-F11
uses old behavior again. OSX menu and CTL-CMD-F still work as lion fullscreen as well as right-upper corner fs window-icon
- We must investigate here why double promotion happens from op calls ( dispatchEvents on redraw cause duplicated calls here )
- The actual op calls cause fs to be in a wrong state, so also mousehandles fail and CTX_wm_window(C) is not valid.
- similar problem is with quit op, which does not close the app right ( totblocks )
- i would prefer to try getting direct os function call here rather
2014-07-26 18:51:39 +02:00
Dalai Felinto
fc55c41bba Cycles Bake: show progress bar during bake
Baking progress preview is not possible, in parts due to the way the API
was designed. But at least you get to see the progress bar while baking.

Reviewers: sergey

Differential Revision: https://developer.blender.org/D656
2014-07-25 11:42:53 -03:00
Martijn Berger
bae2b3a688 Switch to Cuda 4.0 style api for kernel invocation. This is a small clean-up that has no functional changes but makes code a bit more readable.
Differential revision: https://developer.blender.org/D659

Reviewed by: Sergey Sharybin, Thomas Dinges
2014-07-25 13:33:19 +02:00
Tamito Kajiyama
af585e843b Fix inconsistent use of print_error() and fprintf(stderr, ...) in MEM_guarded_printmemlist_internal().
Also extended the size of buf[] in print_error() to prevent mem_printmemlist_pydict_script[]
from getting truncated when MEM_printmemlist_pydict() is used.

Differential revision: https://developer.blender.org/D675

Reviewed by: Campbell Barton
2014-07-25 19:24:24 +09:00
Thomas Dinges
c0a9337caa Yet another OSL compilation fix...sorry. 2014-07-25 11:42:21 +02:00
Thomas Dinges
6cff19a0bf Cycles: Drop old OSL closure compatibility code.
This was added to keep custom OSL scripts with Toon and SSS closure calls working. 1 year after the change, we can drop the compatibility code now.
2014-07-25 11:42:01 +02:00
Thomas Dinges
dadf31f0b8 One more fix for new OSL libs. 2014-07-25 11:23:15 +02:00
Matteo F. Vescovi
c3f09c06cb Fix atomix operations on unofficial 64bit archs 2014-07-25 12:26:10 +06:00
Thomas Dinges
6582215f87 Cycles: Updates for new OSL 1.5 API.
Differential Revision: https://developer.blender.org/D662

Patch by Sergey and myself.
2014-07-24 23:07:49 +02:00
Campbell Barton
b7b1c09766 Code cleanup: ghost style 2014-07-24 21:40:01 +10:00
Sergey Sharybin
eb8f85d8be Fix T41116: Motion Blur causes random black surfaces on rigged models
Fix T41115: Motion Blur renders Objects Black - But not in Viewport Preview

This actually extends previous fix to normals and makes it all much nicer now.

Worth doing some intense testing, quick one worked just fine but there always
could be some corner cases.
2014-07-23 18:01:35 +06:00
Sergey Sharybin
9fcaac5009 Fix T41147: Static BVH shading problem
Fix T41079: Solid black render of object with negative scale and smooth shading

In both cases the issue was caused by negative scaled objects with single mesh
users for which scale gets applied when using static BVH.

Since the on-fly normals calculation land normals for such cases weren't flipped
leading them to point to a wrong direction.

Added a special object flag for this, which is a bit of a bummer because now
we've got less bits for real useful things, but this is the only way to get
proper normals without adding more complexity in the on-fly calculations.
2014-07-23 13:00:52 +06:00
Campbell Barton
200dd87de1 Cleanup: pep8 & redundant vars 2014-07-22 12:03:15 +10:00
Jörg Müller
31e1a31fee Bugfix T41133: Audio: Speakers with animated pitch cause clicks in rendered animations, crashes or huge filesizes in rendered audio
Crash happened when the pitch value got <= 0, preventing this now.
2014-07-21 14:25:10 +02:00
Campbell Barton
7e8626bbce Code cleanup: warnings 2014-07-20 00:38:52 +10:00
Sergey Sharybin
9a45c9dadf Fix T41109: Reloading image that has been modified outside Blender does not update image in Image Texture nodes 2014-07-18 19:37:32 +06:00
Campbell Barton
a04a8039f0 Code cleanup 2014-07-18 11:55:59 +10:00
Thomas Dinges
85c7fce3de Cleanup / Cycles: Remove unused defines and some other minor changes. 2014-07-16 22:36:52 +02:00
Sergey Sharybin
a378f8d2d8 Fix T40964: Massive shading failures with glass node mixing, whiteouts and blackouts 2014-07-15 15:59:00 +06:00
Jorge Bernal
1bf87fa26c BGE: TrackTo actuator: increasing up & track axis options
This is related to Task T34861 to increase up & track axis options for TrackTo actuator. I've just added it to differential to facilitate an easier review.

With the patch applied you can select X, Y and Z axis for the Up axis, and X, Y, Z, -X, -Y and -Z for the track axis.

Related to the implementation I have used the algorithm from Trackto constrain placed in constrain.c but adapted to be used with MOTO library.

The wiki docs are here (http://wiki.blender.org/index.php/User:Lordloki/Doc:2.6/Manual/Game_Engine/Logic/Actuators/Edit_Object#Trackto_Actuator).

Test file is here: {F97623}

I have also uploaded 2 screenshots showing the UI modifications to the TrackTo actuator:

{F91992} {F91990}

Reviewers: moguri, dfelinto

Reviewed By: moguri

CC: Genome36

Differential Revision: https://developer.blender.org/D565
2014-07-14 18:30:27 -07:00
Thomas Dinges
e35845d37c Fix T40987: Distant Lamps have no influence on Volumes.
Differential Revision: https://developer.blender.org/D639
2014-07-13 12:06:54 +02:00
Sergey Sharybin
594ff72bfe Fix T41023: Specific material cause bad render result, different on CPU/GPU
Issue was caused by too much aggressive optimization, which skipped execution
of some nodes leading to an uninitialized memory read in SVM stack.
2014-07-11 18:21:52 +06:00
Sergey Sharybin
49c73f2f22 Cycles: Add link to a paper used for Beckmann table calculation
This is for those who'll be reading code and trying to improve it.
2014-07-10 19:04:03 +06:00
Sergey Sharybin
5e216a6aa9 Fix T41005: Seemingly random crashes with cycles rendering
Fix T41013: OSL and Crash
Fix T40989: Intermittent crash clicking material color selector

Issue was caused by not enough precision for inversion threshold.
Use double precision for this threshold now. We might want to
investigate this code a bit more further, stock implementation
uses doubles for all computation. Using floats might be a reason
of bad rows distribution in theory.
2014-07-10 19:04:03 +06:00
Thomas Dinges
83f5d41071 Cleanup: Same thing in path trace setup, we can safely always assign the proper value. 2014-07-10 01:49:34 +02:00
Thomas Dinges
dda60dd261 Cleanup: Always assign num_samples, there is no need for this special define. 2014-07-10 01:43:53 +02:00
Lukas Tönne
5b0e4cd8c9 Fix T41003: Object Info's Random socket produces erratic results when
material is applied to multiple Dupli instances of an object.

One of the random_id initialization lines for cycles objects slipped
into the basic update part in this commit:
rBb98ff5cb5b2c14c33b16e3b129e1e08810e90a6c

This would constantly re-shuffle the random_id ...
2014-07-09 17:26:54 +02:00
Thomas Dinges
ef22e972b1 Code cleanup: Simplify decoupled scattering code a bit. 2014-07-07 13:28:10 +02:00
Lukas Tönne
2fe0cf54a5 Fix T40712: Duplicators don't generate orco and UV coordinates in Cycles viewport preview.
Fix T39286: Display percentage ignored in Cycles viewport.

The threaded depsgraph update changes included a cleanup of the global
is_rendering flag, which was replaced by a general EvalContext being
passed to dupli functions.

Problem is that the global flag was true for viewport duplis before
(ugly hack), which was used as a check for generating dupli orco/UV from
mesh data layers. The new flag is stricter and only true for actual
renders, which disables these attributes and breaks the Cycles
Texture Coordinates and UVMap nodes.

The solution is to extend the simple for_render boolean to an enum:
* VIEWPORT: OpenGL viewport drawing (dupli tex coords omitted)
* PREVIEW: Viewport preview render (simplified modifiers)
* RENDER: Full render with all details and attributes

There are still some areas that need to be examined, in particular
modifiers seem to totally ignore the EvaluationContext!
Instead they generally execute without render params from the depsgraph
(BKE_object_handle_update_ex) and are built with render settings
explicitly.

Differential Revision: https://developer.blender.org/D613
2014-07-07 10:54:14 +02:00
Sergey Sharybin
dc40928087 Cycles: Fix crash with environment maps and packed images 2014-07-07 12:37:45 +06:00
Thomas Dinges
5fefc84783 Cycles: Equi-Angular and MIS Volume sampling work on GPU now.
* malloc() is used now, which is supported since sm_20: http://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#dynamic-global-memory-allocation-and-operations The performance of this needs to be tested on various cards still.
* This also works for Heterogeneous Decoupled Ray Marching, but in this case I get sporadic "Illegal Address" errors on my Geforce 540, therefore I did not remove the GPU check in kernel_volume_use_decoupled() yet.

I would appreciate some tests from people who compile themselves, enable Volumetrics in kernel_types.h.
2014-07-06 14:00:11 +02:00
Thomas Dinges
e929dc2d8c Fix part of T40964: Glass shader was giving wrong results with OSL. 2014-07-06 13:07:35 +02:00
Thomas Dinges
f473607014 Cycles: Some tweaks to baking UI.
* Put Normal Settings beneath the other ones, wild button jumping should be avoided.
* Remove Cage prefix for Object and Extrusion, it's clear from the button placement, the former UI was too squeezed...
2014-07-05 15:39:08 +02:00
Thomas Dinges
9acabc13de Cleanup: Typo fixes. 2014-07-05 14:25:34 +02:00
Thomas Dinges
5aec61f849 Cycles: Compile fixes for CUDA Volumetrics.
* CUDA can be compiled with Volume support again, change line 78 kernel_types.h for that.

Volumes are still fragile on GPU though, got some Memory/Address CUDA errors in tests.. needs to be investigated more deeply.
2014-07-05 02:04:07 +02:00
Sergey Sharybin
6ff6883f99 Fix T40843: Cycles does not support viewport render override 2014-07-04 16:34:15 +06:00
Campbell Barton
d5297b6283 Fix T39825: Crash on startup with tablet 2014-07-03 16:33:47 +10:00
Thomas Dinges
5898abe99d Cycles: Update CUDA error messages, based on Toolkit 6.0.
* Removed deprecated erros, and added some new ones, which might help to figure out problems in the future.
2014-07-02 01:50:42 +02:00
Thomas Dinges
4800c52700 Cleanup: Remove unused checks in CUDA device code. 2014-07-02 01:12:13 +02:00
Thomas Dinges
6ac0652395 Cleanup: Update list and remove ifdef here. 2014-07-02 00:58:06 +02:00
Sergey Sharybin
8c9c93ca6f Fix T40888: Memory error when selecting Cycles render engine 2014-07-01 15:44:50 +06:00
Tamito Kajiyama
fef9463123 Fix T40065: Pressing Esc in separate render result window does not focus main window.
The problem is that the render window keeps keybord input focus even after it has been
lowered. Windows maintains the Z-order of windows, so the present solution is to raise
the window that has been just below the render window.

Differential revision: https://developer.blender.org/D594
Reviewed by: campbellbarton
2014-07-01 15:01:35 +09:00
Campbell Barton
2e840e56cf CMake: correct include dirs 2014-07-01 09:36:28 +10:00
Sergey Sharybin
0b5fda5678 Condition was inverted in the previous transparent shadows commit
Handbook example what happens when you've got loads of patches
and not double-check stuff before committing.
2014-06-30 17:00:51 +06:00
Thomas Dinges
7b5221c6da Cmake: Remove warning for pre CUDA 5.0 Toolkit, not supported anymore 2014-06-30 12:37:34 +02:00
Sergey Sharybin
cb95544e41 Fix T40836: Cycles volume scattering shader crash
Volume scatter might happen before path termination, so
need to check transparent bounces and consider shadow an
opaque when max transparent bounces are reached.

TODO: CPU code seems to have different branching in conditions
which made me thinking it does different things with volume
attenuation, but from the render results it seems the same
exact things are happening there. Worth looking into making
simplifying code a bit here to improve readability.
2014-06-30 16:24:43 +06:00
Campbell Barton
00c8a691e9 Cycles: use SYSTEM for external includes 2014-06-29 04:00:31 +10:00
Campbell Barton
8df6769040 CMake: update source files 2014-06-28 23:17:11 +10:00
Sergey Sharybin
a8233d7c44 Fix T40797: Crash on render on specific file with volumentrics and 'use hair' clicked on render layer 2014-06-28 01:20:07 +06:00
Tamito Kajiyama
0a0e4e0e69 Fix for DeviceScene::attributes_uchar4 not released properly
Reviewed by: dingto
Differential Revision: https://developer.blender.org/D620
2014-06-27 08:56:57 +02:00
Thomas Dinges
8ef2314597 Fix T40816, SSS brightness difference with Sample All Direct Lights.
This has been fixed before, but somehow got reverted in d644753319b6.
2014-06-26 21:30:42 +02:00
Sergey Sharybin
283abdf3b2 Fix compilation error with scons and older pythons 2014-06-26 16:03:52 +06:00
4b209f063c Fix T40695: world surface shader incorrectly visible with world volume. 2014-06-24 11:35:48 +02:00
Jens Verwiebe
f37ec65f80 OSX: Fix T40749, own mistake for m_lionStyleFullScreen condition 2014-06-23 21:27:38 +02:00
Lukas Tönne
8cea610e74 Fix compiler error in Cycles Beckmann sampling precomputation: strict
compiler flags don't allow implicit double -> float casting.

Code was added in rB8fbd71e.
2014-06-23 09:47:52 +02:00
8fbd71e5f2 Cycles: improved Beckmann sampling using precomputed data
It turns out that the new Beckmann sampling function doesn't work well with
Quasi Monte Carlo sampling, mainly near normal incidence where it can be worse
than the previous sampler. In the new sampler the random number pattern gets
split in two, warped and overlapped, which hurts the stratification, see the
visualization in the differential revision.

Now we use a precomputed table, which is much better behaved. GGX does not seem
to benefit from using a precomputed table.

Disadvantage is that this table adds 1MB of memory usage and 0.03s startup time
to every render (on my quad core CPU).

Differential Revision: https://developer.blender.org/D614
2014-06-21 22:31:44 +02:00
88d8358f91 Fix T40703: cycles viewport smoke not updating when changing frame. 2014-06-21 22:21:04 +02:00
177e1ec9b2 Fix T40714: cycles not loading CMYK jpeg files correctly. 2014-06-21 22:21:03 +02:00
66421f2119 Fix cycles "Is Singular Ray" being on for Camera rays, now is off.
This appears to be a wrong interpretation of the OSL docs, and it's more
convenient to have it off.
2014-06-21 22:21:03 +02:00
Thomas Dinges
ead83a48f1 Fix T40692, Checker Texture derivation on very large scales (1k).
It might still have a derivation on larger scales (10k or more), but we need some offset to avoid precision issues on unit coordinates.
2014-06-20 09:03:22 +02:00
Thomas Dinges
d43ba1b33c Cycles: Make Volume Bounces default to 0. This is quiet a bit faster, and produces less noise. 2014-06-19 19:05:06 +02:00
Campbell Barton
2dce13d213 Python: Remove deprecated uses of os.popen
T40415 by Lawrence D'Oliveiro
2014-06-20 02:00:46 +10:00
Sergey Sharybin
89ee6e0808 Cycles: attempt to solve compilation error on 32bit OSX 2014-06-19 12:24:08 +06:00
Campbell Barton
985892c38c Cycles: only use -fno-rtti with OSL (conflicts with -fsanitize=vptr) 2014-06-17 16:00:16 +10:00
Sergey Sharybin
3144ae2c34 Cycles: Slight modification to the previous commit
This way util_simd.cpp would not require modifications
if/when SSE2 is suddenly supported on 32bit platforms.

This also allowed to unleash some issues with util_simd.h
related on the fact that there size_t and int are actually
the same types.
2014-06-17 01:00:43 +06:00
Sergey Sharybin
2f527a88b6 Cycles: Fix compilation error on 32bit platforms 2014-06-17 00:23:00 +06:00
Sergey Sharybin
b56151ff13 Cycles: Fix compilation error on platforms without SSE2 2014-06-16 23:35:44 +06:00
Sergey Sharybin
ecfc2db6e2 I'd tend to declare dead code is forbidden
All this code blocks commented out with UNUSED comment are
really useless.
2014-06-16 14:08:22 +06:00
Thomas Dinges
6443bfdeb1 * Fix OpenCL after uchar4 commit. 2014-06-15 01:09:59 +02:00
Thomas Dinges
5713d80804 Fix for last commit, forgot changes in Cycles itself. 2014-06-14 16:14:54 +02:00
Bastien Montagne
871a8eb6b2 Fix T40609: Wrong WS between word and '?' (no space in english typography in those cases). 2014-06-14 15:59:12 +02:00
b12151eceb Cycles: glossy and anisotropic BSDF changes
* Anisotropic BSDF now supports GGX and Beckmann distributions, Ward has been
  removed because other distributions are superior.
* GGX is now the default distribution for all glossy and anisotropic nodes,
  since it looks good, has low noise and is fast to evaluate.
* Ashikhmin-Shirley is now available in the Glossy BSDF.
2014-06-14 13:49:57 +02:00
ceb68e809e Cycles: internal code support for anisotropic Beckmann and GGX reflection
Based on:

Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs
E. Heitz, Research Report 2014
2014-06-14 13:49:57 +02:00
Karsten Schwenk
8ce1090d4e Cycles: Ashikhmin-Shirley anisotropic BSDF
* Ashikhmin-Shirley anisotropic BSDF was added as closure
* Anisotropic BSDF node now has two distributions

Reviewers: brecht, dingto

Differential Revision: https://developer.blender.org/D549
2014-06-14 13:49:57 +02:00
f5cb0cf1a5 Cycles: improved importance sampling for Beckmann and GGX glossy
Samples render slower than before, but hopefully this is made up for with
reduced noise in most cases. The main slowdown comes from samples that would
previously be wasted and turn out black, which are now continued.

GGX sampling is about the same speed as before, while for Beckmann it is slower
still. Perhaps optimizations are still possible there, but didn't find anything
easy.

Code from this paper, which comes with sample code:

Importance Sampling Microfacet-Based BSDFs using the Distribution of Visible Normals.
E. Heitz and E. d'Eon, EGSR 2014

Differential Revision: https://developer.blender.org/D572
2014-06-14 13:49:56 +02:00
5fa68133c9 Cycles: volume sampling method can now be set per material/world.
This gives you "Multiple Importance", "Distance" and "Equiangular" choices.

What multiple importance sampling does is make things more robust to certain
types of noise at the cost of a bit more noise in cases where the individual
strategies are always better.

So if you've got a pretty dense volume that's lit from far away then distance
sampling is usually more efficient. If you've got a light inside or near the
volume then equiangular sampling is better. If you have a combination of both,
then the multiple importance sampling will be better.
2014-06-14 13:49:56 +02:00
a29807cd63 Cycles: volume light sampling
* Volume multiple importace sampling support to combine equiangular and distance
  sampling, for both homogeneous and heterogeneous volumes.

* Branched path "Sample All Direct Lights" and "Sample All Indirect Lights" now
  apply to volumes as well as surfaces.

Implementation note:

For simplicity this is all done with decoupled ray marching, the only case we do
not use decoupled is for distance only sampling with one light sample. The
homogeneous case should still compile on the GPU because it only requires fixed
size storage, but the heterogeneous case will be trickier to get working.
2014-06-14 13:49:56 +02:00
d644753319 Cycles code refactor: move some surface and volume path code to separate files. 2014-06-14 13:49:56 +02:00
51a1d6481b Cycles code refactor: deduplicate and symmetrize some path tracing code. 2014-06-14 13:49:56 +02:00
5ab565283d Cycles code refactor: minor changes to light emission code. 2014-06-14 13:49:55 +02:00
Antony Riakiotakis
9073a81bce Fix compilation in cycles 2014-06-14 13:54:38 +03:00
Thomas Dinges
0c1b4c35cd Code cleanup: Avoid duplicate functions for vector combination/separation in SVM.
Differential Revision: https://developer.blender.org/D597
2014-06-14 12:29:15 +02:00
Campbell Barton
019a8bc23b Quiet warning in Cycles 2014-06-14 17:00:15 +10:00
Campbell Barton
788f4858d7 Comment unused macro 2014-06-14 16:27:13 +10:00
Thomas Dinges
0ce3a755f8 Cycles: Add support for uchar4 attributes.
* Added support for uchar4 attributes to Cycles' attribute system.
* This is used for Vertex Colors now, which saves some memory (4 unsigned characters, instead of 4 floats).
* GPU Texture Limit on sm_20 and sm_21 decreased from 95 to 94, because we need a new texture for the uchar4 attributes. This is no problem for sm_30 or newer.

Part of my GSoC 2014.
2014-06-13 23:40:54 +02:00
Sergey Sharybin
7e20583688 Attempt to fix sign conversion error happening on buildbot 2014-06-14 03:35:22 +06:00
Sergey Sharybin
2c105dd17d Follow up for previous commit: need to tweak args for scons as well 2014-06-14 03:10:30 +06:00
Sergey Sharybin
b48d0a6254 Cycles: Fix compilation error of AVX2 kernel with GCC/Clang 2014-06-14 03:02:57 +06:00
Thomas Dinges
be182d9704 Code cleanup. 2014-06-13 22:26:20 +02:00
Thomas Dinges
866c7fb6e6 Cycles: Add an AVX2 CPU kernel.
This kernel is compiled with AVX2, FMA3, and BMI compiler flags. At the moment only Intel Haswell benefits from this, but future AMD CPUs will have these instructions as well.

Makes rendering on Haswell CPUs a few percent faster, only benchmarked with clang on OS X though.

Part of my GSoC 2014.
2014-06-13 22:26:20 +02:00
Thomas Dinges
3de3987ea1 Cycles: Add dedicated nodes to split/combine vectors.
This was already possible via the RGB nodes, but that seems weird.
2014-06-13 21:59:14 +02:00
Thomas Dinges
49df707496 Cycles: Calculate face normal on the fly.
Instead of pre-calculation and storage, we now calculate the face normal during render.
This gives a small slowdown (~1%) but decreases memory usage, which is especially important for GPUs,
where you have limited VRAM.

Part of my GSoC 2014.
2014-06-13 21:59:13 +02:00
Thomas Dinges
cd5e1ff74e Cycles Refactor: Add SSE Utility code from Embree for cleaner SSE code.
This makes the code a bit easier to understand, and might come in handy
if we want to reuse more Embree code.

Differential Revision: https://developer.blender.org/D482

Code by Brecht, with fixes by Lockal, Sergey and myself.
2014-06-13 21:59:12 +02:00
Sergey Sharybin
d0573ce905 Attempt to fix guardedalloc on OSX 2014-06-14 01:52:35 +06:00
Sergey Sharybin
a87fb34eda Use advantage of SSE2 instructions in gaussian blur node
This gives around 30% of speedup for gaussian blur node.

Pretty much straightforward implementation inside the node
itself, but needed to implement some additional things:

- Aligned malloc. It's needed to load data onto SSE registers
  faster. based on the aligned_malloc() from Libmv with
  some additional trickery going on to support arbitrary
  alignment (this magic is needed because of MemHead).

  In the practice only 16bit alignment is supported because
  of the lack of aligned malloc with arbitrary alignment
  for OSX. Not a bit deal for now because we need 16 bytes
  alignment at this moment only. Could be tweaked further
  later.

- Memory buffers in compositor are now aligned to 16 bytes.
  Should be harmless for non-SSE cases too. just mentioning.

Reviewers: campbellbarton, lukastoenne, jbakker

Reviewed By: campbellbarton

CC: lockal

Differential Revision: https://developer.blender.org/D564
2014-06-14 00:38:07 +06:00
Campbell Barton
6c0926e802 Code cleanup: use const for mouse location arg 2014-06-14 00:47:12 +10:00
Campbell Barton
b72eca435e Code cleanup: remove NULL check 2014-06-14 00:47:11 +10:00
Sergey Sharybin
baa0f0ee1a Cycles: Support builtin images for OSL shading backend
This means packed images and movies are now supported when using OSL
backend for material shading.

Uses special file name to distinguish whether image is builtin or not.
This part might become a bit smarted or optimized a bit, but it's good
enough with this implementation already.
2014-06-13 20:42:28 +06:00
Dalai Felinto
aed67dc8a4 Bake-API: Set Custom Cage to be Cage Object
Suggestion by Andy Davies (metalliandy) to conform with industry standard (custom cage is something else apparently)

Note: this is the last bake related commit I plan for 2.71/rc (unless
everyone agrees that we could squeeze in D546 - custom UVs, which would
be really nice to add for 2.71 scripters)

Note 2: I'll update the wiki docs shortly
2014-06-11 22:49:30 -03:00
fb6cb25c1c Fix T40561: cycles refraction node with sharp distribution gives black. 2014-06-11 19:55:16 +02:00
Dalai Felinto
a8a536d23d Bake-API: new approach for cage
There is a new option to select whether you want to use cage or not.
When not using cage the results will be more similar with Blender
Internal, where the inwards rays (trying to hit the highpoly objects)
don't always come from smooth normals. So if the active object has sharp
edges and an EdgeSplit modifier you get bad corners.

This is useful, however, to bake to planes without the need of adding
extra loops around the edges.

When cage is "on" the user can decide on setting a cage extrusion or to
pick a Custom Cage object. The cage extrusion option works in a
duplicated copy of the active object with EdgeSplit modifiers removed to
inforce smooth normals. The custom cage option takes an object with the
same number of faces as the active object (and the same face ordering).

The custom cage now controls the direction and the origin of the
rays casted to the highpoly objects. The direction is a ray from the
point in the cage mesh to the equivalent point to the base mesh. That
means the face normals are entirely ignored when using a cage object.

For developers:
When using an object cage the ray is calculated from the cage mesh to
the base mesh. It uses the barycentric coordinate from the base mesh UV,
so we expect both meshes to have the same primitive ids (which won't be
the case if the cage gets edited in a destructive way).

That fixes T40023 (giving the expected result when 'use_cage' is false).

Thanks for Andy Davies (metalliandy) for the consulting with normal
baking workflow and extensive testing. His 'stress-test' file will be
added later to our svn tests folder. (The file itself is not public yet
since he still has to add testing notes to it).

Many thanks for the reviewers.

More on cages:
http://wiki.polycount.com/NormalMap/#Working_with_Cages

Reviewers: campbellbarton, sergey

CC: adriano, metalliandy, brecht, malkavian

Differential Revision: https://developer.blender.org/D547
2014-06-11 02:39:35 -03:00
30c42d7353 Fix cycles CUDA error when trying to use >= 100 image textures. 2014-06-09 12:40:13 +02:00
Jens Verwiebe
ee812ce880 OSX: Ideasman does not like using utsname, so i use the always satisfactorily working sysctl method now for runtime OS detection 2014-06-06 22:06:26 +02:00
Campbell Barton
8392e83e13 Fix T40514: Cycles world MIS segfault 2014-06-07 00:08:40 +10:00
e4e58d4612 Fix T40370: cycles CUDA baking timeout with high number of AA samples.
Now baking does one AA sample at a time, just like final render. There is
also some code for shader antialiasing that solves T40369 but it is disabled
for now because there may be unpredictable side effects.
2014-06-06 15:39:04 +02:00
Lukas Tönne
07fa016d97 Fix T40282: Renaming node sockets in Cycles nodes causes crash.
Cycles expects to find all node sockets with their correct names, but
this can be changed via the API (see bug report discussion).

Solution for now is to let cycles accept this case gracefully instead
of crashing. The shader will simply use the internal default values for
inputs and any connections will be ignored.

Would be nice to report the error somewhere, but cycles doesn't have a
proper logging system for this purpose yet.
2014-06-06 09:28:26 +02:00
Campbell Barton
ae4ed68dfe Code cleanup: style 2014-06-06 07:54:05 +10:00
Jens Verwiebe
98bf3959b4 OSX: replace deprecated (10.8 ) Gestalt function with utsname, no functional change 2014-06-05 22:14:25 +02:00
865dfa8a7e Fix T40228: cycles CUDA multi GPU + world MIS giving error. 2014-06-05 18:10:32 +02:00