Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (491)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (556)
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  
  Voxel engine: What's more efficient?  (Read 4257 times)
0 Members and 1 Guest are viewing this topic.
Offline RylandAlmanza

Junior Member


Medals: 3



« Posted 2012-03-05 05:50:13 »

So I'm making a voxel engine with lwjgl. Every entity is composed of a bunch of voxels. I'm wondering which of the following two methods is more efficient for moving around/rotating an entity (Or if there's a better method.)

Method 1: An entity has x, y, and z variables that I can change to move it around. These variables will be used for the offset of every voxel that the entity is composed of. The render function calculates where every quad of every voxel will be based on the x, y, and z variables of the entity. Upside: I can move the entire entity around by simply changing the x, y, and z variables. Downside: Many, many quad positions will have to be calculated every single render function!

Method 2: All the voxel quads of an entity are loaded into a display list when the game starts. I can move the entity around using glPushMatrix(), glTranslatef(), and glPopMatrix(). Upside: This means that the program doesn't have to do all those calculations every frame. Downside the voxel positions in the display list are fixed, so I can only move the entity around by pushing and popping the matrix. I heard that having to do this for every entity is a bad Idea.

I'm not even sure If everything I said is true, so correct me if I said something wrong, and I'll edit the post. 3D is a lot more confusing than 2D! Anyways, which method is more efficient? Are there other methods that might work better? Thanks!
Online theagentd
« Reply #1 - Posted 2012-03-05 09:22:01 »

This all depends on the ratio between vertices and objects. If each object has very few vertices the OpenGL matrix calls will be a bottleneck, but if you have many vertices per object it's obviously faster to let OpenGL handle the translating. One of them depends on the number of objects, the other one on the total number of vertices. Also note that if you only have a handful of objects any of the two will be fast enough of course.

This is a known performance bottleneck, and is solved in a number of other ways too, depending on what you're drawing.

Myomyomyo.
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 783
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #2 - Posted 2012-03-05 09:25:56 »

How many voxels are moving? How many voxels are static?

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Roquen
« Reply #3 - Posted 2012-03-05 11:09:22 »

There's been alot of recent research on voxels.  If you want ignore that and keep it simple, then leave the voxel model alone (in model space) and move the camera to reflect it's relative world position.
Offline RylandAlmanza

Junior Member


Medals: 3



« Reply #4 - Posted 2012-03-05 20:07:57 »

There will be many more vertices than there are objects. For example, each voxel has 24 vertices (I realize this isn't the most efficient way to do it.) and my player object is composed of 94 voxels (And that's after I hollowed out the inside of him!) And I don't plan to have too many objects on the screen, so it sounds like the matrix calls would be best then, right?
Online theagentd
« Reply #5 - Posted 2012-03-05 20:24:17 »

94 isn't a lot, but in my opinion enough to use the matrix stack. You know, "a lot" in 3D games is usually 1000+, sometimes even 10 000+... xD

Myomyomyo.
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.

Nickropheliac (15 views)
2014-08-31 22:59:12

TehJavaDev (23 views)
2014-08-28 18:26:30

CopyableCougar4 (29 views)
2014-08-22 19:31:30

atombrot (41 views)
2014-08-19 09:29:53

Tekkerue (38 views)
2014-08-16 06:45:27

Tekkerue (35 views)
2014-08-16 06:22:17

Tekkerue (25 views)
2014-08-16 06:20:21

Tekkerue (34 views)
2014-08-16 06:12:11

Rayexar (72 views)
2014-08-11 02:49:23

BurntPizza (48 views)
2014-08-09 21:09:32
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

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

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

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

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

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!