Home Technical Talk

How to bake the difference between 2 meshes?

interpolator
Offline / Send Message
m4dcow interpolator

I've been trying to figure out a way to bake out the difference between 2 meshes but can't really figure it out.
Say I have 2 meshes like the ones below, on is a clean mesh, and the other is damaged or chipped up. I would like to be able to bake the difference between the 2 of these out somehow. My reason for wanting this would be an automated way of creating an alpha for edge decals, but this could also be useful for having a damage mask for substance or just texturing traditionally.

The closest I have gotten is baking out a height map for both meshes in xNormal with the exact same min and max point and then doing a difference in photoshop. This works, but it requires a too much user intervention for my tastes. In xNormal the only way I can seem to get a tonemapped version of the height maps (greyscale) out of xNormal is doing the interactive mode, and even if I could get the tone mapped manual entry working, the min and max distance would be different for different meshes.

I'm working in zBrush and ideally I could somehow mask out this area and apply polypaint which I could bake down later, without messing with multiple meshes and all that other stuff. I don't really know the ins and outs of zBrush, so if anyone knows a way to do this, speak up :)


Replies

  • echofourpapa
    Offline / Send Message
    echofourpapa polycounter lvl 4
    I think you could bake the normals from the chipped to the smooth, then select only the 128,128,255 colored sections.  that sounds like it should work.
     

    Also, if you are working with ZBrush you can generates polygroups from the chips, then generate polypaint from polygroups, then generate texture from polypaint.  Or you can mask just the cracks and generate a texture from the mask.  You can paint a mask by holding crtl and painting on your model.
  • Internet Friend
    Offline / Send Message
    Internet Friend polycounter lvl 9
    I haven't done this but two things come to mind. You can turn on polypaint and RGB for all your tools before you start sculpting which will give you paint you can use for a mask as you work. The second is to store a morph target before you sculpt then use the Create Difference Mesh and bake that. The diff mesh is solid but if you're sculpting inward the normals will be flipped so you could bake through the flat sides.
  • blop
    I would try this in Zbrush with multyMapExporter. There is in this plug-in bottom named "Switch MT" . It switches the mesh stored in morphTarget  before map baking. So you can store there your original mesh and bake the details from the sculpt. I used this technique one year ago so I don't remember exactly the steps, but you should refer to the Zbrush Doc [link here], search for Switch MT.

    http://docs.pixologic.com/user-guide/zbrush-plugins/multi-map-exporter/ 
  • m4dcow
    Offline / Send Message
    m4dcow interpolator
    Thanks for the suggestions guys, I managed to figure it out a different way from your suggestions though.
    @echofourpapa That's what I did before when I was getting those details from a plane, but with an actual mesh and normal being smoothed it doesn't really work very well.

    @internet friend Turning on polypaint for my sculpting brushes was my first thought, but seeing my mask color while sculpting is a bit distracting. I never knew what the difference mesh does, but in my case works just as good as what I came up with, even with fewer steps for cleanup :) It fell short with both additive and subtractive sculpting though.

    @blop Switch MT didn't really do what I was after thanks though.

    The way I ended up doing it, is by dropping down a sub division level on my clean version, and importing my sculpted version on top of it. it asks to re-project higher sub division details and when its done all the areas that haven't changed get masked off. It does leave a few artifacts I assume from dropping down a sub division level, but it was easy to cleanup by growing then sharpening the mask, I then filled the mask with polypaint and was able to bake it.

  • marks
    Offline / Send Message
    marks greentooth
    There is a blend mode in photoshop called "Difference" that will do exactly that for 2 baked textures
  • m4dcow
    Offline / Send Message
    m4dcow interpolator
    @marks I mentioned trying that in the original post, but there is a bunch of user intervention that I would rather avoid.
Sign In or Register to comment.