The linked resource seems to be a bit barren and assumes at least some level of familiarity (and some links are broken in the documentation as well). Would you be able to provide something showing how to get skeletal mesh painting functional, from start to finish? A video would be absolutely amazing, but I’ll take what I can get.
An example of what’s throwing me for a loop is the material function on the quick start page (there is no information on it or what it is doing), and the assumed knowledge on lightmaps. While I do understand that spoonfeeding information in regards to the basics of UE4 is outside the bounds of what a reasonable person could expect from you, I do hope that’s not how this request is coming across. I’m a visual person, and seeing something done in 30 seconds will do more for me than 600 pages of documentation. I’m certainly not expecting a detailed rundown on what lightmaps are, how to create them, etc. Skip that part if you’d like. I’m just asking for a guide on preparing a skeletal mesh from start to finish, and hopefully some explanation on what your MF is doing on the quickstart page.
Basically, something showing what work was/is required to have functional mesh painting for a skeletal mesh, on a fresh new project. I’d greatly appreciate anything that could clear it up a bit.
All-in-all, the plugin seems amazing and I’m looking forward to the prospect of integrating it in my game. I can tell you’ve put countless hours of hard work into the product, and see a tremendous amount of advanced functionality when checking out your demo videos. Kudos to you and your team, the product is very impressive!
The main setup occurs in your 3D modeling app rather than Unreal. Here are the steps briefly:
Inside your 3D modeling app:
In your 3D modeling app, unwrap your character mesh’s UVs as per usual. The result is (usually) stored in the “UV0” channel.
Now create a new UV channel (typically UV1) for your character mesh. This is what the plugin will use for skeletal mesh painting.
Here’s the important bit:
Unwrap the character in UV1 channel, just like you did in Step 1, but make sure that no overlapping UVs are present this time. Typically symmetric parts of the body are overlapped into a single UV to save texture memory. We do not want that here, we want every face on the mesh to be unwrapped uniquely. The number of UV islands does not matter (so it can be one large block or many smaller ones), each vertex just needs to be uniquely represented on the UV map.
Step 3 is the general process for how Lightmap UVs (wiki article)](Lightmap - Wikipedia) are typically made, although the PaintMap would probably be a better name for the plugin’s sake as it is much easier to make these paintmaps as they aren’t fussy about the uv layout unlike lightmaps.
Inside Unreal Engine:
4) Inside your material, add the node “Don Mesh Paint UV1” (documentation for this material node is on this page). The main thing you need to know is that these nodes are the mechanism through which you acquire whatever paint data that you have painted on your character. Connect/utilize the alpha / rgb of this node to your material as desired.
If your character doesn’t already have a physics asset, create one for it. Your painting accuracy will depend entirely on this, so make sure that collision bodies in PhAT closely match the character. You can open the sample project’s demo character physics asset to see its setup.
That should be it, you’ll be able to use the Paint Stroke node at this point on your character.
~
I don’t have the bandwidth for a video tutorial atm (I don’t have a team btw, I’m working solo :)) so I’m afraid it will have to be text for now.
Just let me know if you require further clarifications and I’ll do my best to clarify
~ Multi Layer Paint Collision ~ - To support my game’s requirement of players building silk nests with different types of silk (see video!), paint collision (and importantly, duplicate paint stroke detection) are now aware of paint layers!
~ Major bugfixes across the board ~ - From static mesh seamless painting to Planar uvw validation logic to correct Bounds calculation for primitives located far away from their parent actor, this update brings various crucial bugfixes and covers many edge-cases.
This update has been submitted to the marketplace along with my other plugins and should be available soonish
can i use this in conjunction with a multi line trace to put a “hole” (or see-through point) through the players skeletal mesh, and whatever mesh’s i have attached to the body?
Edit: 1: (IN BLUEPRINT)
Edit 2: i usually do C++ after but for prototyping i prefer blueprint if possible
[USER=“132493”]Major Mints[/USER] - The current design stores world-space locations for brush strokes which limits the collision API’s usability to static things.
It shouldn’t be *that *hard to redesign it around local space positions (in which case your usecase would be possible along with things like Shields that can be punctured and admit arrows through holes in the shield, etc), but my focus is currently elsewhere so I probably won’t be looking into it any time soon.
If you’re comfortable with C++ and/or diving into a code base, you might be able to rewire the code (via simple things like inverse transform position to convert Hit location to local space, etc) and get this to work. I’ve documented the code very liberally so it should be much easier than diving into the engine code for example.
For the next update I have a pending request of “Infinite Damage Textures” which will take precedence; that one should have made it into this build but couldn’t due to the 4.20 migration effort taking longer than I expected
I am using this plugin to place bullet hole decals on a skeletal mesh. It is working, but the problem is that the decal size seems to be changing all the time. I have a value of 1 set on my paint stroke node. My UV islands on that second UV set are proportional, so I think it is not a problem with that. I can shoot the same area multiple times and the bullet hole decal is sometimes very tiny or sometimes enormous, like a grain of rice or a manhole cover. I would say 80% of the time it’s roughly the right size, but it is almost never the same. Any ideas for what might be causing this problem?
I’m a couple weeks late, but thanks for the in-depth reply to my question! And yes I was referring to Looman’s article, I’m glad we’re on the same page with our concerns, that’s what I was most curious about.
The quickest way to debug this is to look at the render target which is generated (you’ll find it on your character’s material(s) in the outliner) and see how they line up with your UVs. Might not be a bad idea to even export that render target out as a jpg into a 3D application and see how the texture is being applied to your UVs. You can do this inside Unreal as well (with a dummy material that just outputs the Don UV1 node), but in your 3D app you’ll have the advantage of seeing exactly how the vertices line up with the texture.
This will tell you whether your UVs islands are correctly sized relative to each other; **decal projection is not seamless **(for mesh-space painting) so if you’re seeing different decal sizes being rendered for the same input brush size it usually means some UV islands have been unwrapped larger in size compared to the surface area their faces actually occupy.
I recommend using the **seamless workflow **for such a tiny hole (i.e. don’t use decals, leave the Decal parameter empty) as that will guarantee consistency of hole size regardless of UV setup .
Thanks for the reply, I just tried this, and the hole sizes are still a little bit different in some places. There are also places all over the model where the effect doesn’t happen at all. I wonder though, is this problem possibly related to the physics asset? Also, I tried using a value of less than 1 for the brush size, like .85, and didn’t see any holes at all. Is it possible to do this?
edit: i went back and looked through the thread and it does seem that maybe i need a more accurate physics asset for a small brush such as this. not sure if it explains the differing brush sizes though.
edit 2: i remade the physics asset to be much tighter and it does seem to be helping a lot. It’s working well enough that I don’t feel the need to make it any better for now i think!
Glad to hear! Yes accuracy of the physics asset plays a big role as the hit location needs to be as close to the material’s pixels as possible.
Resolution of the positions texture is another factor By default its hardcoded to 512x512 for optimum performance. Increasing that should help further, but I’d only recommend that for a dedicated scenario like a painting app or a character customization screen where you’re dealing with only one or few subjects.
1.) I’m not sure I understand: “the resolution of the positions texture” in your last reply, I’m curious what you mean by that?
2.) Also, i still see some seams between the UV islands as i paint on the mesh. Is there any way to avoid that? Thanks!
3.) I am trying to paint on a skeletal mesh that is a child component (a piece of clothing, attached to the main character using the “Set Master Pose Component” node) but it’s not working. It works on the main body mesh, but not on his additional pieces. Any idea why?
4.) As I paint strokes on a character mesh, for a single frame, I see the morph targets resetting. Is there any way to avoid this?
For both questions - The quality of your seamless painting can be improved by increasing the resolution of the “positions texture” - this is a special look up texture which the plugin generates by baking the local space positions of your character’s pixels.
Currently the resolution of this look up texture is hardcoded to 512x512 inside DonMeshPainterGlobalActor.h (search for DefaultPositionsTextureSizeX and DefaultPositionsTextureSizeY).
Try increasing this to 1024x1024 and recompile the code although keep in mind that this will have some impact on performance - but mainly for decal projection seamless painting should be mostly unaffected as that’s done completely on the GPU.
Before you do this, first try increasing the size of your UV islands for important areas. For seamless painting your UVs do not need to be uniformly sized (unlike for decals) so if some UV islands are really small then the corresponding resolution those pixels acquire in the baked position texture will also be lower and hence the accuracy.
Does the cloth have a physics asset to go with it? The hitresult’s location needs to roughly approximate the cloth’s pixels for this to work. Obviously a primitive collision shape can never approximate the rich contortions of cloth, but you need some kind of collision to occur for the paint to be projected. Cloth support was recently added in 4.19 and should work as long as your cloth mesh has a collision body.
This is an engine bug that was reported to Epic a while ago. You can track the progress of that bug here: UE-54099. Do add vote your vote on that JIRA to show your interest!
Which Don Material node is that using? Would be interesting to see a skeletal mesh usecase ("Don Mesh Paint UV1" node) as that’s relatively more performance intensive (especially when decal textures are involved).
But anyway, thank you so much for getting back on this!
It is not a cloth asset, just a skeletal mesh. It’s a pair of shorts in this case. I think trace responses to child components does not work in unreal yet, so as a workaround, i broke the hit result and re-made it but I forced the clothing component into hit result and it worked like a charm.
And to your latest question to the rennsix about using the plug in on skeletal meshes in vr, I tried it for the bullet holes. It looks great, but unfortunately the performance hit was too great. Every time it painted a bullet hole it would hitch the performance for a split second. It was very quick but for rapid fire it definitely makes it unplayable. If we could overcome that little performance hit, there are great things that can be done.
Also, with regards to a question I asked a while ago, I am still curious about something: I tried painting using a decal as my brush and it seems to work correctly most of the time, but the size changes sometimes. I tried it on several different skeletal meshes with clean, well proportioned UV maps, and it still would paint the decal at seemingly random sizes. Wonder if there’s any way around this?
We have hit a problem that we can’t find any solution to. When we package a dedicated server the Materials no longer passes DoNs test for a valid material. Painting on the server only gives warnings about missing support for DoN. The packaging for dedicated server has stripped out all DoN functionality.
Running an editor-dedicated server works fine so this comes as a surprice now that we start packaging the game.
Hey, can you share the server logs with the warnings about missing support?
That will be helpful for deducing what is going on.
~
Glad to hear the skeletal mesh/cloth is working now!
VR performance - are you using decals? That’s the most expensive flow. If you’re not using decals, then lowering the values of DefaultPositionsTextureSizeX/SizeY in DonMeshPainterGlobalActor.h may help. For rapid-fire maybe you could throttle the impact holes so not every bullet is painted is every tick? Aggregating holes with some custom logic is also an option although that kind of stuff always needs a lot of tweaking to get visually acceptable results. Apart from those - if the pose of the skeletal mesh is known / mostly unvarying (eg: being struck by a bullet always puts the target into a particular animation pose) then it may be possible to cache that animation pose beforehand which would virtually eliminate any performance cost (this would be some custom coding as such a feature is not part of the plugin yet). Final option I can think of is to add support in the plugin for bone-space transformation based skeletal painting (which someone asked about earlier in this thread); less accurate but far more performant.
For the decal brush size - Do you have pics of the varying decal brush sizes and maybe the corresponding UV map?
~
Thank you for sharing that! Can’t wait for the chalk work