Commit Graph

254 Commits

Author SHA1 Message Date
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
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
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
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
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
fb6cb25c1c Fix T40561: cycles refraction node with sharp distribution gives black. 2014-06-11 19:55:16 +02:00
Thomas Dinges
2c69f1e574 Cleanup: Remove unused total power Emission code in Cycles, that was never exposed in the UI.
Differential Revision: https://developer.blender.org/D562
2014-05-30 14:32:59 +02:00
Campbell Barton
da644a9b58 Quiet warnings with __CUDA_ARCH__ use 2014-05-11 16:17:02 +10:00
Thomas Dinges
c08c931fb6 Cycles / CUDA: Increase maximum image textures on GPU.
Instead of 95, we can use 145 images now. This only affects Kepler and above (sm30, sm_35 and sm_50).

This can be increased further if needed, but let's first test if this does not come with a performance impact.

Originally developed during my GSoC 2013.
2014-05-11 03:38:39 +02:00
Matt Heimlich
3fbc984b06 Nodes: add absolute value operation to all math nodes
Reviewed By: dingto, brecht

Differential Revision: https://developer.blender.org/D507
2014-05-07 16:43:59 +02:00
8641e30787 Fix T40032: hair BSDF not working correct after primitive type code refactoring. 2014-05-05 17:15:48 +02:00
Campbell Barton
dc13969e48 Style cleanup: indentation, braces 2014-05-05 02:19:08 +10:00
Campbell Barton
e86dbf6877 Code cleanup: avoid int/uint mixup in cycles 2014-05-05 01:30:02 +10:00
Campbell Barton
8d16869d83 Code cleanup: Add -Werror=float-conversion to Cycles 2014-05-03 07:31:46 +10:00
Kevin Dietrich
1dcf956849 Fix for wrong behavior of 'darken' blend mode with factor.
The formula was not consistent across Blender and behaved strangely, now it is
a simple linear blend between color1 and min(color1, color2).

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D489
2014-04-29 14:03:09 +02:00
0f85174d50 Fix occasional wrong normal for curves with minimum width.
This caused a couple of fireflies in koro_final.blend. The wrong normal would
cause the shading point to be set as backfacing, which triggered another bug
with hair BSDFs on the backface of hair curves. That one is not fixed yet but
there's a comment in the code about it now.
2014-04-23 01:35:27 +02:00
04a10907dc Code cleanup: remove old closure sampling code Cycles.
This was the original code to get things working on old GPUs, but now it is no
longer in use and various features in fact depend on this to work correctly to
the point that enabling this code is too buggy to be useful.
2014-04-21 16:14:37 +02:00
Carlo Andreacchio
7765b73f6d Cycles: add Transparent Depth output to Light Path node.
This can for example be useful if you want to manually terminate the path at
some point and use a color other than black.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D454
2014-04-21 14:44:36 +02:00
2a9ef256b1 Cycles: SVM optimization for mix shaders, to skip more code when the mix weight
for one of the input shaders is zero.

This gives about 5% speedup for koro_final.blend. In general this is important
so you can design shaders that run faster for shadows, diffuse bounces, etc, for
example by skipping procedural textures or even using a single fixed color.
2014-04-18 14:40:19 +02:00
72308669ce Fix T39284: clamp cycles volume density to be >= 0, to avoid accidental strange shading. 2014-04-15 15:19:23 +02:00
Sv. Lockal
ab32a1807d Cycles: SSE optimization for Voronoi cells texture
Gives 5-6% speedup for Caterpillar_PatazStudio.blend.

Reviewed By: brecht, dingto

Differential Revision: https://developer.blender.org/D419
2014-04-03 23:35:10 +04:00
5e5ec4c138 Fix T39577: cycles issue mixing anisotropic BSDFs with branched path tracer. 2014-04-03 15:59:39 +02:00
Kevin Dietrich
cb7cfd3ab6 Cycles: add dedicated UV Map node, easier to find and has convenient auto complete.
Fixes T37954.

Reviewed By: brecht, dingto

Differential Revision: https://developer.blender.org/D230
2014-04-02 11:53:44 +02:00
27043b8e40 Cycles code internals: add support for mesh voxel grid attributes.
These are internally stored as a 3D image textures, but accessible like e.g.
UV coordinates though the attribute node and getattribute().

This is convenient for rendering e.g. smoke objects where data like density is
really a property of the mesh, and it avoids having to specify the smoke object
in a texture node, instead the material will work with any smoke domain.
2014-03-29 13:03:48 +01:00
e8b1cfed0a Cycles code refactor: replace magic ~0 values in the code with defines. 2014-03-29 13:03:47 +01:00
6020d00990 Cycles: add support for mesh deformation motion blur. 2014-03-29 13:03:47 +01:00
0509553b5e Cycles code refactor: changes to make adding new primitive types easier. 2014-03-29 13:03:46 +01:00
Martijn Berger
a8039d99f8 Fix cycles texture interpolation mode closest constant offset on some devices 2014-03-13 20:08:33 +01:00
Martijn Berger
dd2dca2f7e Add support for multiple interpolation modes on cycles image textures
All textures are sampled bi-linear currently with the exception of OSL there texture sampling is fixed and set to smart bi-cubic.

This patch adds user control to this setting.

Added:
- bits to DNA / RNA in the form of an enum for supporting multiple interpolations types
- changes to the image texture node drawing code ( add enum)
- to ImageManager (this needs to know to allocate second texture when interpolation type is different)
- to node compiler (pass on interpolation type)
- to device tex_alloc this also needs to get the concept of multiple interpolation types
- implementation for doing non interpolated lookup for cuda and cpu
- implementation where we pass this along to osl ( this makes OSL also do linear untill I add smartcubic to the interface / DNA/ RNA)

