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:
authorLukas Stockner <lukas.stockner@freenet.de>2016-02-21 16:14:52 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2016-02-21 17:10:51 +0300
commitc359343f8dae6689c955dc1fa700cb26f6cd2e95 (patch)
tree069227e98602a6d39c942ea01011486bdfd16855 /intern/cycles/kernel
parenta447421dec85bff477bd5c16934914d2135dc17a (diff)
Fix T43388, fix T40369: Cycles baking not antialiasing textures.
This re-enables the AA jittering, but with proper clamping so that u >= 0, v >= 0 and u+v <= 1. Differential Revision: https://developer.blender.org/D1254
Diffstat (limited to 'intern/cycles/kernel')
-rw-r--r--intern/cycles/kernel/kernel_bake.h13
1 files changed, 5 insertions, 8 deletions
diff --git a/intern/cycles/kernel/kernel_bake.h b/intern/cycles/kernel/kernel_bake.h
index ddf59f40753..8e7a2c1b62b 100644
--- a/intern/cycles/kernel/kernel_bake.h
+++ b/intern/cycles/kernel/kernel_bake.h
@@ -16,8 +16,6 @@
CCL_NAMESPACE_BEGIN
-#undef USE_BAKE_JITTER
-
#ifndef __NO_BAKING__
ccl_device void compute_light_pass(KernelGlobals *kg, ShaderData *sd, PathRadiance *L, RNG rng,
@@ -180,15 +178,16 @@ ccl_device bool is_aa_pass(ShaderEvalType type)
/* this helps with AA but it's not the real solution as it does not AA the geometry
* but it's better than nothing, thus committed */
-ccl_device_inline float bake_clamp_mirror_repeat(float u)
+ccl_device_inline float bake_clamp_mirror_repeat(float u, float max)
{
/* use mirror repeat (like opengl texture) so that if the barycentric
* coordinate goes past the end of the triangle it is not always clamped
* to the same value, gives ugly patterns */
+ u /= max;
float fu = floorf(u);
u = u - fu;
- return (((int)fu) & 1)? 1.0f - u: u;
+ return ((((int)fu) & 1)? 1.0f - u: u) * max;
}
ccl_device_inline float3 kernel_bake_shader_bsdf(KernelGlobals *kg,
@@ -282,7 +281,6 @@ ccl_device void kernel_bake_evaluate(KernelGlobals *kg, ccl_global uint4 *input,
/* random number generator */
RNG rng = cmj_hash(offset + i, kernel_data.integrator.seed);
-#ifdef USE_BAKE_JITTER
float filter_x, filter_y;
if(sample == 0) {
filter_x = filter_y = 0.5f;
@@ -293,10 +291,9 @@ ccl_device void kernel_bake_evaluate(KernelGlobals *kg, ccl_global uint4 *input,
/* subpixel u/v offset */
if(sample > 0) {
- u = bake_clamp_mirror_repeat(u + dudx*(filter_x - 0.5f) + dudy*(filter_y - 0.5f));
- v = bake_clamp_mirror_repeat(v + dvdx*(filter_x - 0.5f) + dvdy*(filter_y - 0.5f));
+ u = bake_clamp_mirror_repeat(u + dudx*(filter_x - 0.5f) + dudy*(filter_y - 0.5f), 1.0f);
+ v = bake_clamp_mirror_repeat(v + dvdx*(filter_x - 0.5f) + dvdy*(filter_y - 0.5f), 1.0f - u);
}
-#endif
/* triangle */
int shader;