Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2011-09-16 17:14:02 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2011-09-16 17:14:02 +0400
commit66b1dfae89cc44953bd51c5da962cab437e76972 (patch)
treee7679b3e554fb4f1bb6f68775c8619bcde0da822 /intern/cycles/kernel/kernel_montecarlo.h
parent0a5fcf3da3e82fd114095c8c2903d927f15ffc31 (diff)
Cycles: tweaks to properties and nodes
* Passes renamed to samples * Camera lens radius renamed to aperature size/blades/rotation * Glass and fresnel nodes input is now index of refraction * Glossy and velvet fresnel socket removed * Mix/add closure node renamed to mix/add shader node * Blend weight node added for shader mixing weights There is some version patching code for reading existing files, but it's not perfect, so shaders may work a bit different.
Diffstat (limited to 'intern/cycles/kernel/kernel_montecarlo.h')
-rw-r--r--intern/cycles/kernel/kernel_montecarlo.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/intern/cycles/kernel/kernel_montecarlo.h b/intern/cycles/kernel/kernel_montecarlo.h
index 6f3a3dd3421..5d9afb6418f 100644
--- a/intern/cycles/kernel/kernel_montecarlo.h
+++ b/intern/cycles/kernel/kernel_montecarlo.h
@@ -172,6 +172,30 @@ __device float2 concentric_sample_disk(float u1, float u2)
return make_float2(r * cosf(theta), r * sinf(theta));
}
+__device float2 regular_polygon_sample(float corners, float rotation, float u, float v)
+{
+ /* sample corner number and reuse u */
+ float corner = floorf(u*corners);
+ u = u*corners - corner;
+
+ /* uniform sampled triangle weights */
+ u = sqrtf(u);
+ v = v*u;
+ u = 1.0f - u;
+
+ /* point in triangle */
+ float angle = M_PI_F/corners;
+ float2 p = make_float2((u + v)*cosf(angle), (u - v)*sinf(angle));
+
+ /* rotate */
+ rotation += corner*2.0f*angle;
+
+ float cr = cosf(rotation);
+ float sr = sinf(rotation);
+
+ return make_float2(cr*p.x - sr*p.y, sr*p.x + cr*p.y);
+}
+
/* Spherical coordinates <-> Cartesion direction */
__device float2 direction_to_spherical(float3 dir)