Commit Graph

2033 Commits

Author SHA1 Message Date
Thomas Dinges
75f518ccb9 Cycles: Remove dead branch for Distant lamps, ls->t is always FLT_MAX here. 2014-11-08 16:47:56 +01:00
Campbell Barton
7b873b0662 Add safe_normalize to cycles, avoid checking length first
This won't give any big speedup,
just avoids redundant sqrtf and may be useful in future.

Differential Revision: https://developer.blender.org/D880
2014-11-08 13:37:42 +01:00
Campbell Barton
112032f2ff Cleanup: cycles whitespace 2014-11-08 13:37:42 +01:00
Sergey Sharybin
a8b9402c8f Cycles: Tweak to the expf() speed workaround
Add compile-time check for particular glibc version which fixed the issue.
This makes it so own-compiled blender is the fastest in the world, and the
only issue remains what should we do for release builds.

After some discussion with Campbell we decided to keep it as is for now
because slowdown is not that much noticeable. We'll disable this workaround
for release builds when all the majority of the distros will switch to the
new version of glibc.
2014-11-07 13:35:45 +05:00
Thomas Dinges
fb820c0638 Cycles: Add "Max Bounce" control for lamps
With this setting, we can limit the influence of a lamp to a certain amount of bounces.
0 = Only direct light contribution
1 = 1 light bounce
...

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

You can find an example render in the release logs: http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.73/Cycles
2014-11-05 22:49:09 +01:00
Sergey Sharybin
1073c6ae8e Cycles: Don't check shader for volume when checking if camera is inside volume
Intersection code already ignores objects without volume closure so checking it
afterwards is not needed.
2014-11-04 19:57:15 +01:00
Sergey Sharybin
4a9b912b96 Fix T42411: Camera inside volume + particle dupli (object/group) doesn't work
The issue was caused by missing current object instance initialization after
object was ignored for instance push.
2014-11-04 19:55:05 +01:00
Sergey Sharybin
ffbd9448c8 Cycles: Remove compatibility code for OSL-1.4
That code was mainly needed for the transition period, now we've
got all platforms updated to new OSL.

Plus there are some crucial fixes baking in the current upstream
sources which we'll need to have for the next Blender release.
2014-11-04 16:19:45 +05:00
Sergey Sharybin
d5f978b3cc Cycles: Be ready for new OIIO and OSL libraries
Even tho it's not 100% clear when we'll switch to OSL-1.6 we'd better
start preparing earlier for this, so we don't spend time on this later.

Plus this code helps troubleshooting some OSL issues, which requires
testing with latest versions of OSL.
2014-11-04 16:19:45 +05:00
Bastien Montagne
c14d34322b Fix typo breaking compilation with SSE2.
Spotted by sybrenstuvel (Sybren Stüvel), thanks!
2014-11-02 23:01:09 +01:00
Sergej Reich
cbf2fab9ea Cycles: Remove redundant alloc/free
Seems like a copy paste error.
2014-11-01 15:23:14 +01:00
Sergey Sharybin
bf13f1a263 Cycles: Code cleanup, proper class vs. struct declaration 2014-11-01 03:09:46 +05:00
Thomas Dinges
29c71b2c09 Cleanup: Remove unused light function. 2014-10-31 22:54:05 +01:00
Sergey Sharybin
95687f9751 Fix T42349: Windows Render command line Cycles Crash
The issue was caused by GLEW MX enabled in SCons by default so
basically previous commit already fixed the crash. But we need
to be safe here.

For now the fix is simple and not that clean, just check if
there's an OpenGL context available and if not we don't do any
GLSL magic.

This is to be cleaned up after some discussion with the viewport
project guys.
2014-10-31 22:51:49 +05:00
Sergey Sharybin
f9688d88ff Fix T42391: HSV correction shader node gives negative values
This mainly happens when over-saturating already saturated color.
After some discussion with Campbell and loads of tests we decided
to clamp the result RGB color. As an alternative we might want to
clamp corrected HSV values instead, but that would lead to some
larger changes in the render results.

TODO: The same is to be done for compositor nodes.
2014-10-31 14:58:00 +01:00
Thomas Dinges
4ff8744669 Cycles / CUDA: Better fix for missing sm_52 kernel, in case user compiles himself. 2014-10-30 11:42:59 +01:00
Thomas Dinges
d5ed153760 Cycles / OSL: Support microfacet() closure color function from OSL 1.5
This is basically just a wrapper class, which maps the generic call from the OSL spec to our closures.

Example usage:

shader microfacet_osl(
    color Color = color(0.8),
    int Distribution = 0,
    normal Normal = N,
    vector Tangent = normalize(dPdu),
    float RoughnessU = 0.0,
    float RoughnessV = 0.0,
    float IOR = 1.4,
    int Refract = 0,
    output closure color BSDF = 0)
{
    if (Distribution == 0)
        BSDF = Color * microfacet("ggx", Normal, Tangent, RoughnessU, RoughnessV, IOR, Refract);
    else
        BSDF = Color * microfacet("beckmann", Normal, Tangent, RoughnessU, RoughnessV, IOR, Refract);
}
2014-10-30 11:33:27 +01:00
Martijn Berger
4b33667b93 Deduplicate some code by using a function pointer to the real kernel
This has no performance impact what so ever and is already used in the adaptive sampling patch
2014-10-30 10:23:44 +01:00
Campbell Barton
133f79e449 Cleanup: warnings, typos 2014-10-29 14:15:21 +01:00
Sergey Sharybin
6a4a911fc3 Cycles: Optimize math node without links to a single value node
Pretty straightforward implementation. Just needed to move some functions
around to make them available at shader compile time.
2014-10-29 16:31:13 +05:00
Thomas Dinges
db4d7004d8 Cycles: Add a soft min/max UI value for volume step size, usually a range from 0.01 to 1.0 is fine. 2014-10-29 12:16:38 +01:00
Thomas Dinges
6d1c0260bb Cleanup: Style fixes for closures, mainly bitflags and conditions. 2014-10-29 09:56:21 +01:00
Thomas Dinges
13ca9873c9 Cleanup: Remove unused function in Translucent BSDF. 2014-10-29 09:42:19 +01:00
Campbell Barton
eaaeae4699 Cleanup: spelling 2014-10-23 10:38:38 +02:00
Sergey Sharybin
553ec988e7 Revert "Cycles: Implement Mitchell-Netravali pixel filter"
As it appears we can't really use mitchell filter together with the
current filter importance sampling,

This reverts commit 742911314322e5dae3a07469d0ca53b61427f978.
2014-10-22 22:55:09 +06:00
Sergey Sharybin
7429113143 Cycles: Implement Mitchell-Netravali pixel filter
It's the same filter which is used by default by Blender Internal renderer
and it gives crispier edges than gaussian filter.

Default filter for Cycles is unchanged because it's unclear if new filter
gives more noise or not. After some further real production tests we can
consider making Mitchell filter default for Cycles as well.
2014-10-22 18:11:40 +02:00
Sergey Sharybin
e2c04a8bf0 Cycles: Code cleanup -- use bitshifts instead of hardcoded constants
This way it's easier to extend bitfields and see when we start running
out of free bits.

Plus added brief description of what SD_VOLUME_CUBIC flag means.
2014-10-22 20:51:40 +06:00
Sergey Sharybin
1be189f000 Cycles: Get rid of hardcoded enum values in the code
Still need to keep enum definition in sync with the python code,
but the code itself is a bit more clear to understand now.
2014-10-22 16:17:03 +02:00
Sergey Sharybin
d2d1b19170 Cycles: Expose volume voxel data interpolation to the interface
It is per-material setting which could be found under the Volume settings
in the material and world context buttons.

There could still be some code-wise improvements, like using variable-size
macro for interp3d instead of having interp3d_ex to which you can pass the
interpolation method.
2014-10-22 19:53:06 +06:00
Sergey Sharybin
c24698a37e Cycles: Implement tricubic b-spline interpolation for CPU texture_image
This is the first step towards supporting cubic interpolation for voxel
data (such as smoke and fire). It is not epxosed to the interface at all
yet, this is to be done soon after this change.
2014-10-22 19:41:58 +06:00
Sergey Sharybin
5e2f3c0102 Fix T42178: Cycles Film Exposure not triggering Viewport update 2014-10-21 14:08:28 +02:00
Bastien Montagne
09351c68e1 Cleanup, since we don't put Cycles compat into regular bl_ui files. ;) 2014-10-17 21:07:21 +02:00
Sergey Sharybin
80a3f4fecf Cycles: Fix for possibly uninitialized variable
That's rather harmless in the master, just could cause some issues with the patches.
2014-10-17 10:57:19 +02:00
Thomas Dinges
b0ef008741 Different fix for T42262, we don't put Cycles compat into regular bl_ui files. 2014-10-16 23:27:38 +02:00
Sergey Sharybin
bc411ec06e Cycles: Implement an area preserving parameterization sampling for area lamps
Replace old code for area lamps which was more like incorrect with more correct
one using the following paper as a reference:

  Carlos Urena et al.
  An Area-Preserving Parametrization for Spherical Rectangles.
  https://www.solidangle.com/research/egsr2013_spherical_rectangle.pdf

Implementation is straight from the paper, currently the rectangle constants are
calculated for each of the samples. Ideally we need to pre-calculate them.

Some comparison images are available there

  http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.73/Cycles

Reviewers: brecht, juicyfruit

Subscribers: dingto, ton

Differential Revision: https://developer.blender.org/D823
2014-10-16 14:40:29 +02:00
Sergey Sharybin
acd7f50308 Fix T42160: CUDA error: ILLEGAL_ADDRESS in cuCtxSynchronize()
This is so-called GPU limitation boundary hit, told compiler to NOT include
volume bound function, otherwise some real weird things used to happen.

We actually might want to do the same for CPU, inlining everything is not
the way to get fastest code.
2014-10-15 16:25:04 +02:00
Sergey Sharybin
63dc2e9b74 Futher tweaks to WITH_CPU_SSE option
Explicitly disable SSE kernels in Cycles when this option is used.
2014-10-15 18:45:09 +06:00
Sergey Sharybin
e556670b36 Cycles: Do cuda pointer arithmetic in integers, don't use pointer arithmetic
This should hopefully fix https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=765187
2014-10-14 17:54:41 +02:00
Sergey Sharybin
383bd34111 Fix T42021: OSL doesn't work when there are non-ascii chars in the path
Quite annoying, the same thing we do from the blender side, But as a positive
side we can get rid of some utf8/utf16 conversions.

Hopefully it all work fine now, at leats works on mu russki windoze laptop.
2014-10-14 14:56:21 +02:00
Thomas Dinges
cc03689962 Fix embarrassing typo... 2014-10-13 15:26:00 +02:00
Thomas Dinges
858bf1adea Cycles: Add CUDA support for sm_32 (Tegra K1, Jetson TK1).
Fix T42174.
2014-10-12 18:17:00 +02:00
Thomas Dinges
744aaa955f Cleanup: Typo fix for Blackbody variable, had different naming in the comments and also in OSL. 2014-10-12 14:18:30 +02:00
Campbell Barton
abd38c00f1 Cycles: set hit values in-order 2014-10-11 11:17:08 +02:00
Bastien Montagne
0f1c3958da Fix typo breaking compilation with rather strict flags (does not like implicit double to float conversion). 2014-10-10 15:11:23 +02:00
Sergey Sharybin
5711025765 Cycles: Use a bit better approach for erfinv()
Also reduce number of branching and multiplications a bit by inlining the branches.

This gives an unmeasurable speedup, which is in case of BMW is about 2% here.
2014-10-10 13:40:09 +02:00
Sergey Sharybin
45ce901079 Cycles: Remove redundant float4->float3 conversion
Not as if it gives noticeable changes render-time, but it's just weird to
convert float4 to float 3 to just access individual x/y/z components.

Plus some compilers might be more stupid than GCC and don't optimize this
out well.
2014-10-09 11:48:47 +02:00
Campbell Barton
efee3be1d3 Cycles: enable double promotion warning /w gcc 2014-10-08 10:58:40 +02:00
Campbell Barton
be3a6d78e8 Cycles: reduce float/double conversions 2014-10-08 00:13:26 +02:00
Campbell Barton
e2522b4a29 Cycles: correct math wrappers
include the parens around value before cast,
in some cases was causing double/float promotion by only casting the left value.
2014-10-08 00:13:26 +02:00
Jason Wilkins
8d084e8c8f Ghost Context Refactor
https://developer.blender.org/D643
Separates graphics context creation from window code in Ghost so that they can vary separately.
2014-10-07 15:47:32 -05:00