Questions on How to Create 1:1 Replicas of Real-Life Cities and Landscapes

  1. you need to select all the points. This is done by right clicking on one of the points and selecting the proper option

There is even a built in spline generation panel which I have never seen documentation on…

there should also be snap options in the menu.

also make sure that the import script isn’t running on the create event, or the positions would be changed immediately again - you should be using a secondary BP anyway, with references to the spline to update, but just making sure.

  1. like basic trig, the tangent is the point that moves away perpendicular to the point in the circle in question.
    so in the case of the spline it would he the handle that determines how curved a curve is.
    I set all of mines to 0,0,0 with coordinate spaxe Local.
    when importing they usually don’t matter.
    and/or they have to be adjusted.

Again, thank you so much for your help. I was able to get the basic spline points working in the script and they all now snap to the landscape.

I’ve moved on to creating Static Meshes between each vertex point but they didn’t turn out the way I had hoped. Because the points are closely clumped together and because each line crosses another, all I get is a weird combination of meshes in my world. I’ve tried changing the scale but it the Mesh still turns out weird because the lines intersect. Do you have any suggestions on how I should approach this? (I’ve thought about getting rid of every second or third point but I the problem still persists. It gets even worse when I introduce more points).

Spline Vertexes (Only 100 Points):


Weird Mesh Mess:

Current Blueprint:

Original Road Shapefile in QGIS:

I would suggest applying a material to the landacape from the spline, and then positioning properly INSTANCED static mesh components in all areas where it is possible.
Straight roads.

There is ways to apply them with the spline, then convert them, but you’d have to poke around for how to do it.

Flattening and applying a layer of paint to the landscape is usually necessary instead, forr a few reasons.
Chief among them is removing the landscape grass.
even if that may not be your case.

However with the flatten and texture applied, it is much easier to manually place parts in…

I totally agree it’s definitely easier to manually place them in, but unfortunately I have to find a way to automate (somewhat) this process since I’m creating replicas of possibly multiple different cities/landscapes (large ones too). If possible, I would like to cut down on the manual work as much as I can.

For right now, the issue I’m having is that the road meshes overlap one another. I’ve tried doing some research with Blender but I can’t seem to find a solution to delete the vertices that overlap. I would like to import the roads in as splines but the way the vertices connect is simply not going to work for my project.

You had mentioned that I can apply (something?) to a spline and then convert it? Do you mean that I can apply a material to the road and then convert the spline/mesh into a usable format?
Also, please let me know if you know of any solutions that can automate this process. I know TerraForm Pro does this through their plugin but unfortunately their code is not open source and I don’t really know how to go straight from a .shp file to creating splines through code in Unreal

Weird Overlap:

at a glance, your road mesh is wrong.

Orientation is important. And you want the tile to cover a square amount with even subdivision in order to cover the spline.

Try following this in a new spline actor.

You’ll have to learn how to do it, then re-apply it to the other spline. They are 2 different ones used in the 2 tutorials, and i do not believe they are interchangeable.

What I was saying about applying to landscape is this.

Baking the mesh instead…

Setting up the generator system is a painstakingly long process. it literally just took me 3 months to get map data from qgis to ue4 in a 1:1 scale. Don’t give up and keep poking at it dat after day :wink:

I might have found a slightly different solution but I don’t know how far I can stretch it. I edited the material texture and simply rotated everything by 90 degrees. Now, the roads look decent but I’m still having the same issues with the mesh overlap. I’ve tried looking at ways to delete the overlapping faces/edges in Blender but I haven’t found something that works just yet.

I have also watched the video about the blueprints and the spline actors. They seem like great solutions; the only issue is (from my understanding) they only work when manually generating roads. My current project workflow requires me to download the data from OpenStreetMap, isolate the roads in QGIS, and then export the coordinate data back into Unreal. Then, I still have issues with the vertices connecting in the wrong order because I’m trying to automate the process.

Nonetheless, thank you for your help and kind words. I appreciate all of the tips and suggestions you’ve been giving me over the past few days :slight_smile:;base64

Updated Roads Material applied to my Static Mesh (not splines):

Road overlap in Unreal:

Blender View


… so, play with the pixel depth on the material, or distance to nearest surface node?

Cleaning up the data is best, in reality.
But for stuff like T intersections a material trick may just do.

Ok so I managed to somewhat circumvent the problem through Blender. The end product isn’t perfect but it looks much better than before.

For now I’ve moved onto the buildings and I was wondering how I could play with the distancing and visibility. Is there a way to make it so that the buildings fade out/disappear once I move far enough away? This will help to reduce the visual clutter once we’re flying high enough off the ground.

I would also like to apply specific colors to the buildings based on their height and Z-value (0-100 is Yellow, 100-200 Purple, etc). I’m assuming this process is possible through code so I don’t have to do this manually but how do you recommend I approach it? I was thinking about grouping together the buildings by height and then applying a texture to those categories as opposed to checking every individual building for its height. Could I do this through Blueprints or does it have to be C++ code?

I found this thread but it is a little old:…sh-bounds-size

This is what I have so far. I have two StaticMeshActors in the scene but for some reason it only detects one instance (“Building Found” only prints once). It also doesn’t seem to apply the Material. Is it because I’m referencing the mesh in the array as opposed to actually changing the MeshActor? I am using the “Ref” version of GET and not the “Copy” version.


