MGame icon indicating copy to clipboard operation
MGame copied to clipboard

Enhancing 3D Rendering with OpenStreetMap data : Feature Suggestions

Open Randalf-gh opened this issue 11 months ago • 8 comments

After a few days of use, I was wondering if it would be possible to introduce some improvements to better reflect the "OpenStreetMap reality":

  • Enable the display of 3D elements in .obj format based on specific tags such as street_lamp, sculpture, fountain, etc.
  • Apply textures and colors defined in the Simple 3D Buildings model for buildings, using attributes like building:colour, building:material, building:levels.
  • Randomly generate trees only in areas identified as landuse=forest.

These are just suggestions - feel free to consider what seems useful to implement.

The game is really cool, thank you !

Randalf-gh avatar Feb 12 '25 08:02 Randalf-gh

  • Enable the display of 3D elements in .obj format based on specific tags such as street_lamp, sculpture, fountain, etc.

This is currently possible by assigning the attribute model:name and optionally the yangle:degrees attributes.

Image

Instead of the yangle:degrees attribute, neighboring nodes can be used to define the rotation.

  • Apply textures and colors defined in the Simple 3D Buildings model for buildings, using attributes like building:colour, building:material, building:levels.

The building:color (not building:colour) attribute should work. Also, one kind of roof with angles is supported:

Image

  • Randomly generate trees only in areas identified as landuse=forest.

The attributes terrain_region:trees and terrain_region:flowers are currently supported:

Image

The terrain-style inside the regions can then be set using the terrain_flowers_textures and terrain_trees_textures attributes in the JSON-file.

Image

The trees and flowers to be shown are specified using the far_flowers_resource_names and far_trees_resource_names attributes.

Image

The much_far_flowers_distance and much_far_trees_distance attributes define the vegetation density.

Image

gre-42 avatar Feb 13 '25 20:02 gre-42

Thank you for the support. I made some tests this weekend.

Models

This is currently possible by assigning the attribute model:name and optionally the yangle:degrees attributes.

I understand which tags to apply, and everything is working correctly.

Buildings I haven't tried yet :blush:

Trees

The terrain-style inside the regions can then be set using the terrain_flowers_textures and terrain_trees_textures attributes in the JSON-file.

I made the following adjustments, in an area defined as "terrain_region=trees" :

      "terrain_trees_textures": [
        "#Gravel010_Base",
		"#Ground037_island_1",
		"#Ground037_island_8_1",
		"#Ground037_island_64",
		"#Ground037_island_256"
      ],

      "far_trees_resource_names": [
        "vegetation6.12(hitbox:box_02_1_02_hitbox)",
        "vegetation6.13(hitbox:box_02_1_02_hitbox)",
        "vegetation6.14(hitbox:box_02_1_02_hitbox)",
        "vegetation6.15(hitbox:box_02_1_02_hitbox)",
        "vegetation6.16(hitbox:box_02_1_02_hitbox)"],

However, the terrain texture is modified, but no trees are visible on it. Did I forget a parameter?

Randalf-gh avatar Feb 17 '25 04:02 Randalf-gh

I've try the buildings. There are good and bad news !

The good : the 3dr:type=9.2 works perfectly !

The bad : the colors don't seem to be taken into account. I created three houses with different configurations, but I don't see any changes in the rendering. Here is what it looks like: Image

And the building configuration :

Left, whithout color tag : Image

Middle, with RGB values : Image

Right, with color names : Image

I'va also check on the wiki, the real name for color properties is building:colour, roof:colour and not ~~building:color, roof:color~~

Maybe did you know how to display the real color of building ?

Randalf-gh avatar Feb 18 '25 20:02 Randalf-gh

However, the terrain texture is modified, but no trees are visible on it. Did I forget a parameter?

I made a mistake there, the attributes are near_flowers_resource_names and near_trees_resource_names.

Image

I've try the buildings. There are good and bad news ! The good : the 3dr:type=9.2 works perfectly ! The bad : the colors don't seem to be taken into account. I created three houses with different configurations, but I don't see any changes in the rendering. Here is what it looks like:

I was wrong there as well, the currently supported attribute name is just color (not colour, building:colo[u]r, roof:colo[u]r). Roof colors are not yet supported at all. Also, the colors must be rgb-values with format r g b. Each component has a range from 0 to 1.

I'va also check on the wiki, the real name for color properties is building:colour, roof:colour and not building:color, roof:color

Yes, the game should use the recommended tags...

gre-42 avatar Feb 19 '25 19:02 gre-42

Building The 'color' tag works perfectly. The color of the buildings is changed correctly. Image

But it's important to note that the syntax is not #rgb (p. exe #bc5f7a). It's the value of the 3 colors in float, separated by spaces.

Trees With the new parameters, everything work fine, too.

Despite the information provided, I can't remove the trees generated at the side of the road. To have a more realistic representation of the decor, I would like to create myself the forest areas. Can you tell me about the changes to make to the scene configuration so that there are no more trees on the side of the road?

Randalf-gh avatar Feb 21 '25 15:02 Randalf-gh

The trees on the side of the road are defined by the lines "vegetation11.0" - "vegetation11.5" in the "near_wayside1_grass_resource_names" attribute. It should be possible to simply delete the 6 lines from the JSON-file.

Image

gre-42 avatar Feb 21 '25 17:02 gre-42

Regarding the building:colour/roof:colour attributes: Applying these attributes only results in the desired final color if the texture that is applied to a building is gray or white. Otherwise, the texture color and the building:colour/roof:colour attributes would multiply and result in a wrong final color.

This might have been the reason why the color attribute was chosen as a non-standard attribute back in the day.

gre-42 avatar Feb 28 '25 06:02 gre-42

There have been improvements to roofs and windows.

  • Windows are now reflecting, if the "window_reflection_map" attribute is set.
  • Roofs have a rain pipe now, if the attributes"roof_rail_texture" and "roof_model" are set.
  • The 9.2 model is automatically applied to all buildings, if the "default_roof_9_2" attribute is set.

Image

Image

gre-42 avatar May 04 '25 15:05 gre-42