❀ DoN's Dynamic Mesh Effects ❀

@cpenny20

  1. **Painting multiple components
    I’**d like to address this one first as it is far more doable.

You’ll need to perform a manual Overlap query at the site of your hit location and collect the components of interest within a suitable radius.

You can then pass each component in turn to the paint stroke node. Seam / overlap issues may occur depending on the size of the paint stroke and overall effect on both components.

  1. Cloth & Paint
    It sounds like you have applied the mesh paint nodes on the Cloth materials rather than the underlying mesh, correct? Painting on cloth is not supported if you cannot provide a matching phyx collision representation that moves along with the cloth. I have not worked with cloth assets much myself, but I can explain what you are seeing.

The behaviors you described are expected as there is no way to reconcile the fluctuating pixel positions of the swaying cloth asset from the actual hit location.

The plugin determines whether to paint a pixel (i.e. UV location) by comparing the positions of the pixel being sampled with the hit location using brush size (distance) as tolerance. This means there is a “minimum viable brush size” for any mesh compnent whose physx representation deviates from its visual (pixel) representation. This explains why you are able to paint after increasing the brush size.

As increasing the brush size will not be feasible in many cases here are some alternative ideas:
a) Sync the meshes prior to each paint - This is probably more feasible for customization screens rather than for fast gameplay scenarios, but if you manage to sync the cloth asset to the mesh (i.e. the “rest pose” of the cloth without any forces acting on it) then painting will be consistent for that stroke (deviation of cloth pixels from mesh surface still need to be accounted for via added brush size) and once painted the effect will stick onto the cloth without any issues in subsequent animation. Obviously not sure how easily you could achieve this for a gameplay scenario.

b) Matching UV Layouts for Cloth and Underlying mesh - This requires a new feature to be implemented to work, but the idea is that if you can create the UV layout for your cloth that matches the underlying mesh (i.e. vertices that occupy the same surface also occupy the same UV locations), then it may be possible to target only the underlying mesh for painting (with the assumption that physx will match reasonably well) but then pipe the paint node of the body mesh to the cloth mesh. As the UVs match (as described earlier) the cloth can receive the alpha mask of the body and use it for any custom effects. Of course if the cloth is swaying very wildly then there will be a slight mismatch, but I think this shouldn’t be an issue given the speed with which cloth assets usually undulate.

The piping feature I alluded to above (sharing the mask of another material) is not currently available so that would need to be built out as well for this to work.

~

Hope this helps!

  • Venu