anegostudios / VintageStory-Issues

Vintage Story's public issue tracker for reporting bugs, crashes and the like
46 stars 16 forks source link

(Ground Storage) Invisible cubes affects performance as if they were visible #1483

Closed Craluminum2413 closed 6 months ago

Craluminum2413 commented 2 years ago

Game Version: 1.16.0-pre.10 Platform: Windows Modded: Yes SP/MP: Singleplayer

Description

A pile with a giant amount of invisible cubes inside gives large bursts of lags on interacting as if they were visible

How to reproduce

  1. Add the shape for a pile of 128 beeswax somewhere in shapes (use this shape beeswaxpile128.zip, it has 2560 cubes, but only 160 of them are visible, also it has 20 tessQuantityElements for each item)
  2. Add this to behaviors in itemtypes/resource/beeswax.json
      {
        "name": "GroundStorable",
        "properties": {
          "layout": "Stacking",
          "stackingModel": "morepiles:shapes/beeswaxpile128",
          "tessQuantityElements": 20,
          "stackingCapacity": 128,
          "transferQuantity": 1,
          "bulkTransferQuantity": 4,
          "collisionBox": {
            "x1": 0.25,
            "y1": 0,
            "z1": 0.2941,
            "x2": 0.656,
            "y2": 0.125,
            "z2": 0.75
          },
          "cbScaleYByLayer": 0.0625
        }
      }
  3. Load any world
  4. Get a stack of beeswax pile
  5. Start making a pile
  6. While making a pile it lags a lot even with enabled occlusion culling

Videos

https://user-images.githubusercontent.com/69315569/146599307-6fdc4ae5-e9f2-447d-9976-e59bb26815e4.mp4

copygirl commented 2 years ago

What do you mean by "invisible cubes"? The terrain is special in that when it updates the mesh to render, it leaves out sides that touch other (full) blocks. The same is not true for item models. They should already be optimized, not be made of thousands of cubes. The occlusion culling option does not affect parts of a model.

I apologize if I'm misunderstanding something here.

Craluminum2413 commented 2 years ago

Cubes that have all faces disabled and size as X0 Y0 Z0. I added thousands of invisible cubes because it is the only way to fit 128 pieces in a pile's shape, look at tessQuantityElements

Craluminum2413 commented 2 years ago

I found out that it is possible to make without invisible cubes, but you need to sacrifice a block collision, because GroundStorable cannot stop growing collision box, so two ways: billions of invisible cubes or always full collision box