Announcement

Collapse
No announcement yet.

Procedural plane - vertex color & foliage painting

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Procedural plane - vertex color & foliage painting

    Hello. I wanted to create a terrain tool that would spawn planes, with some requirements:
    • any size
    • proper UVs
    • constant subdivision for vertex painting
    • works "on the fly" (no need to pick assets manually from the content browser)
    • foliage painting possibility
    • access to geometry parameters (cast shadow, affect distance field lighting etc.)
    So as you can see, just scaling a plane won't work. I achieved the first 4 points, and the 5th to some degree, with two methods (BP, Construction Script).

    The first method is a procedural plane:
    • BP with Procedural Mesh component
    • Create Mesh Section node
    But unless you save the procedural plane as a static mesh to the content browser, you can't paint on it.

    The second method is composing the desired plane from some smaller plane meshes that I created with MAXScript in Max:
    • actor BP (also tried basing this BP on Static Mesh Actor)
    • multiple plane "modules" - Static Mesh assets stored with Soft References in a Map
    • add Static Mesh Component node (in a loop, to cover the desired area).
    This works quite nice. UVs are fine, can paint vertices. I'm willing to accept the slight performance overhead (multiple meshes, redundant vertices where one plane "module" meets the other), and the newer Unreal versions batch the "modules" that are the same size as one draw call. But, no foliage painting. Also there's the problem that those Static Mesh Components aren't accessible directly. They theoretically get attached to the Actor, but they're not visible in the component hierarchy in the Details panel. If it was just one mesh, I could create the component manually in the BP and set its mesh, but with this method my Actor can be potentially composed of multiple meshes, so I can't create those components in advance. I can expose some variables like "Cast Shadow" and pass them to those components in Construction Script, but for some reason this doesn't work for Affects Distance Field Lighting.

    I tried messing with Mobility and even adding an invisible, scaled Plane component to at least enable the Foliage painting possibility, but I couldn't really meet all those requirements at once.

    TL;DR - So if you had time to read everything above, maybe you have some pointers. If you're only reading this TL;DR, then maybe at least you know the answers to those questions:
    1. Can you paint (vertex color, foliage) on procedural meshes, other than converting them to Static Mesh assets?
    2. Can you spawn multiple Static Mesh components that are editable via the World Outliner/Details panel, and paintable (vertex color, foliage)?
    Thank you in advance.

    #2
    1) You can paint within the static mesh, and then all the foliage will utilize that weight paint (commonly done to apply wind for instance).

    2) Not really. but it depends. do you need this at run-time?
    If not, you can manually add the meshes to the scenes at 0,0,0, and create a randomizing bluetility script in the level that loops all actors of class and moves them around within the bounds. The bluetility will actually move the actors after running, so they'll stay properly positioned as you left them...

    Comment

    Working...
    X