❀ DoN's Dynamic Mesh Effects ❀

Released on UE4 Marketplace :slight_smile:

Get it here!
https://www.unrealengine.com/marketplace/don-s-mesh-painting-with-paint-blob-collisions

Handy links:
Knowledge base & Documentation
Video Overview of Sample Project

Feel free to ask any questions, happy to answer any queries you may have :slight_smile:

One question, are the decals painted at runtime being saved? if not, how would you save them permanently?

Should be possible. The plugin supports networking, so all effects can be serialized and relayed again (this is how clients receive updates in multiplayer too).

To achieve this, you’ll need to:

  1. While saving an actor, check if it has any DonMeshPainter component in it
  2. If so, save the variable containing paint strokes along with your other data.
  3. Upon reload, call the On Rep function of that variable to render the strokes.

I’ll add a Save-Load example to the sample project when I get some time so people can use it as reference.

Guessing there may be some small changes needed to the plugin for this too, will keep you posted on this.

Using this opportunity to quickly tag people who’d expressed interest in this plugin earlier!

 @lunyBunny     @Fusion_Pizza     @Wilkes  @One_Mode_Only     @晓晓浣熊     @gozu     @Der.Dominic      @TXL     @ZeothulBrian      @WixZ

Plugin is now released :slight_smile:

hi,
Do you think this works well on VR? Is this something that can be used to create a small VR paint tool app?
ta

It hasn’t been tested on VR, so the following is only a guess:

  • Planar painting (world-space/local-space) should work on pretty much any platform as they very very quick to draw and render, even at higher resolutions.

  • Skeletal-mesh painting is quick to render, but expensive to paint over at higher resolutions. You should be fine at 512x512 or lower, but going any higher in a heavy scene could mean the brief FPS loss incurred at the time of drawing might become perceptible to the player (especially relevant for VR I suppose). Static-meshes / landscapes should be fine regardless of the workflow.

Terminology: “Texture resolution” here refers to resolution of the paint which is mapped onto your mesh (per material), while “Painting over” refers the brief time-period when your player has the paint-brush held down on a mesh (for your paint-app example) or if a projectile hits a surface for splatter effects (one possible gameplay scenario). “Rendering” refers to the constant cost of your visual effect incurred even when no painting activity is going on.

FPS cost: On a GTX 970, character painting simultaneously across 3 textures (1024x1024) textures resulted in FPS drop from 108 FPS (~9.26ms) to around 95 FPS (~10.53ms) *while *the paint brush was held down. Back to 108 after the paint brush was held up. On a heavier scene, the impact could be greater. If you want more stats, the entire overview video (start at 00:56 for character painting) has the FPS/stat counter enabled, so anyone interested in performance can keep an eye on the right-side of the screen.

I don’t have the hardware to test on VR atm or I’d have provided a more conclusive answer :slight_smile:

But in any case, just let me know if you have any more questions!

[HR][/HR]
4.17 ETA

[HR][/HR]
Just a quick heasdup: 4.17 version of the plugin will be submitted in a week.

I’m planning to use this opportunity to make some improvements to the plugin, so if you’re an existing user and have any minor feature/usability requests, this would be a good time to look into those!

@rYuxq - For your question on saving decals, I’m hoping to add out-of-the-box support with this update. It’s already doable for non-skinned meshes, but for characters there is definitely some work that needs to be done to make saving easier. Painting for skinned meshes is always pose dependent so you can’t just load the strokes and replicate them like you would in multiplayer (unless its a character customization screen/etc where the pose used at time of painting is known).

So any questions or requests, let me know!

Hello!

