Hello i made this work on recent Processing 4:
But rendering the city in full style (press “T” while running the code) takes about a minute.
it takes a red and green picture of 120 pixels width and 80 pixels height and turns every pixel, that has some value in the red color-channel and 0 in the green color channel, into a city-block, that is surrounded by streets and contains about 10 buildings and a fitting number of small city-detail-objects.
That makes a lot of models to render.
How can i improve the performance-speed, even if looking at the whole city from high above, what really needs to render all models, because they are all in the field of view?
here is a screenshot of such a view:
You would improve it by re-writing it from scratch. Is that something you are prepared to do?
He has a very impressive amount of customization throughout his buildings, but that comes at a huge cost since he essentially recreates the geometry for every unique visible building every frame. The most obvious optimization would be to wrap all of the generating code into PShapes. At least each building should be its own PShape, but better would be for each block or NxN blocks to be in a single PShape that gets generated once and stored. The building name signs could all be packed into a single texture image with either one per block cluster or possible one big one for the entire city. I don’t know what limits Processing or your graphics card might have on the number or size of PShapes is.
As he said his brother said in the video, if you want this to run well, you’d write it in Unreal Engine which is designed to handle massive amounts of geometry and provides level-of-detail and view frustum culling along with shadows and volumetric lighting and so on.
I noticed, that in the setup function are three pairs of for-loops with exactly the same instructions in their round brackets.
If i merge them into one, i get this error, even if i merge only two of them (I placed comments, that tells this in the two spots between them):
Caused by: java.lang.AssertionError