Hello,
I'm working on a road rule file that does texturing based on the world position of the shape in order to minimize texture discontinuities. I'm using the GetMapData function to retrieve the road layout and. However, the world-space uvs do not line up for multiple street shapes and are shifted in curved shapes.
The following code is used:
RoadAsphalt -->
setupProjection(0, world.xz, 4, 4)
projectUV(0)
translateUV(0, -OffsetX/4, -OffsetZ/4)
scaleUV(0,1,-1)
texture("builtin:uvtest.png")X.
OffsetX/Y/Z is the centroid of the scene (without it single-precision uvs have trouble)
Does anyone have an idea on how to get continous UVs over multiple shapes?
Cheers,
Bernhard
Using world.xz would be the way to set up the projection, but unfortunately when the scene contents are far away from the origin, there are some problems with floating point precision. This is why you get the results above.
While we investigate the problem and see if we can fix it, there is a not-so-nice workaround to get continuous textures on the street shapes which are far away from the scene origin. This workaround imposes some limitations though (e.g. no more dynamic shapes, no more separate shapes).