I’m really excited and interested in this plugin, but I have a few questions before purchasing. Sorry if any of these questions are answered on your site’s Knowledge Base.

  1. Is the source available with the plugin when purchased? I’d like the option to extend it if necessary for my projects (I can already think of some new features that I’d like for decal stamping) and to continue using it on future engine versions if you ever stop supporting it.

  2. The mesh painter in your sample video showed the animated character growing larger when you painted it with the lava. Is this the case for all painting or was it special for the lava material? I don’t want my meshes to change shape / volume when painted on.

  1. Will the version of the plugin that is uploaded for UE 4.17 have the save / load features that you mentioned somewhere on these forums? Or a better question might be, can we render / save out the newly painted texture to a .tga file?

  2. Can I choose to only paint on one channel of a texture - like if a texture represented specular, gloss, and emissive masks on different channels?

  3. Is it possible to choose at runtime which texture in a material that I’m painting on? For example, could I be painting on the base texture and then click a UMG widget button and start painting on a specular/gloss/emissive mask texture and switch back and forth as desired by that button at runtime?

  4. Does the mouse have to be locked into the center of the screen for the painting to work or can I do something like the Editor’s Mesh Painter with the mouse that’s free to move independent of the camera?

  5. Are the decals baked into the texture? So if it’s possible to save textures as .tga files, will they have all the paint and decals baked down into the .tga files?

Thank you! <3

Hey, thanks for your interest!

The answer is Yes, you’re covered :), to all your questions, but let me go into more detail for each of them:

Yes, full source is included and extensively documented to make extensions/study as easy as possible.

That’s just the lava material! You have complete control over all your materials and can choose to create any kind of effect you like from the paint channels. I chose Lava with WPO just to emphasize that you have the full power of the material editor available to you while blending in paint.

Yes to both! I’m starting work on this and will be supported for the 4.17 update.

For most people, instead of saving out textures to disk, it will be cheaper to instead serialize the paint strokes and rehydrate the texture back from it on demand. However for skinned meshes this is not an option anyway (unless you can guarantee the same animation pose is used), so I will be supporting both workflows and allowing end users to pick the right one for their usecase.

Yes to both questions! Here’s a KB aricle on Packing RGB channel masks. You can use this technique to pack emissive/roughness/metallic/etc into different channels just as you described. The sample project also shows you how to switch back and forth between a desired channel (or bind each to an input key/etc).

Paint Layers are also supported by the plugin allowing you chain several independent effect textures together in your materials.

You’re free to use your cursor any way you like! Fixed cursor is just how the sample project was written for convenience. You can easily reuse the cursor deprojection logic in the sample project (see U_SimpleHUD) to take your free cursor/paintbrush and generate a Hit from it.

Yes, all effects are baked onto textures in this system. Once the 4.17 version brings saving support, you’ll be able to save the textures just as you describe as well.

You’re welcome :slight_smile: Let me know if you have any further questions, happy to answer!

Thanks for the work!, quite broke atm but will pick it up once i can, and leave a rating on the store (why oh why don’t people do this! lol)

Have a few ideas about making a splatoon like game using this, will be fun!

Cheers!

Great to hear from you @gozu :slight_smile: That’s a neat usecase for this plugin!

Feel free to post any feature wishlists you may have catering to specific usecases. I do plan to add new functionality to this plugin where it makes sense.

Thank you for answering my questions! I most likely plan to pick it up once the 4.17 release is available. :slight_smile:

A couple things that I would love to have:

A function to have the mouse cursor follow along a mesh in 3D space based on the normal of the triangle that it’s currently hovering over like you see with the UE4 mesh painter mode with a default mouse cursor like the one that UE4 mesh painter mode uses but we can change as a parameter (image, size, etc). If the mouse isn’t hovering over a paintable model, it will return to screenspace. If it’s not appropriate to include that logic in a helper function in the plugin, I understand.

Another thing would be an advanced decal stamp mode where you can click once on the model and it stamps the decal but brings up customizable movement (drag the decal along the model’s surface), rotation, and scale gizmos so that users can fine tune that decal on the model.

Also support for undo / redo operations! I didn’t see this in the video or on the Knowledge Base yet, but I’m not done reading it >.>

Thanks!!!

@DanimalsOnParade,
Texture Export question: I will be submitting the 4.17 files soon and had a question on your texture export request. With the save-load feature that is coming, most users will not need to care about exporting textures anyway because the most common usecases for that (save games/networking) will already be handled. So I want to take a step back and ask you what you need the textures for… reason being: PNG export will be the quickest option for me (for this update at least) and as you specifically asked for TGA I’d like to know more about your overall usecase… :slight_smile:

