Hi !
Featured games (87)
games approved by the League of Dukes
Games in Showcase (669)
Games in Android Showcase (194)
games submitted by our members
Games in WIP (727)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  LWJGL VBO vertices amount  (Read 2266 times)
0 Members and 1 Guest are viewing this topic.
Offline trollwarrior1
« Posted 2014-04-17 08:04:13 »

I have this map viewer, in which you can zoom out really far.
Basically the way it is setup at the moment is I put all the vertices data into 1 VBO and render it to the screen. I update the VBO when player moves/zooms the map.

I currently have my VBO with 20000 quads (80000 vertices) rendering, and it is far from enough. Is this normal? I mean, how much vertices should I limit myself to? Because I'm thinking I will need like close to 500000 vertices to view the map at max zoom.

I guess the question here is what is an optimal size for a VBO? Or rather, is there a downside to using this ONE huge interleaved VBO over few smaller ones?

I feel like I'm putting like 1.5 million vertices, 8 float / vertex into 1 single VBO. Is this OK to do? Cheesy
It seems I was really doing something wrong. I think I'm at 300k static vertices for terrain right now.
Now my question is should I try to optimize this and make multiple VBOs. Would that enhance the performance?
Offline StrideColossus
« Reply #1 - Posted 2014-04-17 08:19:46 »

I was working on a very similar project:

In summary:
- there are limits on the size of a VBO
- however it appears to be vendor-specific
- there is no guaranteed method to query for this limit
- at some point you will need to use multiple VBO 'chunks' to render your map
- the anecdotal optimal size for a chunk is something around the 4Mb mark
Offline trollwarrior1
« Reply #2 - Posted 2014-04-17 08:21:43 »

So how many floats fit into 4 mb? 1mil?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline StrideColossus
« Reply #3 - Posted 2014-04-17 10:06:07 »

So how many floats fit into 4 mb? 1mil?

Yeah just over a million.  I'd choose a VBO size with that ~4Mb limit in mind.

If you're interested why 256 x 256 chunks in my example:
each vertex has eight floats (3 for position, 3 for normal, 2 for texture coordinates) = 24 bytes per vertex
assuming a 4Mb limit means I could fit ~175K vertices in a single VBO.
256 x 256 is well inside this 'limit', 512 x 512 exceeds it.
Offline Riven

« JGO Overlord »

Medals: 1207
Projects: 4
Exp: 16 years

Hand over your head.

« Reply #4 - Posted 2014-04-17 11:54:23 »

each vertex has eight floats (3 for position, 3 for normal, 2 for texture coordinates) = 24 32 bytes per vertex
There, FTFY Pointing

With shaders you can easily limit the number of bits per vertex attribute.

You can use unsigned-shorts for normals and signed-shorts for texcoords. For a terrain tile grid, it's very likely that you can equally reduce your coordinates to unsigned-short values (maybe even signed-bytes for X and Z axis). Just send the offset vector and scale vector to the shader as uniforms and calculate the 'real' values in the vertex shader. With this simple approach you cut your data size in half (or more), and even 512x512 fits nicely.

I currently have my VBO with 20000 quads (80000 vertices) rendering
You should have about as much vertices as you have quads. Use index buffers to reuse vertices.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings!
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

IanParcs (34 views)
2016-04-18 14:18:53

KaiHH (34 views)
2016-04-18 08:35:41

KaiHH (66 views)
2016-04-15 12:43:58

theagentd (64 views)
2016-04-14 02:16:17

theagentd (72 views)
2016-04-14 02:15:43

IanParcs (66 views)
2016-04-12 03:51:16

IanParcs (35 views)
2016-04-12 03:50:03

IanParcs (32 views)
2016-04-12 03:49:54

IanParcs (27 views)
2016-04-12 03:49:52

IanParcs (36 views)
2016-04-12 03:49:52
Website offering 3D Models specifically for games for free
by vusman
2016-04-29 12:56:17

List of Learning Resources
by SilverTiger
2016-02-05 09:39:47

List of Learning Resources
by SilverTiger
2016-02-05 09:38:38

List of Learning Resources
by SilverTiger
2016-02-05 09:35:50

Rendering resources
by Roquen
2015-11-13 14:37:59

Rendering resources
by Roquen
2015-11-13 14:36:58

Math: Resources
by Roquen
2015-10-22 07:46:10

Networking Resources
by Roquen
2015-10-16 07:12:30 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!