Texmap render issues on PT


RE: Texmap render issues on PT
#13
The errors in the 3D render have been fixed in the main library - the changes just have to be pushed to the LDraw pages.

I found one error and one misinterpretation. The error caused texmaps to not work on sub-models, which is why the floor was blank. This was easily fixed.

The misinterpretation is what caused the textures on the sides of the pools to be stretched. The issue is due to the undefined behaviour of "negative distances" in the specification. See this cutout as an example:[Image: 4SGEfXf.png]
The blue triangle represents the texmap projection coordinates:

0 !TEXMAP START PLANAR 0 -20 -160  0 -20 -80  0 0 -160 6092p01pit2side1.png

The green triangle and the lines show where the projection intersects a section of the part.
As you can see, the upper point lies outside of the projected area. The UV value for this point will thus match that of the point below it.

By changing the code from:

[color=#24292e][size=small][font=-apple-system, system-ui,][color=#24292e][size=x-small][font=SFMono-Regular, Consolas,]    [color=#d73a49]let toPlane = (n, D) => Math.abs(n.x*p.x + n.y*p.y + n.z*p.z + D);[/color]

to:

[/font][/size][/color][color=#24292e][size=x-small][font=SFMono-Regular, Consolas,]    [color=#d73a49]let toPlane = (n, D) => n.x*p.x + n.y*p.y + n.z*p.z + D;[/color]

the texture is placed as intended.[/font][/size][/color][/font][/size][/color]



[color=#24292e][size=small][font=-apple-system, system-ui,]PS. In the console you can also see how the three.js texture loader is scaling down the texture and does so rather crudely.[/font][/size][/color]
Reply
« Next Oldest | Next Newest »



Messages In This Thread
Texmap render issues on PT - by Alex Taylor - 2020-06-02, 15:54
RE: Texmap render issues on PT - by Lasse Deleuran - 2020-06-13, 21:21

Forum Jump:


Users browsing this thread: 1 Guest(s)