awesome. love that compression ratio. @sethp this is the way.
The new VRML Loader has been uploaded to my repository and seems to be 100% functional (not necessarily a 100% correct way of doing this).
@sethp if you could create at least another kicad model and export it to VRML format then I could do some more testing.
My VRML Viewer seems to do OK job exporting models as well. Do note that you should use alternative exports, marked as GLBx_d and / or GLBx_m, in order to merge meshes.
Things do work with this viewer but am not sure how it will work in other setups - at least the loader’s resourcePath
should be set in the code (see the viewer’s code).
Here is the DRACO compressed model, which seems to be comparable in features to the previously posted MESHOPT compressed model but is half the size.
SYZYGY-PHY_GLBx_DRACO.zip (355.4 KB)
whoa, that’s pretty neat! I think I got a similar result following @manthrax’s very helpful suggestions:
Note that I’m down to 30 objects (25 meshes + 2x lights + axis helper + camera + root scene) and 26 draw calls, pretty cool! The code for that’s over here: wip: opt mode merging similar materials · rustbox/router@ff85552 · GitHub . In doing so, I found for this model that simply color
serves as a unique-enough key for the materials that everything “looks right,” though that’s certainly not gonna cover every possibility.
Do I have it right that the import/export process you’re describing, @GitHubDragonFly , is a more general way to merge identical-looking meshes together? Is the “compression” there lossy in the same way my scene optimizer is? Like, I’m (purposefully) losing track of which triangles make up the “resistor” labeled with R9; in order to do something as simple as toggle the visibility of one of those components, I’m keeping the old scene tree around just so I can re-run the merge with those specific pieces omitted.
As for more test samples, I’ve got a couple possibilities at hand, depending on what you’re looking for, but at the moment nothing I’ve got is going to be much more complete/interesting than the board I shared. If you just want test cases, probably nothing’s gonna beat going straight to the kicad libraries themselves, since much of the designs I’m making are going to be compositions of piece parts like that.
My viewer is using glTF Transform and its functions, which can do the following: weld vertices, instance the same meshes and palletize the same materials. It can do far more, just check its webpage.
You seem to be doing pretty good on your own, and with just a few suggestions from other people, so keep it up.
If you do decide to try using my version of VRML Loader then just remember that it should work only with URL models and the loader’s resourcePath
should be set in the code, similar to this:
- If the main model URL is:
https://raw.githubusercontent.com/rustbox/router/f280f25/SYZYGY-PHY/SYZYGY-PHY.wrl
- The loader’s
resourcePath
should be set with:loader.setResourcePath( 'https://raw.githubusercontent.com/rustbox/router/f280f25/SYZYGY-PHY/' );
- The loader’s code is currently set to fetch inline URLs with:
resourcePath + URL
This should keep working for as long as the models keep the same structure, like it is in your SYZYGY-PHY.wrl
model, that’s why asked for another example just to see if it would be similar.
You’ve come a long way, getting the number of draw calls down from ~7’000 to 26, while at the same time increasing your framerate from 24 to 120. Congratulations on that!
On a side note: whatever happened to the RJ-45 jack of your initial sample PCB? I would expect that to be tougher to compress by a similar ratio?
Ahh, I see: yeah, I asked kicad to set things up that way when I exported the VRML model:
Good tip on setting the resource path to the base name of the initial .wrl
file, thank you for that!
Yeah, huge thanks to @manthrax for the tip; it turns out that there’s just not a lot of different materials in this particular render. I’m quite surprised myself at how effective it was! The RJ-45 jack is still there (on the other side):
turning it off, my object count falls to 24 and draw count to 20. So it’s still the most expensive single component by far (it brings 6 unique materials to the party, it seems), but it’s hardly cost-prohibitive with all the different “bits” merged together.
Could you suggest of what path you get if you uncheck the bottom box (the one that starts with “Use relative paths…”)?
If it changes to full http
address then I could even slightly modify my loader to check that.
not HTTP, sadly, it’s an absolute local file path:
children [
Inline {
url "/home/seth/Scratch/shapes3D/C_0805_2012Metric.wrl"
} ]
}
Unchecking the “copy 3d model files” box is a little more useful for our purposes: it looks like kicad goes ahead and inlines all of the sub-models during export. The result is a file that’s a little easier to load (it doesn’t even appear to require the other float-parsing patch): SYZYGY-PHY.complete.wrl.gz (2.2 MB)
That file works fine in my viewer so it might just be a good way to go for you.
Maintaining only one file should be easier than questioning whether paths of multiple inline files would be read correctly by any viewer.