Implemented A Possible Way to Increase Planet FPS

    Daeridanii

    Detail Devil
    Joined
    Jan 16, 2016
    Messages
    115
    Reaction score
    138
    • Community Content - Bronze 2
    • Legacy Citizen
    I don't know if this would work or not, or if it is already implemented, but I don't think it is. So here's the idea:

    Only load visible planet blocks.


    What I mean is:

    If this is the surface of the planet
    ☐☐☐☐ Then this
    ☐☐☐☐ and this
    ☐☐☐☐ and this shouldn't even exist until they are visible.

    What do I mean by don't exist?
    Well:

    • Each block in a planet has a certain chance of being loaded once it is visible
    • Until it is visible, it has no effect on the outside world

    So, please tell me if this is already implemented or something, and thank you for reading this text.
     
    Joined
    Dec 3, 2013
    Messages
    552
    Reaction score
    182
    • Legacy Citizen 9
    • Purchased!
    • Community Content - Bronze 1
    There are programming methods that do just this. Though in a slightly different manner. IF I recall properly (and my memory can be bad) currently everything, seen or unseen is still rendered. Once they fix that bit of the graphics code, we should be golden. That is why, for example when using docked power reactors, the beams cause extra lag. Its due to the beams being drawn even when you can't see them.

    This is my understanding of how the graphics work at the moment. I could be very wrong, so if someone knows what they are talking about wants to correct me, please do.
     
    Joined
    Dec 31, 2014
    Messages
    56
    Reaction score
    18
    Planet blocks are not being loaded one by one. They are loaded in chunks, cubes of 16x16x16 blocks for example, don't know the exact size. There are data structures and algorithms for that and it's more efficient than loading only visible blocks, for many reasons.

    About blocks being rendered or not, only the ones in the external layer of the planet are rendered. The same happens with entities.
     
    Joined
    Jul 24, 2013
    Messages
    1,326
    Reaction score
    2,096
    • Master Builder Gold
    • Councillor 2 Gold
    • Video Genius
    its already implemented yes.
    all blocks beneath the surface do not "exist"

    you can test this easily to check if its true.
    For example,I had a 1000m empty hull. 200,000 blocks.
    a lot of surface that needed to be rendered for all those blocks that are not covered.
    so I had around 30-40 fps

    then,after filling the whole thing,it had 10 times more blocks inside. but since it was all covered,
    I had no fps problems,so I was at stable 100+ fps
     

    Winterhome

    Way gayer than originally thought.
    Joined
    Jun 29, 2013
    Messages
    1,929
    Reaction score
    636
    I think he means not rendering the other side of the planet, Skylord.

    Planets are 12 entities, and while you don't load or render the interior of a plate, I can verify that you do render the entire planet.
     
    Joined
    Jul 24, 2013
    Messages
    1,326
    Reaction score
    2,096
    • Master Builder Gold
    • Councillor 2 Gold
    • Video Genius
    I think he means not rendering the other side of the planet, Skylord.

    Planets are 12 entities, and while you don't load or render the interior of a plate, I can verify that you do render the entire planet.
    ah,in that case,yeah..agreed.
    :)
     

    Lecic

    Convicted Lancake Abuser
    Joined
    Apr 14, 2013
    Messages
    5,107
    Reaction score
    1,228
    • Thinking Positive Gold
    • Purchased!
    • Legacy Citizen 11
    Are we sure if the interior side of the plate doesn't load? I mean, it's an "exposed block," so it should load, right?
     
    Joined
    Jul 24, 2013
    Messages
    1,326
    Reaction score
    2,096
    • Master Builder Gold
    • Councillor 2 Gold
    • Video Genius
    Are we sure if the interior side of the plate doesn't load? I mean, it's an "exposed block," so it should load, right?
    are you talking about caves? if so.. then yeah,they are additional pockets of surfaces that need to be rendered because they are not covered. everything that has the exposed surface infont/behind anything.. is rendered
    damn.. if we had even a simple LOD tech,performance would skyrocket :/
     
    Last edited:
    Joined
    Nov 9, 2015
    Messages
    131
    Reaction score
    50
    Are we sure if the interior side of the plate doesn't load? I mean, it's an "exposed block," so it should load, right?
    I'm not sure quite how that works, because the core isn't a block, but it has a hitbox and collision mesh, so It could go either way...
     

    Benevolent27

    Join the Dark Side
    Joined
    Aug 21, 2015
    Messages
    585
    Reaction score
    327
    • Purchased!
    I think he talking about a method of rendering that was present in a minecraft mod (Optifine), which drastically increased the FPS. Basically, Minecraft would render every single block in a chunk. But Optifine would limit the rendering to only what was visible. For me, I'd get about double the FPS as a result.

    One of the ways StarMade reduces the rendering lag is to make solid block chunks not render. I'm unsure if hidden surface area still renders or not. A way to test this would be to make a bunch of large sheets of blocks and only look at one side. If it renders at near the same speed as only 1 sheet (or 1 large chunk of blocks), then it seems likely that they already employ this method of optimization. Though there are other things to consider as well, such as how starmade does collision detection.
     

    Winterhome

    Way gayer than originally thought.
    Joined
    Jun 29, 2013
    Messages
    1,929
    Reaction score
    636
    I think he talking about a method of rendering that was present in a minecraft mod (Optifine), which drastically increased the FPS. Basically, Minecraft would render every single block in a chunk. But Optifine would limit the rendering to only what was visible. For me, I'd get about double the FPS as a result.

    One of the ways StarMade reduces the rendering lag is to make solid block chunks not render. I'm unsure if hidden surface area still renders or not. A way to test this would be to make a bunch of large sheets of blocks and only look at one side. If it renders at near the same speed as only 1 sheet (or 1 large chunk of blocks), then it seems likely that they already employ this method of optimization. Though there are other things to consider as well, such as how starmade does collision detection.
    It's called Occlusion Culling, and I seem to remember we had some form of it in the past, but it caused problems and had to be disabled.

    If it's coming back at all (preferably in a more stable form), it's coming in the Advanced Graphics update way down the line.
     

    jayman38

    Precentor-Primus, pro-tempore
    Joined
    Jul 13, 2014
    Messages
    2,518
    Reaction score
    787
    • Purchased!
    • Thinking Positive
    • Legacy Citizen 4
    Sometimes, when things load slowly, I can see what is being rendered before it is covered up with a nearer chunk, and yes, surface blocks will be rendered, even if there is something in front of them. The short of it is that cave surfaces will be rendered, even sitting hidden underneath the surface of a plate.
     
    Joined
    Dec 14, 2014
    Messages
    745
    Reaction score
    158
    • Community Content - Bronze 1
    • Purchased!
    • Legacy Citizen 2
    A couple terms for those that don't understand. The reason I am posting this is that if the person posting actually had a bit of knowledge about how this was done he probably wouldn't have even made the post.

    Level of Detail(LOD) This is when you get closer to an object the more detail you see. An example would be if you have a 16x16 surface if you are with in 100 blocks you would see all 16 blocks. If you are between 100 and 200 away you may see it rendered as 4 blocks. and greater than 200 away you see it rendered as a single block. Technically with opengl 3.3+ there is only triangles.

    Space partitioning. There are various types these include but are not limited to binary space partitioning(BSP), quad tree, oct tree and Bounding volume hierarchy(BVH) What these do in various ways is split the objects up into volumes in space. Each has their uses and some like BSP have greater draw backs. It can actually increase the amount of geometry in a scene because it can require objects and surfaces to be divided into multiple areas.

    Then you should look up Z-buffer. A z-buffer is an area of memory in video that is used to determine which pixel is shown as the most forward. When you hear of Z-fighting that is when two surfaces usually in the distance are coming across as being the same distance from the view point and you end up seeing triangles or geometry popping back and forth it can look like a saw tooth effect on objects. The reason for this is the way the Z-buffer is built. Originally the amount of space on video cards for z-buffers was limited so they designed it so that the buffer gave more detail and accuracy for objects closer to the view point. With modern hardware there is the ability to use a flat z-buffer its up to the api to allow access to it. Not all do. Z-buffers use a near and a far plane. Anything closer than the near plane is culled and anything farther than the far plane is also culled. Z-culling is removing objects based on distance away.
    Z-buffering - Wikipedia, the free encyclopedia

    View frustum is the field of view visible from the view point. Depending on the type of view you are using it can be different shapes.
    View frustum culling is the removal of any objects not visible inside the view frustum.

    Then you also have back-face culling. This is the removal of object or surfaces facing away from the viewer.
    The direction of the object is determined by the order in which the vertices are listed either in clockwise or counter clockwise order.

    Not all of these are implemented by every graphics engine. When they are implemented there is an order in which they are implemented.
    Since some of these are done on a hardware level they are implemented last.

    LOD, Space partitioning and view Frustum culling are designed to reduce what is sent to the hardware. They are implemented in Space partitioning, View frustum and LOD order. The resulting scene is then sent to the hardware. In which the z-buffer and back face culling can be implemented.

    Not all these steps are used in every system. Also some may reverse LOD and view frustum. Not everyone implements back-face culling and even if they do it may not be on every object or surface.

    That doesn't even cover all the stuff done with shaders these days and the various types of shaders. I tried to simply cover the most common methods of culling objects and surfaces from a scene. Notice I said most common and not all. The fact is a book could be wrote on each of those topics. In fact several books have been written.
     
    Last edited:
    Joined
    Dec 3, 2013
    Messages
    552
    Reaction score
    182
    • Legacy Citizen 9
    • Purchased!
    • Community Content - Bronze 1
    lots of good info there. I've never gotten to the point with my C++ knowledge to do anything graphical, but I still find it interesting to have a general view of what is going on.