Reviewers: brecht, dingto

Reviewed By: brecht

CC: dingto, venomgfx

Differential Revision: https://developer.blender.org/D317
2014-03-07 23:16:33 +01:00
Sv. Lockal
bd44dcb632 Better fix for T38501: blender crashes right after adding image texture to
material in cycles

Buggy MSVC 2008 in 32-bit mode ignores stack align attribute for float3.
Now it uses reference to __m128, which is always aligned.
2014-02-11 17:48:23 +04:00
Sv. Lockal
7096529704 Fix T38501: blender crashes right after adding image texture to material
in cycles

Also fix very similar problem in half-float SSE conversion.
2014-02-10 17:19:26 +04:00
Thomas Dinges
685c7a2272 Code cleanup: Remove Debug closure declaration. 2014-02-09 14:41:45 +01:00
eff3bd4e98 Fix T38439: allow IOR in range [0, inf] instead of [1, inf] in Cycles.
The same can be achieved by flipping normals on the mesh, but it can be
convenient to do this in the shader.
2014-02-03 17:08:34 +01:00
Sv. Lockal
1ff299b317 Cycles: less instructions for CPU perlin code
Also move shuffle() in bvh traversal back (was accidentally lost in SSE hair revert)
2014-02-01 14:07:53 +04:00
Sv. Lockal
1c49eb0072 Cycles, Code cleanup: simplify code for color linear interpolation and float math
Reviewed By: brecht

Differential Revision: https://developer.blender.org/D215
2014-01-14 22:55:02 +04:00
Thomas Dinges
e9984653a8 Cycles: Fix Wave texture difference between OSL and SVM, OSL wasn't using the "Scale" properly for distortion. 2014-01-13 22:01:39 +01:00
Thomas Dinges
6b61f7f755 Code cleanup / Cycles: Don't pass scale to texture functions, do the multiplication in the function call already. 2014-01-13 21:17:55 +01:00
Sv. Lockal
9cf6946d31 Fix cycles texture crash on win x86-64 + msvc 11
Use union for __m128 aliasing; while gcc supports no-strict-aliasing attribute, unions are the most common way to deal with __m128 in msvc.
2014-01-13 18:31:02 +04:00
Sv. Lockal
d6c022d6d7 Fix compilation for OpenCL (and small stype fixes) 2014-01-12 18:18:43 +04:00
Sv. Lockal
47c5898fa1 Cycles: SSE for Voronoi textures (targeted for Haswell CPUs)
Gives up to 15% speedup scenes with voronoi-based textures (up to 25% with volumes) on Haswell. The performance change for other CPUs is much smaller: 1-2%.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D203
2014-01-12 18:14:00 +04:00
Sv. Lockal
da3fdf0b4b Code Cleanup: in Cycles SSE replace macros with templates, skip unused code with preprocessor, simplify casts 2014-01-11 22:20:03 +04:00
Sv. Lockal
20b046d763 Cycles: workaround for noise performance regression in CUDA 5.5
Use manual ternary operation widening in grad(). Without it nvcc 5.5 produces multiple branch splits with very big branches (because of inlining). This solves 19% performance regression for BMW1M-MikePan.blend.

Also remove one redundant instruction in perlin SSE (when h == 12 or h == 14, then h is always >= 4).

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D190
2014-01-08 22:25:55 +04:00
7b0a46b1ff Fix CUDA/OpenCL compile errors in scattering commit. 2014-01-07 15:48:04 +01:00
01df756bd1 Cycles Volume Render: scattering support.
This is done by adding a Volume Scatter node. In many cases you will want to
add together a Volume Absorption and Volume Scatter node with the same color
and density to get the expected results.

This should work with branched path tracing, mixing closures, overlapping
volumes, etc. However there's still various optimizations needed for sampling.
The main missing thing from the volume branch is the equiangular sampling for
homogeneous volumes.

The heterogeneous scattering code was arranged such that we can use a single
stratified random number for distance sampling, which gives less noise than
pseudo random numbers for each step. For volumes where the color is textured
there still seems to be something off, needs to be investigated.
2014-01-07 15:03:41 +01:00
Sv. Lockal
acc90b40bf Cycles: Minor optimization (~1%) for texture access on CPU 2014-01-06 22:05:31 +04:00
Sv. Lockal
4817da0df4 Cleanup: use blend() in perlin noise (gives 12 less instructions on SSE4.1) 2014-01-06 21:24:28 +04:00
Sv. Lockal
96903508bc Cycles: SSE optimization for sRGB conversion (gives 7% speedup on CPU for pavillon_barcelone scene)
Thanks brecht/dingto/juicyfruit et al. for testing and reviewing this patch in T38034.
2014-01-06 20:03:30 +04:00
9cd2b19999 Cycles Volume Render: generated texture coordinates for volume render.
This does not support staying fixed while the surface deforms, but for static
meshes it should match up with the surface texture coordinates. Implemented
as a matrix transform from objects space to mesh texture space.

Making this work for deforming surfaces would be quite complicated, you might
need something like harmonic coordinates as used in the mesh deform modifier,
probably will not be possible anytime soon.
2013-12-31 17:38:26 +01:00
3f39af9cc2 Fix cycles volume render crash when trying to access primitive attributes
like generated texture coordinates or tangents.
2013-12-28 23:39:15 +01:00