It is currently Sat Aug 22, 2020 4:17 am


All times are UTC




Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Overview
PostPosted: Tue Jun 03, 2008 6:19 pm 

Joined: Tue Jun 03, 2008 6:16 pm
Posts: 11
Hi,

I'm interested in using voxel models in Ogre, and I have found your engine. I have observed some of the code and started to figure how it is built, but I would appreciate if you could give me an overview of the system.

Thanks in advance


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Overview
PostPosted: Wed Jun 04, 2008 5:32 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Sure, I will help where I can. The PolyVox library provides several things:

  • Classes for storing volume data (LinearVolume, BlockVolume, etc) and iterators for accessing the data (BlockVolumeIterator).
  • Algorithms for generating a mesh from the volume (SurfaceExtractors.cpp) and for computing surface normals (GradientEstimator.cpp).
  • Utility classes e.g. IndexedSurfacePatch for representing a index and vertex buffer.

The key algorithm that makes it work is Marching Cubes. My implementation was originally based on this one:

http://local.wasp.uwa.edu.au/~pbourke/g ... olygonise/

Though it's getting less similar as the project evolves. But you shouldn't really need to know how it works internally, the library hides those details.

In your engine you are responsible for filling the volume with data and then asking the PolyVox library to generate the correspondiong mesh. This gets returned as index and vertex buffers which you can display.

The PolyVox library is still changing but has stabilised a lot recently. I hope the interface will be fairly final in about a month, so that I can put some work into the engine (Thermite3D) which uses it.

Also, I am intending to write some documentation soon, and possibly a simple OpenGL example showing how to use the library in you own engine.

Does that help?


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Overview
PostPosted: Thu Jun 05, 2008 4:46 pm 

Joined: Tue Jun 03, 2008 6:16 pm
Posts: 11
It helps partially. From what you say I understand that I can use the PolyVox library independently, without using Thermite, from another engine (Ogre, for example?). Then an example of how to use it would be fantastic.

I've been trying to use the source version of Thermite but it doesn't work well (the best results I have gotten is the scene with castle being invisible :lol:, but with some blocks becoming visible after clicking with the left mouse button, and the right mouse button causing an instant crash). On the other hand, the precompiled version works perfectly. From the logs I can see that one of the differences is that the mipmaps are generated by hardware in the precompiled version but by software in the one compiled by me :?, but I still have to investigate more on this.

And one final question: what is the format of the voxel models loaded by Thermite?


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Overview
PostPosted: Thu Jun 05, 2008 8:21 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Marc wrote:
It helps partially. From what you say I understand that I can use the PolyVox library independently, without using Thermite, from another engine (Ogre, for example?). Then an example of how to use it would be fantastic.


Yep, that's the idea. The PolyVox library only depends on Boost - and I half planning to remove this dependency so it's standard C++. The mesh data which comes out of PolyVox is then fed into Ogre (for graphics) and Bullet (for physics) and the resulting system is what I call Thermite. However, you could just as easily feed the data into another engine. Over the next week or so I will try to write a simple example which puts some data in the volume and displays it with OpenGL.

Marc wrote:
I've been trying to use the source version of Thermite but it doesn't work well (the best results I have gotten is the scene with castle being invisible :lol:, but with some blocks becoming visible after clicking with the left mouse button, and the right mouse button causing an instant crash). On the other hand, the precompiled version works perfectly. From the logs I can see that one of the differences is that the mipmaps are generated by hardware in the precompiled version but by software in the one compiled by me :?, but I still have to investigate more on this.


Hmmm.... we firstly I guess it could be an instance of this problem?:

http://www.ogre3d.org/phpBB2/viewtopic.php?t=41789
http://www.ogre3d.org/phpBB2/viewtopic.php?t=41547

Though I'm not really convinced. Try using a much simpler material. Open 'WorldRegion.cpp' and replace the text "SingleMaterial" with "RedMaterial" and recompile. Does the world show up (though it will now be red)?

Marc wrote:
And one final question: what is the format of the voxel models loaded by Thermite?


All volumes are currently 256x256x256 - though I think the only example of a valid volume is the castle. The first three bytes are the width, height, and depth of the volume represented by the power to which 2 must be raised. That is, in the castle volume the first three bytes are all '8' because 2^8 = 256.

After that you have 256x256x256 = 16777216 bytes with each byte corresponding to a voxel. I think they are in X then Y then Z order. That is, the first 256 bytes form one row of voxels, the next 256 form the next row, etc, until you have a slice. Then the next byte is the start of the next slice.

But actually this format is independent of PolyVox - it is only part of Thermite. PolyVox itself has no format, it doesn't care where it's data comes from. For example, you might choose to generate the volume procedurally instead.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Overview
PostPosted: Fri Jun 06, 2008 3:01 pm 

Joined: Tue Jun 03, 2008 6:16 pm
Posts: 11
David Williams wrote:
Yep, that's the idea. The PolyVox library only depends on Boost - and I half planning to remove this dependency so it's standard C++. The mesh data which comes out of PolyVox is then fed into Ogre (for graphics) and Bullet (for physics) and the resulting system is what I call Thermite. However, you could just as easily feed the data into another engine. Over the next week or so I will try to write a simple example which puts some data in the volume and displays it with OpenGL.

Good :) In the meantime I will try to do it by myself.

David Williams wrote:
Hmmm.... we firstly I guess it could be an instance of this problem?:

http://www.ogre3d.org/phpBB2/viewtopic.php?t=41789
http://www.ogre3d.org/phpBB2/viewtopic.php?t=41547

Though I'm not really convinced. Try using a much simpler material. Open 'WorldRegion.cpp' and replace the text "SingleMaterial" with "RedMaterial" and recompile. Does the world show up (though it will now be red)?

Yes, the world is now visible in red.

David Williams wrote:
All volumes are currently 256x256x256 - though I think the only example of a valid volume is the castle. The first three bytes are the width, height, and depth of the volume represented by the power to which 2 must be raised. That is, in the castle volume the first three bytes are all '8' because 2^8 = 256.

After that you have 256x256x256 = 16777216 bytes with each byte corresponding to a voxel. I think they are in X then Y then Z order. That is, the first 256 bytes form one row of voxels, the next 256 form the next row, etc, until you have a slice. Then the next byte is the start of the next slice.

But actually this format is independent of PolyVox - it is only part of Thermite. PolyVox itself has no format, it doesn't care where it's data comes from. For example, you might choose to generate the volume procedurally instead.

Ok, I will probably implement a loader for the format/s I need.

Thank you for your answers!


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Overview
PostPosted: Fri Jun 06, 2008 5:58 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Marc wrote:
David Williams wrote:
Hmmm.... we firstly I guess it could be an instance of this problem?:

http://www.ogre3d.org/phpBB2/viewtopic.php?t=41789
http://www.ogre3d.org/phpBB2/viewtopic.php?t=41547

Though I'm not really convinced. Try using a much simpler material. Open 'WorldRegion.cpp' and replace the text "SingleMaterial" with "RedMaterial" and recompile. Does the world show up (though it will now be red)?

Yes, the world is now visible in red.


Ok, well that proves the geometry is being generated properly, so I think it could well be an instance of the mipmap problem mentioned on the Ogre forums. I build my version before this occurred so haven't suffered from it. Change the code back to how it was, and try opening thermite\share\thermite\media\materials\scripts\single.material and appending a space and a '0' to each of the texture names. So:

Code:
texture_unit
{
   texture bricks.jpg
}


Becomes:

Code:
texture_unit
{
   texture bricks.jpg 0
}


That tells ogre to generate zero mipmaps for each texture. Let me know what results you get

I'll let you know how the OpenGL sample comes along, but you can also look at the following link to see when I commit stuff.

http://www.thermite3d.org/joomla/index. ... &Itemid=26


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Overview
PostPosted: Mon Jun 09, 2008 3:47 pm 

Joined: Tue Jun 03, 2008 6:16 pm
Posts: 11
Hello,

With this last change the textures are all visible, thank you!

But I still have another problem: there's a runtime error as soon as the scene is shown and I have no clue about its origin. This started after trying some things with the other components (different configurations or versions, etc.). I will try to recompile everything to see if it works again.

Image

Also, I have seen some hardcoded paths that I've had to change (C:/ogre/... for example, and the install path).


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Overview
PostPosted: Mon Jun 09, 2008 5:40 pm 

Joined: Tue Jun 03, 2008 6:16 pm
Posts: 11
After recompiling with a slightly older version of Ogre now it works almost fully. The only think that fails is the right mouse button, which causes an instant crash with an unhandled win32 exception.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Overview
PostPosted: Mon Jun 09, 2008 10:02 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Great, I'm glad it works! You may notice that switching the mipmaps off causes the textures to wobble as you move, but hopefully the NVidia driver issue gets resolved soon. As for the right clicking thing, yes, it's a bug. You should find it works if you are inside the volume though, up close to one of the walls. It basically shoots a ray and destroys everything along it's path. Could be a cool weapon :D

The Thermite engine is generally a bit buggy - but I'm mostly focusing on the PolyVox library which is getting quite good now. I want to add mesh smoothing and mesh decimation, and then I'll focus on tidying it up and documenting it. I also checked in the initial OpenGL sample though it doesn't do anything yet. I'll work on it this week...

So I'm curious, what do you want to use the technology for?


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Overview
PostPosted: Tue Jun 10, 2008 12:04 pm 

Joined: Tue Jun 03, 2008 6:16 pm
Posts: 11
Well, we want to do something related to serious gaming, and one possibility is to display a volume in a game engine. And then do something more, but I still don't know what :P


Top
Offline Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2, 3  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created StylerBB.net