2
$\begingroup$

I have some mesh that is intersecting with itself in some areas. To reduce the visibility of these intersections, I want to somehow blur, blend, flatten, or otherwise smooth out the area. This will probably need to be done in the compositor. enter image description here The picture shows a basic setup of two mesh pieces intersecting. The material is simple diffuse mixed with gloss based on fresnel. They have slight color variation due to the highlights and fresnel. You can see that in areas where one overlaps the other (yellow) the edge of the foreground piece is dark due to the fresnel, and stands out. I want to keep this.

In the red area, the meshes are intersecting but not near the edges. There is just enough color difference due to their shading for the intersection to be noticed (whereas a flat shaded material it wouldn't be.) I want to somehow change that area so that the intersection is less visible, but without losing detail in other areas, or losing the edge detail in the yellow area.

The bottom half of the image shows what I'm going for (done in photoshop with water droplet tool.)

EDIT: I am happy to use methods outside the compositor, such as mesh changes, etc, or even workflows that involve other programs. I just need to be able to automate it, and avoid having to hand paint/mask/edit things too much. I need a method that will work on a lot of pieces. They are animated in a simulation, so what areas are intersecting will change every frame.

$\endgroup$
  • $\begingroup$ Hi, you can create mask in VSE which can be animated and support feather. Use this mask for blur selected area only in compositor. To be honest: I never use it and know this only from some tutorials, so I can't write you how exactly do this. Second way can be manipulate with meshes using boolean modifier - union as first. After you may need use subdivide and/or smooth or remesh for achieve nice results. Just my ideas I don't try it:) $\endgroup$ – Shubol3D Sep 22 '16 at 11:40
  • $\begingroup$ You could use an AO pass to mask intersections, and then blur/soften/whatever based on that. $\endgroup$ – JakeD Sep 29 '16 at 18:03
2
+25
$\begingroup$

I guess the following can be adjusted to your needs.

Two mesh objects, partly overlapping will be mirrored at intersections, RGB independant.

enter image description here

Compositing nodes create a mask of the intersections. (This part is highlighted in red.)

Enable the Z and Object Index Pass of the render layer. (Properties Window > Scene > Passes)

Assign two different pass indices to the objects, in my case 1 and 2. (Properties Window > Object > Relations > Pass Index)

After dilating the objects masks, their overlapping part will the border between them. Multiply both masks to only retain the boundaries. If both parts are in the same mesh, you can get this mask with the Material Boundary of Freestyle (which will have correct anti-aliasing).

To exclude the parts, where the meshes overlap but are apart, check differences in the depth channel. The Prewitt or Sobel filter will give us the difference between close pixels. Where this z - difference is larger than a certain value (0.05 in my case) there is space between the objects (which we dont want to blur). Multiply the "edge" mask with Z-Difference lesser than the min value (0.05) to get the intersections.

get intersections node setup

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.