changing a color based on z…
get the world position offset, and use that to determine the color…
Basically if you need the height, the math is.
object bounds, to world, mask Z.

If you want to use the procedural approach you can convert the same logic.

Use a blutility like for the spline import.
the script will get all actors, loop, and SELECT them in editor based on height.
if they are all of the same class, you’ll have the material as one of the “shared” options.
just apply the material.
A solid material is less expensive then the analytical one from above.

Sounds good! I will give it a try.

Do you have any recommendations on how I would approach the fading the buildings out as I get further away from them?

EDIT: I poked around on the forums and found this function called (Set Max Draw Distance) but it doesn’t seem to work properly for some reason.

Fading out and Culling are 2 very different things.
for fading, I. The material get distance between world z and camera z. Based on that apply to a lerp alpha.
Out of which a temporal AA node. Into mask.

Culling out needs to be done by setting a max draw distance.
you can probably select all the buildings and modify that option manually. 10,000 units vertically maybe?

Which node does the masking go into? I’m assuming it goes into Opacity but I’m not sure.

Also, do I need to simulate the world (Press Play) in order for this to work or can I test the fading in the editor?

Should work in editor just fine.
and realistically Opacity Mask because otherwise your material is set to something like transparent which costs a lot more?
you also need to divide that distance node by the amount you need to be a minimum value before the fade.
look into how to do tessellation over distance. Its the same formulae.

Performance wise is the Opacity Mask or Culling more efficient?

I’ve also been experimenting quite a bit with the Python APIs since I finished the manual design portion of the project. I just started scripting various functions of the Editor and I was wondering if it was possible to generate a landscape based on heightmap data through code. I’ve looked at the documentation but I haven’t found anything programatically doing this through python.

Links I’ve been using:…API/index.html (API Documentation)…hon/index.html (Basic info)
Python in Unreal Engine | Inside Unreal - YouTube (Python UE Livestream)

opacity mask Plus culling.
no reason to keep invisible objects in memory…

The python api doesnt have the access I’d like to manipulate the landscape, or read data.

It should be fairly simple to create a script that generates a mesh 10cm above the terrain with the same detail as LOD0, but in practice, it isn’t.
in fact, you would be better off exporting the landscape tile to blender, and manually cutting out what you need after extruding along normals. Its painful still, but a lot easier then what you can do given the current data that Python can provide.

The alternative would be to try it with a bluetility.
In my opinion you do have more data avaliable to you, in both c++ and blueprint.
Not that the manual process wouldn’t still be faster :stuck_out_tongue:

Do you by chance know how to create materials and connect nodes through Python? I’ve got the basics down of generating the Expressions but I don’t know how to connect an expression to the “Customized UV0” Node of a Material

Here is my code so far.

import unreal

asset_tool = unreal.AssetToolsHelpers.get_asset_tools()
new_material = asset_tool.create_asset(asset_name="M_Test", package_path="/Game", asset_class=unreal.Material,
new_material.set_editor_property('num_customized_u_vs', 1)
texture = unreal.load_asset('/Game/Procedural_Ecosystem/Textures/T_cliff_a_n.T_cliff_a_n')
create_expression = unreal.MaterialEditingLibrary.create_material_expression

texture_sample = create_expression(new_material, unreal.MaterialExpressionTextureSample, -800, 0)
texture_sample.texture = texture
print("Property: " + str(texture_sample.get_editor_property('texture')))

scalar_param = create_expression(new_material, unreal.MaterialExpressionScalarParameter, -800, 500)
scalar_param.set_editor_property('parameter_name', 'Zoom Multiplier')
scalar_param.set_editor_property('default_value', 2000.0)
print("Property: " + str(scalar_param.get_editor_property('default_value')))

division = create_expression(new_material, unreal.MaterialExpressionDivide, -500, 400)
texture_coord = create_expression(new_material, unreal.MaterialExpressionTextureCoordinate, -800, 400)

unreal.MaterialEditingLibrary.connect_material_expressions(texture_coord, '', division, 'a')
unreal.MaterialEditingLibrary.connect_material_expressions(scalar_param, '', division, 'b')
unreal.MaterialEditingLibrary.connect_material_property(texture_sample, '', unreal.MaterialProperty.MP_EMISSIVE_COLOR)
unreal.MaterialEditingLibrary.connect_material_property(division, '', unreal.MaterialProperty.MP_CUSTOMIZED_UV_0)

No, but…
the UV is geometry data, so you would have to generate or reference the primitive, then apply the material to its UV.

Realistically, I’m not even sure what you are doing, so take that assertion with a grain of salt.

It seems - so far - that you are generating a meterial?

It’s okay. I found a workaround that pretty much achieves the same thing.

Another thing I would like to do is call a Plugin Function from my executable Python file which sits in “C:/Program Files/Epic Games/UE_4.25/Binaries/Win64”. The plugin is located in “C:/Users/user_name/Unreal Projects/project_name/Plugins”. I’m not quite sure how I would expose a C++ class to Python like this.

How would I reference the classes and modules similar to how I do “import unreal” at the beginning of each file?
Could I just drop the Plugin’s files into the Engine’s “Source” directory and make them callable from unreal?

not sure, not the best thread for that. isn’t there a python section? somewhere/anywhere that your Q is more likely to get visualizations…

Ok I will give it a try. It’s definitely not the right section but I was just wondering if you knew.

I also posted this thread under Blueprint Visual Scripting but I haven’t received any answers yet. Any ideas on how to achieve it?