hlrs-vis / covise

Collaborative Visualization and Simulation Environment, OpenCOVER and OddLOT
http://www.hlrs.de/covise/
187 stars 87 forks source link

ODDLot import or load a heightmap #90

Closed TurnipMania closed 1 year ago

TurnipMania commented 1 year ago

@aumuell I may be missing something here. There appears to be a Wizard that can set the elevation values based on a height map. I cannot find a way to import or reference a heightmap in ODDlot. Looking at the tree view there Aerial and heightmap in the scenery system. The Load map option will only load an Aerial map for the background. Without this feature Oddlot lacks the ability to create a georeferenced road.

There is no documentation on the Wizards

aumuell commented 1 year ago

Sorry, I'm not the OddLOT guy, tagging @uwewoessner and @hpcfloh as they should know more

uwewoessner commented 1 year ago

ODDLot supports two methods of mapping the height of streets to a terrain: You can load heightmaps the same way that you can load areal images. The format of these height maps (as far as I remember) is non standard, it is just a binary file with a header (sx,sy) and one float value per pixel for the height. The second method is what we use internally. You can load you terrain as a polygon dataset or as osgEarth or VirtualPlanetBuilder terrain in OpenCOVER. Then you can connect oddLot to OpenCOVER through the ODDLot Plugin. This will load the current 3D Scene as background areal map and also allow adjusting the height of the streets to that 3D scene with the elevation wizard. A useful extension would be to support geotifs as background maps (if you want to jump in and add this feature, I would love to merge a pull request)

TurnipMania commented 1 year ago

@uwewoessner I have not been able to load a typical height map or DEM elevation map which is typically float 32. Through the load map option this message is returned. "foo: Sorry, can not handle images with 32-bit samples."

Tried a half float 16 as well foo: Sorry, can not handle images with IEEE floating-point samples.

Any greyscale map below 32 gets loaded as an Aerial map.

It would be a good feature because often generating a height map is less lengthy and resource hungry than creating or loading geometry.

GeoTiff support is a good idea. I also thought it would be a good feature if you could at least manually input the Z (upward vector) values of the road shape to create curbs and elevated sidewalks. The curve for the road shape ought to be displayed as linear as well.

uwewoessner commented 1 year ago

As I said it is not a regular image format, it is just a plain binary file. You can check the COVISE sources, there is a plugin called ortho snapshot or so, it generates these files

TurnipMania commented 1 year ago

@uwewoessner I am wondering if you can help me understand. So, I was quite excited to discover this amazing software only yesterday. Please bear with me, I am completely new to it. Looking at the tree view in Oddlot There are the two types of maps. Aerial and height.

image

As we have already established everything I have tried so far gets loaded as an aerial map through the "Load Map" button.

image

The elevation wizard looked like it would take a heightmap as input to set the values of the opendrive xml. image

I tried your suggestion to see if I could get a sample to identify what map format is required.

In opencover I used this plugin to create a snapshot "OrthographicSnapShot" image

The default name is heightmap. It outputs a screenshot file with a typical png with three channels that will obviously be loaded as an aerial map.

It also outputs a a heightmap file with a .dat extension which cannot be loaded into ODDlot through the Load map button
image

uwewoessner commented 1 year ago

you are on the right track. if you load a map in oddlot and save the file you will see that it includes an entry in the scenery section with that map. the same way, you can also add heightmaps. in the following form:

we don't use that any more, thus we never bothered adding a userinterface for it.

If you want to give it a go and add loading image file formats such as geotifs you might want to look at bool Heightmap::loadHeightmapDataFile() in src/data/scenerysystem/heightmap.cpp

there you can also see that the file does not even contain a header, it is just and array of double values and the size is expected to be the same as the areal image.

Regards, Uwe

TurnipMania commented 1 year ago

@uwewoessner Thanks for your help Uwe,

Is there anything special I need to know about projecting onto mesh with the open cover plugin. I loaded a .obj file and it looks fine as a background in ODDlot. The elevation wizard lets me apply but the result is just 0 values on all the points. It doesn't seem to be reading the mesh data.

"in the following form:" ? was there supposed to be an image or something in the message.?

I cannot find any documentation on the Cover ODDlot plugin.

uwewoessner commented 1 year ago

That should work right out of the box... And if you can see the terrain as background in OddLot then the projection should be correct. All streets you want to drape to the heightfield need to be selected before running the elevation wizard. I am busy this morning but should be available after 2PM. Do you have time for a video call to sort this out?

TurnipMania commented 1 year ago

Thanks Uwe that's very kind of you. Bit too busy today unfortunately. I will try clicking on it first. I noticed cover also loads e57 point cloud. I'll try that as well.

uwewoessner commented 1 year ago

That won't work for the height adjustment. We do an intersection test against the geometry to find out the height at a specific location. Intersection test however does not work on pointclouds. You will see the point cloud as background image but the elevation wizard won't work.

TurnipMania commented 1 year ago

I have tried this. It just doesn't seem to work for me. I load a mesh with some noise to test in opencover image Connect to ODDlot draw a track and divide to get some extra points. image Open elevation wizard and select all. image Apply and the result is two points set to Zero 0 on the upward vector. image

TurnipMania commented 1 year ago

If only I could get this to work. I assume the super elevation wizard works the same way too. This would be gold.

uwewoessner commented 1 year ago

I found an issue, it looks as if you are running into it. You can't change the scale, it has to stay 1000 --> m You can navigate the scene, drive around in it to your liking but you can't scale it.--> don't press view all. If you run a TabletUI, you can set the scale back to 1000 in the COVER tab if you changed it.

TurnipMania commented 1 year ago

Yes it does work when scaled correctly. When importing a mesh it doesn't appear to be scaled to 1000 by default though.

uwewoessner commented 1 year ago

Then you mus have a damn old covise version, or an old config file the default scale is set to 1000 --> m for quite some time in the default config file config.xml

TurnipMania commented 1 year ago

Hey Uwe,

Just thinking a feature even more important than geotiff would be lane height. It should be in the lane section. Version 1.4 had this.

In lane, as well as width and speed you have an inner and outer height.

height sOffset="0" outer="0.1" inner="0.1"

This has not been implemented. image

Might put a feature request in for that because its useful that the sidewalk and curb are not the same level as the road.

hpcfloh commented 1 year ago

Can you please describe in more detail what you mean with "lane height"? In OpenDrive 1.4 the height is specified by elevation and lateral profile records. They are not defined per lane but on the t value of the road. Also oddlot is a 2D editor following the layout of OpenDrive specification. Therefore we should not integrate a height specification into the lane editor.

Von: "TurnipMania" @.> An: "hlrs-vis/covise" @.> CC: "hpcfloh" @.>, "Mention" @.> Gesendet: Mittwoch, 17. Mai 2023 12:59:52 Betreff: Re: [hlrs-vis/covise] ODDLot import or load a heightmap (Issue #90)

Hey Uwe,

Just thinking a feature even more important than geotiff would be lane height. It should be in the lane section. Version 1.4 had this.

In lane, as well as width and speed you have an inner and outer height.

This has not been implemented. [ https://user-images.githubusercontent.com/105061143/238923541-a2614ec4-cda8-4565-8a62-28c4b708f8d9.png ]

Might put a feature request in for that because its useful that the sidewalk and curb are not the same level as the road.

— Reply to this email directly, [ https://github.com/hlrs-vis/covise/issues/90#issuecomment-1551182202 | view it on GitHub ] , or [ https://github.com/notifications/unsubscribe-auth/ACSF2SUJZ2XPYYN7BBAIHF3XGSVSRANCNFSM6AAAAAAX3EI7Q4 | unsubscribe ] . You are receiving this because you were mentioned. Message ID: @.***>

-- High Performance Computing Center Stuttgart (HLRS) Nobelstr. 19 D-70569 Stuttgart

Tel.: ++49(0)711-68565798 Fax: ++49(0)711-6856832 E-Mail: @.***