Commit Graph

2256 Commits

Author SHA1 Message Date
Sergey Sharybin
c9fa37fbcd Cycles: Initialize "headless" flags on engine initialization
This flag is global for all the sessions and never changes. so it doesn't
really make sense to pass it around to all sessions and synchronization
routines.

Switched to a static member of BlenderSession now, but it's probably more
logical to introduce some sort of BlenderGlobals. Doesn't currently worth
a hassle for a single boolean flag tho.
2015-02-18 21:52:51 +05:00
Thomas Dinges
6f3500db05 Cleanup: Remove unused SD_PHASE_HAS_EVAL flag.
We only have a non-singular volume closure and therefore no need to distinguish it.
2015-02-18 16:33:31 +01:00
Thomas Dinges
a2366a3a2e Cleanup for Cycles hair shader ifdefs.
sc->T and sc->data2 were behind __HAIR__ ifdef, now they are not anymore, so we can always assign the correct value.
2015-02-18 15:57:39 +01:00
Thomas Dinges
bf0a001e61 Cleanup: Remove support for Boost filesystem 2.
This is deprecated since Boost 1.48.
2015-02-18 13:49:49 +01:00
Thomas Dinges
7f7413bce2 Cleanup: Use bools in BVHParams class. 2015-02-18 12:05:59 +01:00
Thomas Dinges
bd92168643 Cycles / BVH: Remove unused temp copy of prim_object.
This will save some memory during BVH Build.
2015-02-18 01:14:59 +01:00
Sergey Sharybin
ef11be0e77 Cycles: Avoid over-allocation in decouple ray marching
It could have happened with really long rays and small steps.

Step size will be adjusted to the clamped number of steps in order
to preserve render result compatibility as much as possible.

We should probably reformulate this a bit, so it will give the
same looking results without step tweaks. But this new behavior
should already be much better that it was before.
2015-02-18 02:26:24 +05:00
Thomas Dinges
7e73b6aa25 Cleanup: Add comment about light_p being modified in one case. 2015-02-17 19:24:37 +01:00
Sergey Sharybin
1aa93dd9fd Cycles: Cleanup after recent changes 2015-02-17 23:21:53 +05:00
Thomas Dinges
e6f40b4ceb Some tweaks to last commit, this is better. 2015-02-17 19:03:50 +01:00
Sergey Sharybin
f3e831f02d Cycles: Fix for hair transmission BSDF not returning proper label 2015-02-17 22:40:00 +05:00
Thomas Dinges
6f820664c4 Cleanup: Deduplicate area light sampling code. 2015-02-17 18:39:37 +01:00
Thomas Dinges
a0d7db503d Cycles: Small tweaks for Henyey Greenstein closure code.
* Avoid duplicative fabs(g) check in sample code.
* Avoid dot product in eval code.

Helps like ~1% when Scatter Anisotropy is 0.
2015-02-17 17:48:18 +01:00
Thomas Dinges
bf878d3c3d Cycles: Remove empty closure blur code and the corresponding entries in the switch.
Most compilers will probably optimize that out, but I still don't see a reason to keep it.
2015-02-17 13:44:25 +01:00
Sergey Sharybin
4660c00ac5 Cycles: Make blender session aware of rendering from command line
This way we can do some more aggressive policy about releasing temporary
data during synchronization.
2015-02-17 16:25:16 +05:00
Sergey Sharybin
cdc1dab073 Fix T43685: New pointiness attribute error with auto-smooth enabled
Simple fix: all vertex attributes should be filled in before split.
2015-02-17 13:49:11 +05:00
Sergey Sharybin
587d8771e0 Cycles: Minor code cleanup in recent attributes changes 2015-02-17 13:46:25 +05:00
Thomas Dinges
fa9311c9a4 Cleanup: Update comments and make it more clear what volume interpolation is for. 2015-02-16 22:11:41 +01:00
Bastien Montagne
00a3c9afc8 UI messages fixes and cleanup. 2015-02-16 20:38:07 +01:00
Thomas Dinges
fd4f0ed39e Cleanup: Remove unused code from hair BSDF. 2015-02-16 15:23:01 +01:00
Thomas Dinges
7c3d5a3337 Cycles: Use some more bools in microfacet code. 2015-02-16 12:32:42 +01:00
Sergey Sharybin
9daac198f5 Cycles: Correction for C++11 compilation error after recent vector changes 2015-02-16 15:38:13 +05:00
Sergey Sharybin
478d67e858 Cycles: Hopefully compilation error fix for OSX 2015-02-15 23:11:33 +05:00
Sergey Sharybin
a83b2d3fd9 Cycles: Fix wrong attribute count calculation in prevous commit
The workaround for generated texture coordinates is to be done before
calculating number of elements for attribute, otherwise counter wouldn't
include those attributes.
2015-02-15 02:55:18 +05:00
Sergey Sharybin
1862fbf203 Cycles: Optimize memory usage when creating mesh attributes
The idea behind the change is to pre-allocate attribute arrays in advance,
which avoids re-allocation of arrays later for each of meshes being handled.

