dynamically displaying buildings

5177
15
11-05-2014 06:33 AM
AlexandruVasile
New Contributor II

Hi,

I am working on an entire city (lots of buildings, streets, DEM, parks etc.) with quite a bit of detail.

So obviously my computer starts failing when I apply the rules to more than a few 'Lots'.

Getting more RAM is not really a solution (considering the size of the city).

So I was wondering if there is a way of dynamically displaying the objects.

At the moment I have defined 2 LODs in my rule. It would be perfect if the LOD

would dynamically change depending on the zoom (how close to the building)

and also on the perspective (which buildings I see right now).

So I only give detail to what I see and when I am close to it.

Thanks.

0 Kudos
15 Replies
MatthiasBuehler
Occasional Contributor III

Hey Alexandru,

The above inputs should help you code it.

Note:

You'll also need to write some sort of timer that runs all the time unless you want to trigger the update manually each time. Which may slow down the whole thing quite a bit, if you're constantly rebuilding all models.

In general, especially when coding, I never display all models at the same time. But it depends on a use case. Remember, CityEngine is a modeling tool and not a visualization environment..

Regarding visualizing the whole Paris model fully generated: That does not really generate many polygons (in the default state, there, only a few buildings have the high LOD set), thus a good graphics card can display it quite easily. And the fluidity of the viewport is independent of the system RAM. If you have lots of textures, VRAM may have a bit of an impact, but mostly, it's the amount of polygons and especially shadows/ambient occlusion.

Ok ?

Matthias Buehler

Head of 3D Technologies

twitter: @MattB3D

-----------------------------------

Garsdale Design Limited

matthias.buehler@garsdaledesign.co.uk

www.garsdaledesign.co.uk

0 Kudos
AlexandruVasile
New Contributor II

Thank you all for the help.

I'll come back when I have something to show.

Regarding the fact that CE is not a visualisation environment: I agree; but what do you recommend I use to visualize my huge modelled city; and also, how should I do that? For example if I want to load it to Unity, I still have to generate the whole city in CE in the first place in order to export it, right? Which, as I said, is too big and my computer can't handle it.

Looking forward to your answers, maybe I won't need to write python after all:)

0 Kudos
MatthiasBuehler
Occasional Contributor III

Hi,

First of all, to export models, you don't need to generate them.

e.g. just select a shape and go to the exporter. The model does not need to exist in the viewport. CityEngine regenerates the model anyway new in the background for export. You're rather clogging export resources resources when having all displayed. For exports of big datasets, set Java memory (ini file) to about 50% system memory and run ONLY CityEngine. Close all other apps that may interfere with the process. After export, set the value back to something reasonble. [Or just leave CE closed.]

Then it depends on the target application. I also wanted to write about dealing with this instead e.g. in Unity as an example in my last post, but left it out.

I sadly never had time to solve this myself, but game engines provide solutions or plugins for this that just dynamically load models based on the player proximity to a specific model. e.g. if a model's bounding box is visible, load the model.. As said, I don't know the details.

This then leads to the question of file granularity, where I'd say it's best to export 1 file per shape, which then can be loaded by the target app, e.g. Unity. I also assume that you may need to export at least 2 files for each shape: 1 with just the bounding box to check, which files should be loaded, and then 1 file for each LOD that gets triggered again based on proximity.

I'd be really interested in seeing a solution for this. We can collaborate on this, if you like. 😉

About 2 years ago, I searched a bit and found a plugin ( never tested it ) that does 'asset streaming' (harddrive or cloud), which would be exactly what you need.

Cheers !

Matthias Buehler

Head of 3D Technologies

twitter: @MattB3D

-------------------------------

Garsdale Design Limited

matthias.buehler@garsdaledesign.co.uk

www.garsdaledesign.co.uk

0 Kudos
AlexandruVasile
New Contributor II

So I tried to lead my scene to Unity.

I tried the script from here:

http://3decide.com/break-a-leg/ce-to-unity-tutorial

but it didn't work (just kept searching for the terrain). So I just exported my scene as .fbx.Than uploaded it to Unity.

The problem is that it only exports the models which have already been generated. So I have to generate them before I export it to Unity, which kind of defeats the purpose.

So I thought of importing .fbx in batches into a Unity project. The issue here is that the spatial reference is lost; the houses imported the second time ended up in the air somewhere.

I am simply documenting my experiences as I go along. So if someone has any suggestionsUnity.jpg I am all ears

0 Kudos
MatthiasBuehler
Occasional Contributor III

Hey ..

I helped them create this tutorial..

Maybe drop them a mail and check if something has changed for your current CE version .. Ok ?

Matt

Matthias Buehler

Head of 3D Technologies

twitter: @MattB3D

----------------------------------

Garsdale Design Limited

matthias.buehler@garsdaledesign.co.uk

www.garsdaledesign.co.uk

0 Kudos
AlexandruVasile
New Contributor II

sure,

the only email I could find was the info@3decide.com

Ill use that.

Alex

P.S. as far as i understand, this script helps with the terrain file, making it easier for Unity. But I still have to generate the model

0 Kudos