Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (524)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (592)
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 1430 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?

EDIT-
I feel like I'm putting like 1.5 million vertices, 8 float / vertex into 1 single VBO. Is this OK to do? Cheesy
EDIT--
It seems I was really doing something wrong. I think I'm at 300k static vertices for terrain right now.
EDIT---
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:

http://www.java-gaming.org/topics/limitations-on-size-of-vbos/31246/msg/290116/view.html#msg290116

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
« League of Dukes »

« JGO Overlord »


Medals: 833
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.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

toopeicgaming1999 (55 views)
2014-11-26 06:22:04

toopeicgaming1999 (48 views)
2014-11-26 06:20:36

toopeicgaming1999 (8 views)
2014-11-26 06:20:08

SHC (24 views)
2014-11-25 03:00:59

SHC (24 views)
2014-11-25 02:53:45

Norakomi (26 views)
2014-11-25 02:26:43

Gibbo3771 (23 views)
2014-11-24 10:59:16

trollwarrior1 (36 views)
2014-11-22 03:13:56

xFryIx (75 views)
2014-11-13 03:34:49

digdugdiggy (52 views)
2014-11-12 12:11:50
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 13:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 13:36:02

List of Learning Resources
by Longor1996
2014-08-16 01:40:00

List of Learning Resources
by SilverTiger
2014-08-05 10:33:27

Resources for WIP games
by CogWheelz
2014-08-01 07:20:17

Resources for WIP games
by CogWheelz
2014-08-01 07:19:50

List of Learning Resources
by SilverTiger
2014-07-31 07:29:50

List of Learning Resources
by SilverTiger
2014-07-31 07:26:06
java-gaming.org 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‑gaming.org
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!