This reduces peak memory used by Cycles database from 1.3G to 0.9G for
victor.blend from Gooseberry.

It doesn't mean every file will benefit from this change since peak memory
usage is happening in the different places of the rendering code.

Also, unfortunately, attributes export might not cause the peak of render
preparation stage. That said, it's actually object_to_mesh() which causes
the memory to peak in the same test file. So we really need to optimize that
part first in order to get visible results for artists. But in any case it's
now quite easy to track hotspots in Cycles itself which is good.
2015-02-15 02:01:48 +05:00
Sergey Sharybin
18937f6fb5 Cycles: Add ifdef switch to use blender's guardedalloc for vector allocation
It's actually a bad level call, but it's inside ifdef block and disabled by
default and only intended to be used for development purposes.

Main idea of this change is to combine statistics coming from Cycles and
Blender during scene synchronization step, to see if further changes are
actually reducing memory footprint.
2015-02-15 02:01:48 +05:00
Sergey Sharybin
d0cc1180b0 Cycles: Add utility method to vector which totally frees memory used the vector
The method is called vector::free_memory(). Use with care since it'll invalidate
all the pointers to vector memory, all iterators and so on.

Currently unused, but might become handy when clearing unused data.
2015-02-15 02:01:48 +05:00
Sergey Sharybin
aad96506c1 Cycles: Report system memory usage and peak after scene device update
This only happens when built with WITH_CYCLES_DEBUG flag, memory statistics
is coming from guarded STL allocator.
2015-02-15 02:01:48 +05:00
Sergey Sharybin
a445e49186 Cycles: Implement guarded allocator for STL classes
The commit implements a guarded allocator which can be used by STL classes
such as vectors, maps and so on. This allocator will keep track of current
and peak memory usage which then can be queried.

New code for allocator is only active when building Cycles with debug flag
(WITH_CYCLES_DEBUG) and doesn't distort regular builds too much.

Additionally now we're using own subclass of std::vector which allows us
to implement shrink_to_fit() method which would ensure capacity of the
vector is as big as it should be (without this making vector smaller will
still use all previous memory allocated).
2015-02-15 02:01:48 +05:00
Sergey Sharybin
01067fe51c Cycles: Replace own aligned allocator with system one
This replaces our own implementation of aligned malloc with system calls,
which depends on which operation system you're on.

This is probably really minor noticeable change, but in the same time it
might reduce amount of wasted memory.
2015-02-15 02:01:48 +05:00
Thomas Dinges
354cf76803 Cleanup: Comment block for sse helpers. 2015-02-14 20:57:21 +01:00
Thomas Dinges
d979f39cf1 Cycles: Small improvement for volume render (decoupled)
Simplify branching here a bit, helps ~3% in volume_light_sampling.blend (Branched MIS scene).
2015-02-14 20:44:30 +01:00
Sergey Sharybin
2fad3132a3 Cycles: Fix compilation error of Cycles standalone with Libmv disabled 2015-02-14 21:33:14 +05:00
Thomas Dinges
270bbc89ec Fix Cycles compilation on x86, without SSE. 2015-02-13 09:29:16 +01:00
Antony Riakiotakis
8de421bbf1 Use the RNA for overriding the name instead. 2015-02-12 19:59:34 +01:00
Antony Riakiotakis
d0a91eb1b4 More naming refinement GPU fstop -> Viewport f-stop 2015-02-12 19:50:19 +01:00
Antony Riakiotakis
f20fa24ba1 Add DOF fstop property for cycles, also don't grey it out when object is
set as focused
2015-02-12 19:35:43 +01:00
Campbell Barton
7221fbe9dd cleanup 2015-02-12 23:51:02 +11:00
Thomas Dinges
f2951c23cf Cleanup: Remove unused Cycles cpuid code. 2015-02-11 11:28:42 +01:00
Sergey Sharybin
4b04a4e2ff Cycles: Control CPU capabilities via environment variables
Purely developers-only feature which allows to disable some of the CPU
capabilities. This way it's easier to test different kernels on the
same machine.
2015-02-11 01:56:58 +05:00
Sergey Sharybin
bb08502cf4 Cycles: Fallback to bottom-top tile order when rendering from the command line
In the worst case it'll do nothing, in the best case it might give some percent
of speedup because of better cache coherency.

Currently it's all handled as an override on blender_python level, don't really
see reason to penetrate the boolean flag further into sync code. This can always
be done later if needed.
2015-02-11 01:11:57 +05:00
Sergey Sharybin
13ad69c68e Cycles: Add print functions for sse3f, sse3i and sse3b 2015-02-11 00:20:34 +05:00
Sergey Sharybin
5646a9f759 Cycles: Add utility functions to print ssef, ssei and sseb
Nothing special, just really handy for debugging.
2015-02-11 00:11:04 +05:00
Sergey Sharybin
4e37b29631 Cycles: Move mesh attribute creation into separate functions
This makes overall code of create_mesh() much cleaner and easier to follow.
2015-02-10 23:41:54 +05:00
Sergey Sharybin
0b1a886292 Cycles: optimize one normalization out from the previous commit 2015-02-10 21:32:44 +05:00
Sergey Sharybin
227a94077f Cycles: implement pointiness geometry attribute
This attribute means how "pointy" the geometry surface is, which allows to do
effects like dirt maps and wear-off effects on render geometry. This means the
attribute is calculated for the final mesh which means no baking (which implies
UV unwrap) is needed. Apart from this the behavior is quite close to how vertex
dirty colors works.

The new attribute is available as an output socket of Geometry node.

There's no penalty for the render time, only some delay on scene preparation
(the delay is linear of the mesh complexity).

Reviewers: brecht, juicyfruit

Subscribers: eyecandy, venomgfx

Differential Revision: https://developer.blender.org/D1086
2015-02-10 20:33:41 +05:00
Sergey Sharybin
edb7195f27 Cycles: Bring back distance check in re-intersection
From more investigation of the numeric failures in the kernel it appears
the check was rather correct. But in theory it;s also needed for the motion
triangles.
2015-02-10 19:07:55 +05:00
Sergey Sharybin
b03ac83843 Cycles: Correction to glossy shaders not handling total internal reflection
The issue was caused by lack of check for whether fresnel term is actually
giving total internal reflection in refraction BSDFs. This lead to usage of
arbitrary vector of (0, 0, 0) as reflection, giving numeric issues in other
areas of the kernel.

This gives some visual changes of sharp reflection but it seems to be rather
proper now. Which also corresponds with rough glossy reflection with sharpness
set to 0.001 (previously it was totally different from sharpness of 0.0, which
is just weird).
2015-02-10 18:20:36 +05:00
Sergey Sharybin
298d8681a0 Fix T43596: Refraction BSDF crashes blender on pre-sse4 CPU
This is the same issue T43475: SSE4 code is more robust to non-finite values
in the ray origin/direction. So for now added a check before doing BVH traversal
for pre-SSE4 CPUs.

For sure actual root of the issue is a bit different and much more tricky to
solve, especially without disturbing render results too much. Still looking
into this.

In any case, it's kinda fine to have such a check, we might later make it to be
a kernel_assert() instead of just a return.
2015-02-10 17:36:05 +05:00
Sergey Sharybin
b83d851901 Cycles: Another attempt to solve 32bit CUDA kernel
Previous fix didn't quite work well. For some reason everything worked fine when
using native nvcc in 32bit environment, but cross-compiling from 64bit platform
it was still running out of memory.

For now just made it so all the kernels are slower on 32bit CUDA as a temporary
solution. Either it'll be solved in next CUDA releases (by dropped 32bit? =\) or
we'll find better workaround.
2015-02-09 16:14:44 +05:00