Quick thoughts on your feature ideas:

The sample project already has a 3D decal brush that aligns itself along the normals of the mesh you’re painting (not super-obvious in the video) Figure people should be able to use that as a starting point.

Decal rotation and scale (via brush size) are fully supported as parameters on the Paint nodes, so again I’d rather have end-users pass these parameters to the plugin from their own UI widgets…

This one is interesting. Normally I’d have end-users build this kind of functionality out, but in this specific case I think there is some merit in handling this at the plugin level. For non-skinned meshes, a fully non-destructive , “infinite” history stack can be replayed at will and texture resolutions can be changed/replayed without any loss too. However… for skinned-meshes /characters it’s all going to be pose dependent. If you can guarantee the same pose is active throughout then the non-destructive/infinite undo stack will be available here too. However If the pose changes (and this is definitely true for most dynamic/gameplay situations), then textures will have to be baked for each undo stack, thus putting a strong limit to the number of possible undo/redo actions.

Probably for another update though :slight_smile:

In general UI widgets or interaction will not be a part of this plugin as the usecases are different for different projects - some may need it for gameplay (driven by weapons/collision impacts/etc) while some others may be interested in a paint app like interface (presumably what you’re going for). Where possible the sample project may include useful starting points but probably won’t be adding them to the plugin per se.

Most new features for the plugin will be coming in the core nodes/APIs/render brushes/etc.

The usecase is to be able to upload the flat bitmapped images to a web server database that can be downloaded by other users who aren’t in the same game instance. Essentially people will be sharing some of their creations. Since people aren’t in the same multiplayer game together at the same time, I don’t think UE4 replication would work. I’m not terribly familiar with UE4’s save/load games functionality, but I don’t think that would be appropriate either when I just need the flat image that can be exported and dynamically loaded in at runtime. I may do stuff outside of the game like on a website where I would load up the texture as a PNG to show off.

When I originally wrote that request, I said targa as I was thinking the best format for preserving image quality, but upon further reflection that might not be so great since the network bandwidth would be high for such large images. Some kind of compression will be necessary. PNG might be a really good solution here, especially since it’s lossless. I think PNG is the way to go for a default but hopefully the code is architected in a way that we can take the raw flat image data and send it to our own image compression / saving library. For example, I might try to implement saving out a DDS and compare the size, quality, and performance vs the PNG.

Thanks for making me think more about that. The server bandwidth for TGA would be terrible :slight_smile:

Great! I’ll take a look once 4.17 is live :slight_smile:

I’ll have to play with it. Maybe I can come up with a way to display a 3D gizmo directly from the decal stamped on the model. This might require the functionality from the undo/redo history stack mentioned below so that we can edit a stamped decal once placed already - one decal per layer - and translate, rotate, and scale that whole layer. Or maybe at runtime delete that layer and restamp with the updated orientation and scale depending on the performance of deleting and restamping to make it look like it’s just moving/rescaling in real time.

I definitely think that would be a good idea if you can do it! Looking forward to the plugin version for 4.18! :wink:

That makes sense. Yes, I’m looking for a paint app like interface for character customization type thing with the intent on sharing designs :slight_smile:

Thanks for answering all my questions! I’m looking forward to purchasing the plugin once 4.17 is available! :smiley:

Ah! Now that I understand your usecase better:

1) For sharing creations: You can easily do this with the next update by just storing the save data on your web server (as a binary blob which the plugin will give you) and that can be loaded back by any other user on demand.

Flat images aren’t the ideal way to store this because we need metadata to be stored as well for loading them back. Even better, if your character’s pose is guaranteed to stay the same when your players are customizing (OR if you have a finite/known set of poses) then you don’t need to save any images at all! With this update you can choose to save only paint strokes - logical bits of information that can be replayed back on any other machine non-destructively.

Storing strokes will cost you far less memory than storing images too:
For static meshes this is will be the default save behavior; for skinned meshes the plugin will bake textures by default, but you can tell it not to if your skinned mesh has a static pose (your usecase sounds like a good candidate for this).

