BP Generated Environments - How doable is it for full production?

I am wondering about how doable it is to use generated environment art in production. Can anyone advice?

I managed to produce BPs that scatter rocks around, and build towers for me. If this were to work properly it would be insanely powerful.

  1. If I were to build a large and complex level/game, and I’d make extensive use of Blueprints to randomly scatter objects around and build my hallways for me, would that have a negative impact on something?
    Performance wise (hundreds if not thousands of blueprints in a level for example), overhead cost from the Blueprints, lighting, etc?

  2. Also I hit lighting problems. Playing the level results in all generated meshes looking black. I assume because it regenerates it upon game start thus no more precomputed lightmaps. That would be a major blocker to setting up some kind of procedural workflow. Is there any way you can tell BP to generate just once, in the editor, and bake it all into the level? So it retains lighting etc.

You can always use only dynamic lighting. That would be the solution for the second problem at least.

This is very much the workflow we had in mind.

  1. The main thing to avoid is using a Tick event for BPs you want lots of. A BP should actually be more efficient than placing the objects separately because there is a single Actor with lots of Components. You can also take advantage of things like the InstancedStaticMeshComponent to draw all instances of a mesh inside a BP using a single draw call.

  2. In the defaults for that component, did you change the ModifyFrequency setting to ‘MF_Static’? That allows it to support precomputed lighting.

I like the idea that in the future we build levels out of ‘fewer, smarter’ Actors, so iterating on the level becomes less painful and our levels are better :slight_smile:

Awesome! That is like Houdini meets Unreal :slight_smile:

  1. Having it all rendered as one batch sounds extremely good. I will definitely give that a go.

  2. Yes I did that, and the meshes rebuild with lightmaps in the editor, but once I play it is all black. I believe it is re-initializing the BP at the start of the game? Maybe it is my older build?
    Speaking of which, while setting up the lightmaps I hit a problem that I didn’t mention in my opening post. At the end of my BP that scatters rocks I got a Set Relative Rotation, connected to it is a random value to randomize the rotation. Doing this prevents my BP from being lightmapped, for reasons I do not understand. If I remove the Make Rot and FRand Range, and just have Set Relative Rotation it lightmaps just fine.
    Set World Location does work correctly, and retains lightmaps, while that appears to do the same thing (transform a mesh after spawning)?

Ah - lightmaps are only preserved if the meshes don’t change location, which hopefully makes sense. So what you need to do is make sure that random behaviors don’t change each time the CS runs. Luckily this is easy with a RandomStream! Add one to your Blueprint and then use RandomFloatInRangeFromStream instead of RandomFloatInRange. If you expose the RandomStream for editing, you can adjust the ‘seed’ to get different layouts, but it will always give you the same sequence of random numbers, so once you get a layout you like, it will stay that way. Does that make sense?

Ah yes, absolutely. I should have figured that out by my own. I actually used a RandomStream for the position already so I know how it works. Thanks man!

Bump, I just returned to setting this up and I hit one issue with the InstancedStaticmeshComponents. I can’t get those to show up at all. Even if I just make a new BP - new component - InstancedStaticmesh → nothing at all shows up.
I’d love to be able to make use of instanced meshes to lower my drawcalls. Is there something specific one must do to get InstancedStaticmeshComponents to work?
I tried changing the cull distance property but did not help. I can’t see any other relevant properties. I am trying this with very basic meshes and the standard default material.

As far as I know instancing doesn’t work for static meshes (and any other for that matter), Only foliage is instanced.

Just adding an ISMC won’t show anything, you need to then call Add Instance (I think that is the right function) to start adding instances. Sorry if that is confusing, we have a demolet coming soon that gives an example of this!

Awesome, I got it working!

Two additional things though, there is no collision on instanced meshes, so what I did now is Get bounds → Add box component → Set box extend using the bounds of the component/instance → I now have a collision box surrounding each instance.
Not sure if this is the correct way to go though? Performance wise? What is the intended way of doing this?
And it is not very accurate either, so what would happen if would take a low poly collision mesh, add that as a staticmeshcomponent on top of each instance, set it to invisible/no shadows and using the same scale and rotation? So I have an invisible per poly collision mesh on top. Heavy?

And I cannot get static lighting to work anymore on instanced meshes. It is frequency static. I made a StaticmeshComponent BP next to this one as comparison and that one lightmaps correctly. Limitation? Foliage, in UE3 at least, did lightmap though?

Ah, that is a bug! We need to fix that. Creative solution for the time being though :slight_smile: Multiple components for collision should actually be fine, no render overhead.

Ah cool!

And the non baked lighting? Also a bug? As that is more critical, collision I can work around for now. I am about to build something proper with this, so I want to know for sure that all of it will work before I build it all.

I so far got a BP working that supports random scattering, line placement, the combination of random scattering + line placement, random meshes, and all seeded and fully configurable via its properties once placed. Great to work with!

We don’t support lightmapping on instanced static meshes right now. I’ve added TTP 302372 to implement it.

I’ll have to defer to one of our rendering guys for the static lighting question.

Glad it is working for you! Did you try the ‘3D Widget’ option? It’s available on vector properties that are exposed, and puts a little blue diamond in the world that you can click and and move around. This sets the value of that vector property (in local actor space). This can be really nice for setting up parameters of procedural content (eg end points of a fence, foliage height etc)