Devan-Kerman / ARRP

A fabric api for creating resources and assets at runtime
Mozilla Public License 2.0
101 stars 25 forks source link

[Question] Why not JsonDestroyer? #75

Closed Speiger closed 1 year ago

Speiger commented 1 year ago

I find this project quite funny but also cool. First of all this looks like a good project, no hating here, I just have a few questions. You don't have to answer and can just close this if you feel like it.

But I kinda want to ask a few questions.

Anyhow, now that my Questions are asked. Sorry if they were rude. Anyhow I wish you a great rest of your weekend :3

Edit: Removed answers, mainly because thought lead to only yelling match and I wasn't fond of that (including answers that I posted after your last comment)

Devan-Kerman commented 1 year ago
Devan-Kerman commented 1 year ago

idk if just returning a BakedModel will work with other resource packs, ARRP works with resource packs

A block of that complexity should definitely be a BlockEntity, building a BlockState table of that size will freeze the game for several seconds on game start, let alone baking that entire model. Also since the states are so varied they wont compress well in the packed data format.

Yeah ok, but you are still writing json files from hand, its nothing different then a DataGenerator.

Yeah, it is a data generator, but java in the IDE with the reusability of code is considerably easier to write than json

Devan-Kerman commented 1 year ago

Block models should definitely be compatible with resource packs, that's why resource packs exist, ARRP is compatible

There is the new VertexConsumerProvider which can batch rendering, it is very fast, and definitely performs better than millions of blockstates

Devan-Kerman commented 1 year ago

There is more to rendering & performance than just that, creating millions of permanent objects introduces GC pressure, prevents PalettedContainer from compressing which further increases GC pressure. If the model is simple (which pipes are), a batched draw call will certainly perform better. When dealing with millions of blockstates, it will take millions more BlockEntityRenderers for it to perform worse. And the bottleneck is not matrix multiplication anyways, it's the number of draw calls, or vertex count usually

Devan-Kerman commented 1 year ago

I am not telling you to use one over another, there is very obviously a use for custom baked models (though you should be using the fabric api for that and not a home-made api, because your solution will be incompatible with sodium & resource packs, or another mod that wants to override your model)

Remember, the Tesselator(BlockEntity) creates every single frame hundreds of new Matrix instances, Vector4fs and a lot of other things.... just to perform matrix calculations to then throw in a mesh that is drawn once and then throw it out.

This is not true, nor is it a significant portion of block entity render time.

Devan-Kerman commented 1 year ago

Even if you don't place a particular blockstate, the object will still exist in memory because the blockstate table is pre-computed

Speiger commented 1 year ago

Yeah and you missunderstood me, 5million blockstates would be required if i used json. My system compresses it more then you could ever do it, down to 600 which is only a few kilobytes of data at worst. And TSR rendering is just a garbage bin.

Devan-Kerman commented 1 year ago

for cases that should be done with a BakedModel, you should be using the fabric rendering api for that, because otherwise your mod will be incompatible with sodium, canvas, iris (maybe)

Speiger commented 1 year ago

Forge Only FYI. And no its compatible already tested.