How Does CityEngine Generate Vertex Positions from OSM Data?

4445
18
06-28-2013 03:21 PM
MichaelGharbharan
New Contributor
I'm assuming CityEngine is projecting the WGS84 latitude and longitude values from the .osm file to another coordinate system.

Does anyone what coordinate system CityEngine is converting the latitude and longitude to?
Also if you know the math or have the code to perform this transformation, I'd really appreciate you sharing it with me.

Thanks.
Tags (2)
0 Kudos
18 Replies
MichaelGharbharan
New Contributor
Hey,

That worked perfectly. However there are some inconsistencies with the marker production, see image below:

[ATTACH=CONFIG]26631[/ATTACH]

In the areas in the yellow boxes, you can see that the markers are not consistently being generated on the correct side of the road. I am trying to generate markers only for the left side of the road.

Interestingly though, the cars are still orientated correctly in CityEngine.

[ATTACH=CONFIG]26632[/ATTACH]

Do you have any ideas why the markers aren't properly being generated?

Some background: I am using these markers to create traffic AI in Unity and by having "left" markers and "right" markers I am able to direct the direction of traffic flow, however this requires the markers to be consistently generated on the correct side of the road.

Another approach I could take is exporting whatever data the cars are using to properly orientate themselves.

Any help you can offer would be appreciated.

Thank you.
0 Kudos
MichaelGharbharan
New Contributor
I've been investigating this problem and I think I may have stumbled upon a bug (or maybe there's a button I forgot to press)...

[ATTACH=CONFIG]26742[/ATTACH]

The image above shows a shape that is not properly orientated. This shape was generated using the polygon street creation tool. Judging by the misalignment of the lane textures, it is very apparent that the shape is not rotated correctly (or maybe the UVs are flipped...?)

I tried rotating the object manually on the y axis by 180 degrees (to align the textures) but it would not let me, as the image below shows.

[ATTACH=CONFIG]26743[/ATTACH]

However I am able to rotate the two shapes that are adjacent to it. Although I did not expect this to work, I rotated one of the adjacent shapes by a very small amount and it fixed the problem shape (which is what leads me to believe there might be a bug).

[ATTACH=CONFIG]26744[/ATTACH]

EDIT: Looking at the first image of my post above this one, if you follow the lanes in the yellow box to the left it is very apparent that there is an issue with street shape alignment...the scene from this image is from the Modern Streets example.
0 Kudos
MatthiasBuehler1
Frequent Contributor
Hi !


When street segments meet that have different widths, an additional trapezoid shape is inserted to compensate. Those shapes usually create unrealistic models of streets, since lanes would be merging in real world. But the UVs are stretched in that region and the first edge of that geometry is angled, so in CE there's no solution for this issue. The best you can do is avoid streets with different widths.

So that's an unsolved issue in 2012. But we've been working on the street system for 2013. Though I'm not perfectly sure if this specific issue will be adressed.

Ok so far ?

m.
0 Kudos
MichaelGharbharan
New Contributor
Hi,

Okay I see. I suppose my best bet would be to generate markers based on the orientation of the cars.

Does this logic seem about right to you (American roads):

If (car is facing north || car is facing east)
     placeMarker on right
If (car is facing south || car is facing west)
     placeMarker on left

The question now is: how can I determine the direction of a car in the rule file?

Are these fair assumptions to make:
X points North, -X points south
Y points up, -Y points down
Z points East, -Z points west
0 Kudos
MatthiasBuehler1
Frequent Contributor
Hi,

there's a compass in the viewport available. Activate it via d,a ( also check the viewport display settings cogwheel menu )

as far as I remember, in the code, the orientation of the cars are either 0 or 1 ( right or left lane ). But you may want to be more precise, so report the same position as the actual car.

search for i(), where the actual car is inserted on the geometry. the orientation is actually defined by the alignment of the scope to the split street geometry, but you can get the world orientation (cartesian grid) with the convert() function.

Please watch the video here, it'll help to track down where the cars are inserted, using the 'Model Hierarchy' :
http://forums.arcgis.com/threads/44417-CGA-Understanding-the-concept-of-the-scope

Ok ?

Matt
0 Kudos
MichaelGharbharan
New Contributor
Whoa you're the guy from the tutorial videos!

Using the Model Hierarchy was very helpful. Is it possible to for a shape to the the child of another shape?
0 Kudos
MatthiasBuehler1
Frequent Contributor
Hi, yes I am .. 🙂


Can you rephrase this a bit ? 🙂

Is it possible to for a shape to the the child of another shape?


m.
0 Kudos
MichaelGharbharan
New Contributor
Sorry, I meant to ask "Is it possible to force a shape to the the child of another shape?"
Right now when I export my models and open them in Maya or Unity I just get a list of all the shapes in the model. If I check the group shapes button in the exporter then it groups all the shapes for a street segment together (the street shape is the parent).

I am wondering if it is possible to manually specify the parent for a shape, so I can control how shapes are grouped together.

  Thanks.

P.S your a legend
0 Kudos
MatthiasBuehler1
Frequent Contributor
Hi,

No, that is not possible since the 'tree structure' is created based during the model generation.

Mainly, the 'Model Hierarchy' and the material merging settings in the export settings define that behavior. The shape group option basically adds transformation nodes to group the objects accordingly.

Ok ?

M.
0 Kudos