[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56421] trunk/blender/source/blender/ editors/sculpt_paint/paint_image_proj.c: Fix: texture alpha masking not functional after recent commits.

Brecht Van Lommel brechtvanlommel at pandora.be
Wed May 1 05:30:14 CEST 2013


Ah, sorry about that, that clarifies some things. I tweaked the code a
bit further, moving the texture sampling after the masking check which
should be faster, and made the textures work with the
clone/smear/soften tools again.

If you can get texture masks to work for 2D paint that would be great,
I imagine things are a bit more complicated with the falloff separate
from the texture, with an extra buffer for IMB_rectblend.

For after the release, this also made me wonder if we can get masking
working for the viewplane and random mapping modes. Textures mapped
that way would need to be part of the mask, but it makes sense for
these mapping modes as they basically define a custom brush shape
rather than a pattern mapped to the mesh. Then we can have the masking
work regardless of the texture, and perhaps add an option to
enabled/disable it.

Brecht.

On Tue, Apr 30, 2013 at 10:57 PM, Antony Riakiotakis <kalast at gmail.com> wrote:
> Revision: 56421
>           http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56421
> Author:   psy-fi
> Date:     2013-04-30 20:57:45 +0000 (Tue, 30 Apr 2013)
> Log Message:
> -----------
> Fix: texture alpha masking not functional after recent commits. Mask is
> used to see if area has been covered by brush, so exclude the texture
> alpha and texture alpha masks from mask comparisons. Coming next:
> texture masks for 2d painting.
>
> Modified Paths:
> --------------
>     trunk/blender/source/blender/editors/sculpt_paint/paint_image_proj.c
>
> Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_image_proj.c
> ===================================================================
> --- trunk/blender/source/blender/editors/sculpt_paint/paint_image_proj.c        2013-04-30 18:57:04 UTC (rev 56420)
> +++ trunk/blender/source/blender/editors/sculpt_paint/paint_image_proj.c        2013-04-30 20:57:45 UTC (rev 56421)
> @@ -3833,6 +3833,7 @@
>                                         if (falloff > 0.0f) {
>                                                 float texrgb[3];
>                                                 float mask = falloff;
> +                                               float mixalpha = 1.0;
>
>                                                 if (ps->is_texbrush) {
>                                                         MTex *mtex = &brush->mtex;
> @@ -3852,11 +3853,11 @@
>                                                         BKE_brush_sample_tex_3D(ps->scene, brush, samplecos, texrgba, thread_index, pool);
>
>                                                         copy_v3_v3(texrgb, texrgba);
> -                                                       mask *= texrgba[3];
> +                                                       mixalpha *= texrgba[3];
>                                                 }
>
>                                                 if (ps->is_maskbrush) {
> -                                                       mask *= BKE_brush_sample_masktex(ps->scene, ps->brush, projPixel->projCoSS, thread_index, pool);
> +                                                       mixalpha *= BKE_brush_sample_masktex(ps->scene, ps->brush, projPixel->projCoSS, thread_index, pool);
>                                                 }
>
>                                                 CLAMP(mask, 0.0f, 1.0f);
> @@ -3924,8 +3925,8 @@
>                                                                         else do_projectpaint_soften(ps, projPixel, mask, softenArena, &softenPixels);
>                                                                         break;
>                                                                 default:
> -                                                                       if (is_floatbuf) do_projectpaint_draw_f(ps, projPixel, texrgb, mask);
> -                                                                       else do_projectpaint_draw(ps, projPixel, texrgb, mask);
> +                                                                       if (is_floatbuf) do_projectpaint_draw_f(ps, projPixel, texrgb, mask*mixalpha);
> +                                                                       else do_projectpaint_draw(ps, projPixel, texrgb, mask*mixalpha);
>                                                                         break;
>                                                         }
>                                                 }
>
> _______________________________________________
> Bf-blender-cvs mailing list
> Bf-blender-cvs at blender.org
> http://lists.blender.org/mailman/listinfo/bf-blender-cvs


More information about the Bf-committers mailing list