RE: can i add trees

Heyy,

So I want to add trees to my Cesium Unreal Engine game. It doesn’t have to be very specific. Example: if there is a forest, trees are placed at random locations on the spot of that forest. Or is there data I can use? Let me know if there is a way to do that.

Oke, i have find this turturial: Procedurally Spawning Foliage – Cesium

I don’t understand much of it because I’m new to unreal engine.

Does anyone have an example game or a turturial video?

Let me now!!

@Yorankrol

I am very glad that you found that tutorial - it was exactly what I was going to point you to. Sadly, I am not sure if there is a video version of this tutorial. Is there a specific issue or step that you are struggling with?

-Sam

I have almost no experience with Unreal. So it’s hard to follow. But I’m going to try today!

@Yorankrol

There is also a lot of great YouTube content out there for getting started with the Unreal Engine. Regardless, keep me posted with questions!

-Sam

The tutorial on procedurally generating foliage is majorly outdated, it uses unreal engine 4, and outdated cesium code that doesn’t even work anymore, an update on the tutorial or more info on how to get this working would be greatly appreciated!

Hey @idk_idk,

You’re right that the Procedurally Spawning Foliage tutorial is out of date.

This is a known gap on our side. We track the tutorials that need updating in cesium-unreal#1166, and the procedural foliage one is on that list. I don’t have a firm timeline for it however.

In the meantime, another user worked through the same update recently and got most of it running by swapping in the new method names and adjusting for newer Unreal (for example, the Grid2D Collection emitter setup changed). Their thread is here: Procedural foliage guide outdated?.

I hope this helps at least a little

Thank you for the reply! One question tho, is it even possible to get
procedurally generated foliage all over the world with google
photorealistic tiles?

Hey @idk_idk,

I think it’s possible, it is true that you can spawn dynamic foliage in Unreal and separately that google photorealistic 3D Tiles provide a surface you could use. You’d probably spawn foliage on the tiles around you as they load and clear it again as you move away.

A good question is should you/is it feasible/does it make sense. The main thing to know is why it’s trickier over Google Photorealistic 3D Tiles than over terrain in a way that looks good. The tutorial captures the ground from above (imagery, depth and normals) and classifies foliage by color, green pixels become trees, yellow become grass, then reprojects those points onto the surface. That works well on Cesium World Terrain because it’s basically imagery draped over a smooth heightfield. The tutorial even notes that other tilesets like OSM Buildings in the capture cause bad placement, and suggests restricting the capture to just the terrain.

Google Photorealistic tiles are the opposite of that, since they already have trees and buildings baked into the mesh. The color classifier would fire on vegetation that’s already there, and the top-down depth reprojection gets messy over buildings and overhangs.

So over photorealistic tiles I’d lean away from the imagery-classification part and place foliage more directly: pick where you want it (your own mask or rules), then line trace straight down onto the loaded tile collision to find the surface (the tileset creates physics meshes by default, and the tutorial already does an optional downward raycast for exactly this), or use SampleHeightMostDetailed for the ground height. Spawn as HISM (Hierarchical Instanced Static Mesh) instances around the player and clear them as you move.

I haven’t built this exact setup myself, so treat this as a direction to explore and take it with a grain of salt.

Cheers!

Thanks again, I’m currently working on a freshman high school year long
project, and my idea is to create a cesium world flight simulator using 3D
tiles for the scenery + ue5 because it provides beautiful lighting, should
I just stick with the photogrammetry trees from 3D tiles? I’ve heard that
google is working on making the trees better anyway, I was thinking to just
manually paint over my own tree meshes in airport and big city areas and
leave random suburban areas as they are since you’ll be flying high in the
sky anyway.