Commit Graph

879 Commits

Author SHA1 Message Date
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
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
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
Sergey Sharybin
a192facd8c Fix T41276: OSL bug in getmessage ("trace", "geom:name" , output) 2014-08-05 17:54:08 +06: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
34937f6547 Fix T41139: Cycles Hair BSDF roughness problem 2014-07-27 19:51:28 +06: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
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
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
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
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
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
Thomas Dinges
ef22e972b1 Code cleanup: Simplify decoupled scattering code a bit. 2014-07-07 13:28:10 +02: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
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
Thomas Dinges
6ac0652395 Cleanup: Update list and remove ifdef here. 2014-07-02 00:58:06 +02: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
8df6769040 CMake: update source files 2014-06-28 23:17:11 +10: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
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
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
Campbell Barton
2dce13d213 Python: Remove deprecated uses of os.popen
T40415 by Lawrence D'Oliveiro
2014-06-20 02:00:46 +10:00
Thomas Dinges
6443bfdeb1 * Fix OpenCL after uchar4 commit. 2014-06-15 01:09:59 +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
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
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