Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 34

Thread: Thyandyr's voxel engine

  1. #11
    Why keeping all this in single vbo?
    btw occlusion culling will be possible with this approach?

  2. #12
    Quote Originally Posted by laggyluk View Post
    Why keeping all this in single vbo?
    btw occlusion culling will be possible with this approach?
    I'm learning by doing and just wanted to see what happens and how much can push to one VBO. I will only remember things that I learn if I have first hand experience of the 'why' of things. Seeing something work or fail is essential to me.

    Sure occlusion calculations will be possible, currently I only draw voxel surfaces that have solid-gas interface (assuming atmosphere... should be called transparent-opaque interface I guess. Actually you draw glass and water too, so should be called change-of-light-refraction interface heh heh), plus chunk edges. Occlusion on larger scale will be necessary once I manage to draw more stuff on screen. I have camera and chunk locations (and voxels' too). I don't know how it's normally done but I thought do to the large scale occlusion per-chunk and not per voxel.
    Last edited by Thyandyr; 03-11-2017 at 12:21 PM.

  3. #13
    Image3.jpg

    Oh yeah! Long and sturdy like my d***

    Problem was I had indices data type as UInt16

    I can now get back to chunk manager. And after that multiple VBOs. And then compacting the data; I don't need full single for texture type or texture coordinates and so forth. Then culling.... and...
    Last edited by Thyandyr; 04-11-2017 at 11:43 AM.

  4. #14
    I have elementary chunk management. It is slow but it works. It is fun to fly (backwards) and to see chunks get deleted in the distance from where you came and new ones to appear under you.
    Last edited by Thyandyr; 04-11-2017 at 11:09 PM.

  5. #15
    I think next I will work on moving the code that generates the vertex and indices arrays, from TChunk to TChunkManager. The latter has easy access to surrounding chunks so I can easier do some culling when drawing at the edge of the chunk. I thought at the same time I would also optimize the attribute data. https://www.khronos.org/opengl/wiki/...ttribute_sizes Not sure how to 'cheat' and insert four bytes instead of single, and how get 'use' them as bytes instead os a single in the shaders.




    Also, is there a better way to get undefined entry from TDictionary? Feels kind-a odd, that part getting a key/id from ListLoad
    Code:
    procedure TChunkManager.ListLoadChunksProcess(const Steps: Cardinal);
    var
      I: Integer;
      aID: String;
      C: TChunk;
    begin
      for I := 1 to Steps do
        begin
          aID := '';
    
    
          if ListLoad.Count > 0 then        // If we have entries in the ListLoad
            for aID in ListLoad.Keys do     // Get one of them
              break;
    
    
          if aID <> '' then                 // If we do have Chunk to load
            begin
              ListLoad.Remove(aID);         // Remove the Chunk ID from ListLoad
              C := ChunkLoadCreate(aID);    // Load Chunk from disk or create it
              ListLoaded.Add(C.ID, C);      // Add to list of loaded chunks
            end
          else                              // Break out, nothing to process
            break;
        end;
    end;
    Last edited by Thyandyr; 05-11-2017 at 07:03 PM.

  6. #16
    Seems TDictionary frees memory as item count goes down.
    Last edited by Thyandyr; 05-11-2017 at 09:17 PM.

  7. #17
    Quote Originally Posted by Thyandyr View Post
    Seems TDictionary frees memory as item count goes down.
    lol how else would you expect any kind of storage class ever to possibly work?

    Also as far as the chunk post you made above this one... The kind of use case you're outlining there is far better suited to a TStack than a TDictionary. Not that you have to use one or the other... you could for example have some kind of global TDictionary to manage the overall voxel chunks by string ID, and a local TStack instantiated within some kind of renderer class that references the same values as the TDictionary. (Assuming that the chunks are classes and can be directly assigned without creating copies... if they're records you'd obviously need to make the TStack's specialization a pointer type instead.)

  8. #18
    TStack would be better for those lists that do not need to search for specific content, which is most of the lists in the Chunk manager. I think I'll update it (as you see I have no pre-knowledge on anything). Actually I need it to be TDictionary. But anyway, what is the difference between TStack.Pop and TStack.Extract? Docs say both remove and return.

    TDictionary has method called TrimExcess made me think maybe it does not release the used memory automatically. Which would be nice in my case. Had it been so I could had the benefits of both the 'static' (or increase on demand) size and arbitrary indexes.

    The load, unload etc lists will pump up and down in size constantly. Wouldn't it be beneficial if they grew in size but never shrank even when empty, or took the theoretical maximum size and kept at that.
    Last edited by Thyandyr; 06-11-2017 at 06:28 PM.

  9. #19
    Achieved:
    • TChunkManager per frame update (TChunks load, create, unload etc. few items per frame)
    • Each TChunk in separate VBO
    • Frustrum culling on Camera change (TChunk.InFrustrum = boolean). VBO stays in but does not get drawn if not in frustrum.
    • VBO freed on TChunk unload


    Managed to introduce annoying stutter effect on fast camera movements.

  10. #20
    I'm back from few weeks holiday. I have no idea what I am doing but somehow I manage to make some progress.

    Stutter is fixed, frustrum culling is working much better too (only on one plane, need to add 4 more.

Page 2 of 4 FirstFirst 1234 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •