cityjson / specs

Specifications for CityJSON, a JSON-based encoding for 3D city models
https://cityjson.org
Creative Commons Zero v1.0 Universal
108 stars 25 forks source link

are "vertices-texture" restricted to [0, 1]? #154

Closed hugoledoux closed 1 year ago

hugoledoux commented 1 year ago

Someone raise the point that the demo file LoD3_Railway.city.json has many entries in "vertices-textures" that are way outside the allowed range of [0, 1], as stated in the specs (https://www.cityjson.org/specs/1.1.3/#vertices-texture-object).

I first thought it was an error either in the original CityGML v2.0 file but then I went to read the CityGML specs and I cannot find anything about those coords (or I am missing something?).

Then I went to the v2.0 specs, and they say that any values are possible, see snippet below.

The figure states clearly that the range is [0,1], but the text says otherwise. If any values are possible, then where is the origin? The values in the LoD3 file have some -161.11 so how is that possible?

Help needed here, I am lost (or my brain is still on holidays...). Perhaps @clausnagel can shed some light on this?

SCR-20230103-fbd

I-Sokolov commented 1 year ago

It seems your assumption is that texture is a big picture and wall surface is cut out of it.

Alternative approach is that texture is a small tile and repeated on surface many times. IMO 'repeat' approach is more practical, either you can trap in creating very big texture files and not reusable for bigger objects.

If a texture is a picture of one break and it repeated on a rectangular wall surface 100 times - how will you reflect this with 0..1 range?

hugoledoux commented 1 year ago

Fair point, I did assume the former.

But maybe I am stupid but I still don't understand how allowing outside the range [0,1] will solve for this case. Can you point to an explanation please?

hugoledoux commented 1 year ago

OK, I am now wiser (thanks @liberostelios). So there is an error in the specs, the uv-coords should not bounded to [0,1] because numbers outside this range is a trick to repeat the textures. TIL.

This is explained very nicely there: https://learnopengl.com/Getting-started/Textures

Especially that part (what is called 'repeat' in OpenGL is 'wrap' in CityJSON): SCR-20230103-lmj

I'll fix this and release v1.1.4 eventually. Thanks for pointing this out @I-Sokolov