LDraw.org Discussion Forums
LDIStatisticsViewGL - Printable Version

+- LDraw.org Discussion Forums (https://forums.ldraw.org)
+-- Forum: LDraw Programs (https://forums.ldraw.org/forum-7.html)
+--- Forum: LDraw Editors and Viewers (https://forums.ldraw.org/forum-11.html)
+--- Thread: LDIStatisticsViewGL (/thread-26110.html)



LDIStatisticsViewGL - Stefan Frenz - 2022-03-11

Inspired by the (very similar) threads here and here by kevlamar, I wrote a tiny viewer that displays a model and checks which triangle is currently shown and which triangle is shown since loading/reset. This is done to calcualte some statistics and to give some sense of how many triangles are really used ("#E" in screenshots) and how many could be removed ("#T-#E").

For the 10218 model, I would assume one could remove about 80% of the triangles without loosing significant detail even if the user is allowed to rotate freely. Screenshot of the rendered original model (934441 triangles):
   

Screenshot of the 148853 triangles identified in some previous rotations (ok, very similar, but not overwhelming for the same perspective):
   

Screenshot of the 785588 removed triangles (mostly studs and face-to-face-triangles):
   

Looking at the 8868 Airtech Claw Rig, about 50% of the triangles are really shown sometimes (587814 of 1104183 after trying really many camera positions):
   

Looking at a tiny 3x3 brick wall, as expected the studs in the lower two rows can be removed and the inner boxes of the upper two rows can be removed, resulting in about 60% savings:
   


RE: LDIStatisticsViewGL - Roland Melkert - 2022-03-11

(2022-03-11, 18:56)Stefan Frenz Wrote: Inspired by the (very similar) threads here and here by kevlamar, I wrote a tiny viewer that displays a model and checks which triangle is currently shown and which triangle is shown since loading/reset. This is done to calcualte some statistics and to give some sense of how many triangles are really used ("#E" in screenshots) and how many could be removed ("#T-#E").
Very cool.

Ik you add some automatic 'scan' rotations you could generate a hollow version of the loaded model whcih you could export to a ldr for display purposes only.


RE: LDIStatisticsViewGL - Stefan Frenz - 2022-03-12

(2022-03-11, 19:00)Roland Melkert Wrote: Ik you add some automatic 'scan' rotations you could generate a hollow version of the loaded model whcih you could export to a ldr for display purposes only.

Yes, exactly this feature was the main intention of the development after reading the threads by kevlamar.  Smile The initial plan was to have scripted camera positions or to identify relevant camera-positions based on a collision detection (answering "where can someone place a camera without hitting a brick"). But I think my filter will not solve kevlamar's problem as I assume even 80% reduction will not be enough.

At the moment I'm just playing around to get a feeling which models can have which triangle reduction rate - and there are some floating point issues waiting to be resolved for line vertex matching. For example 2x2 round tiles 4150.dat and 14769.dat have lines at the upper edges, but due to floating point rounding differences my algorithm fails to match the vertices of the line against the vertices of the triangles...


RE: LDIStatisticsViewGL - Gerald Lasser - 2022-03-14

That's some interesting information! A lot of faces are indeed hidden, studs and inner construction of the opaque bricks.

Do you save the result of the reduction as a .dat file?


RE: LDIStatisticsViewGL - Stefan Frenz - 2022-03-14

(2022-03-14, 11:01)Gerald Lasser Wrote: Do you save the result of the reduction as a .dat file?
In LDInspector there is an ldr/mpd-to-obj exporter. So the plan is to export all not-hidden triangles to obj. Or is there another (preferred) file format? I could imagine writing a flattend (very big) .dat file, but I'm not sure if this would be useful somehow.