[important clarification for you below :)]

2) Export for showing off creations:
The PNG export that is coming with this update will not help you with this!
It will give you a paint mask - an image representation of UV areas that your players painted over with per-channel data/masks. This is only interesting for developers, not for end-users!

For showing off customizations I recommend using any of the in-game screenshot APIs (HighResScreenShot/etc) at pre-determined camera angles. That will probably make more sense to end-users anyway than a painted UV map. Now if you really want to bake your materials as textures, the prescribed technique is to plug Unreal’s “Unwrap UVs for Render” node to the WPO of your target materials and then render that out with a strategically placed scene capture component. You’ll have to manage that on your own though.

I’ll be submitting the update this weekend so any further thoughts you have on this would definitely be useful! :slight_smile:

4.17 Update submitted

New goodies in this upcoming update:

Saving & Loading

  • Easily save all your effects at any time by calling just one node - “Save Mesh Paint As Bytes”
  • Load them back on any machine with the “Load Mesh Paint As Bytes”
  • Fully compatible with your existing save systems

@rYuxq - I’m happy to say that your request of save feature has now been fulfilled :slight_smile:

@DanimalsOnParade - With this update you should be able to store the saved paint on a webserver (as binary data) for your sharing functionality

Exporting Paint Masks as PNG

  • Visualize painted masks or decals projected onto your UV maps
  • Note:- This only contains masks/decals painted by the player. This does not bake the entire material itself.

Misc

  • Fast Path for Static meshes: You can now use the Don Mesh Paint UV0 node for simple Collision-UV based projection (thus avoiding the more expensive seamless workflow)
  • (requires Project->Physics Settings-> Support UV From Hit Results to be enabled)
  • Dedicated Server testing (via Editor) now fixed for the Sample project. You can now turn on the dedicated server checkbox in the editor to test this.

Video overview :slight_smile:

This update will be released on the marketplace after the changes have been processed by the marketplace team.


So, with full Multiplayer support, Save/Load support and a rich set of features for FX and gameplay, this plugin can benefit a great plethora of usecases/projects.

As always, feedback is welcome!

Wow thats great! Now it’s a must buy for me :slight_smile: Really awesome!

^ Thank you :slight_smile: These new features should be available for 4.15 and 4.16 users too, I’ve submitted updates for those as well!

Sorry for the delay in following up.

The saving out the paint strokes as bytes definitely sounds like it will take up less space and network bandwidth. Thank you for your work on the update!

What you’re saying is that it is still possible. I’ll definitely need the capability to bake the material down onto the existing diffuse texture since I’ll most likely be handing off the textures to different 3D applications other than UE4 for other things. WPO here stands for World Position Offset, correct? I don’t mind managing that on my own as long as it is possible. :slight_smile:

There’s an updated sample project for 4.17 somewhere, correct? If so, where would I find it?

Looking forward to 4.17 being approved and on the market to purchase, thanks!

Unreal does has official documentation on this topic (Rendering Mesh,To Textures, Render to Texture Toolset Setup), however the catch here is whether it works in packaged games because they’re baking every possible map (diffuse/normal/etc) using visualization buffers (possibly an editor-only feature, not sure). Now If all you want to do is bake the materials (as seen by the player) onto one-texture-per-material, that should be doable at runtime.

The sample project link on the marketplace page will be updated to the new one as soon the updates go live. I’m guessing they have a long list of updates to process so it could take a while, but hopefully not too long! :slight_smile:

This is all I want to do. Take the newly painted color strokes, decals, and UMG tattoos and bake them down onto the diffuse texture and bake separate roughness, specular, etc masks down onto their existing textures. I don’t want the normal map detail getting baked into the diffuse.

Speaking of normal maps, painting only color onto a mesh won’t overwrite any detail created by a normal map (or any of the other things like specular, roughness, emissive), correct? The normal map will still be fully visible and rendered properly? I ask because it’s hard to tell if your winged character in the YouTube videos has a normal map or not.

Woo, I’m excited! :slight_smile: