pixeljetstream / ldrawloader

ldraw file loader library
MIT License
12 stars 1 forks source link

how to build a massive scene renderer using this library #6

Open pixeljetstream opened 9 months ago

pixeljetstream commented 9 months ago

from another issue @mzwaal asked

A feature I would like is geometry simplification on model level, that would make a big wall for example cheaper to render. My use case is is rendering the maximum amount of models in real time. I don't use the chamfer feature for that reason. Also full support for all the official parts would be great. Also for non transparent parts, there is a lot of stuff inside bricks that should be culled when bricks are stacked. There are more things I can think of. What would be the best way for you to receive feedback/feature request that are not issues per se?

While this library is more of a data provider, here is some thoughts about its design features:

As for generally going about it and solving the obstruction/waste

mzwaal commented 9 months ago

Nice, a dedicated thread for ideas! In my case I actually have a renderer that for various reasons I do not want to modify. It already supports LOD, rich materials etc so I do not want to implement anything on that level. What I want out of a loader are the triangles, normals and materials, which your library supplies. This information is then imported into an internal format.

About reducing triangles, another strategy I have seen is the create parts that are less detailed. So bricks that are boxes without inner structure or studs. That might be done with the shapes feature and can be automated for entire categories of elements like bricks and plates. It is easy to figure out the dimensions of a 2x4 brick replacement box.

My own wip loader has a somewhat different strategy btw in that it renders all triangles and optimizes normals when possible by averaging based on a best effort. That way any valid ldraw file can be rendered. So it does not reject anything that is has a questionable shape. Even free floating triangles get rendered because the ldraw format does not forbid it.

So in order to switch to completely to this loader I need it to be more permissive in the rendering. Any valid ldraw file should render as the standard does not say anything about geometric correctness. Perhaps it could have a strict geometry mode that gives the part builders some hints on how to improve the geometry. That way parts can become more correct in the future just like with the BFC effort and make them easier to render.

pixeljetstream commented 9 months ago

Okay. As I attempt to process all parts at the moment I also realized how the mesh fixing required for the render normals fails quite a few times. So I second the need for an alternative render part mode mode that is more robust.

With some crude voxelization I could imagine those lowest lod bricks could be generated automatically. Like sample on the aligned Lego grid and then figure out percentages of how "filled" a cell is.