It is currently Mon Feb 24, 2020 5:41 pm


All times are UTC




Post new topic Reply to topic  [ 54 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next
Author Message
 Post subject: Re: PolyVox language bindings
PostPosted: Mon Jan 17, 2011 12:09 am 

Joined: Sat Jan 15, 2011 3:49 pm
Posts: 38
Ah. I just tried
Code:
GraphicsDevice.RasterizerState = RasterizerState.CullCounterClockwise;

in my draw routine but it still draws backwards if I don't reverse the indices :(


Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox language bindings
PostPosted: Mon Jan 17, 2011 1:17 am 

Joined: Sat Jan 15, 2011 3:49 pm
Posts: 38
I got some simple perlin noise terrain working, the current annoyance is an overflow in the xna batch drawing code when i give it a large number of vertices at once (eg the result of a 64^3 volume surface extraction with holes in it). Hard to believe that generated enough vertices for int32.maxvalue. The mesh simplification stuff is definitely the next thing I want to make a wrapper for :P

http://dl.dropbox.com/u/6281166/voxelxna6.jpg


Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox language bindings
PostPosted: Mon Jan 17, 2011 4:07 pm 

Joined: Sat Jan 15, 2011 3:49 pm
Posts: 38
Still having annoying issues with zfighting when I rotate to the back of the mesh :(. Also, for some reason volumedensity8 is giving me a SEH exception when i try to make any cubic volume less than 32 (eg 16x16x16). Any idea as to why?

edit: fixed zfighting, still haven't figured out the small volume exception, yet.


Last edited by ape on Mon Jan 17, 2011 5:49 pm, edited 1 time in total.

Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox language bindings
PostPosted: Mon Jan 17, 2011 5:14 pm 

Joined: Sat Jan 15, 2011 3:49 pm
Posts: 38
Here's a release build of what I have done so far if anyone wants to play around with it:
http://dl.dropbox.com/u/6281166/GameClientRelease.rar
:P


Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox language bindings
PostPosted: Mon Jan 17, 2011 7:22 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Right, sorry, I've been at work all day so had no chance to post...

ape wrote:
Ah. I just tried
Code:
GraphicsDevice.RasterizerState = RasterizerState.CullCounterClockwise;

in my draw routine but it still draws backwards if I don't reverse the indices :(


I know nothing of XNA, but I'll just point out you appear to be applying the proprty to 'RasterizerState', where as the snippet I posted before assigned to 'RasterizerState.CullMode'.

If you really do need to reverse the winding, then I expect it will be quicker to iterate over the array and swap the 2nd and 3rd index of each triangle, rather than reverse the whole index list.

ape wrote:
...the current annoyance is an overflow in the xna batch drawing code when i give it a large number of vertices at once (eg the result of a 64^3 volume surface extraction with holes in it). Hard to believe that generated enough vertices for int32.maxvalue.


Just to be clear, are you saying it's overflowing past int32.maxvalue? I.e. more than four billion vertices? Because that can't be right. Or you just mean it's working with 32 bits but you wanted to use 16 bits?

ape wrote:
Also, for some reason volumedensity8 is giving me a SEH exception when i try to make any cubic volume less than 32 (eg 16x16x16). Any idea as to why?


Internally the volume is stored as a series of blocks, and a volume cannot be smaller than the block size. But default the block size is 32, which is specified as a default parameter in the Volume constructor:

Code:
///Constructor
Volume(uint16_t uWidth, uint16_t uHeight, uint16_t uDepth, uint16_t uBlockSideLength = 32);


You'll need to check how this default parameter is exposed by SWIG, maybe your C# Volume has more than one constructor available or something?

I'll just note that if you are trying to make small volumes so you can tile them together, then that won't work. I can elaborate if that's what you were going to do. If not, carry on ;-)

Anyway, it looks like you've been making more great progress :-) I'll try your demo in a bit.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox language bindings
PostPosted: Mon Jan 17, 2011 7:23 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Right, sorry, I've been at work all day so had no chance to post...
ape wrote:
Ah. I just tried
Code:
GraphicsDevice.RasterizerState = RasterizerState.CullCounterClockwise;

in my draw routine but it still draws backwards if I don't reverse the indices :(

I know nothing of XNA, but I'll just point out you appear to be applying the proprty to 'RasterizerState', where as the snippet I posted before assigned to 'RasterizerState.CullMode'.

If you really do need to reverse the winding, then I expect it will be quicker to iterate over the array and swap the 2nd and 3rd index of each triangle, rather than reverse the whole index list.
ape wrote:
...the current annoyance is an overflow in the xna batch drawing code when i give it a large number of vertices at once (eg the result of a 64^3 volume surface extraction with holes in it). Hard to believe that generated enough vertices for int32.maxvalue.

Just to be clear, are you saying it's overflowing past int32.maxvalue? I.e. more than four billion vertices? Because that can't be right. Or you just mean it's working with 32 bits but you wanted to use 16 bits?
ape wrote:
Also, for some reason volumedensity8 is giving me a SEH exception when i try to make any cubic volume less than 32 (eg 16x16x16). Any idea as to why?


Internally the volume is stored as a series of blocks, and a volume cannot be smaller than the block size. But default the block size is 32, which is specified as a default parameter in the Volume constructor:
Code:
///Constructor
Volume(uint16_t uWidth, uint16_t uHeight, uint16_t uDepth, uint16_t uBlockSideLength = 32);

You'll need to check how this default parameter is exposed by SWIG, maybe your C# Volume has more than one constructor available or something?

I'll just note that if you are trying to make small volumes so you can tile them together, then that won't work. I can elaborate if that's what you were going to do. If not, carry on ;-)

Anyway, it looks like you've been making more great progress :-) I'll try your demo in a bit.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox language bindings
PostPosted: Mon Jan 17, 2011 7:55 pm 

Joined: Sat Jan 15, 2011 3:49 pm
Posts: 38
Ah okay. I wasn't providing the blocksidelength parameter (I'm stupid).
I did get the winding order fixed finally so it doesn't draw inside out anymore. Currently trying to stitch cells together (I posted the problems I'm having in the thread about seamless transitions).

The problem I'm having with an overflowed int is in this section of code in nuclex's batch primitive rendering
Code:
int indicesToProcess = Math.Min(spaceLeft, indexCount);

// Generate indices for the new vertices. This might not be faster than using
// a special non-indexed RenderOperation, but it yields stable speeds between
// indexed and non-indexed vertices and allows us to lessen the impact
// the worst-case scenario will have.
int endIndex = this.currentOperation.VertexCount + indicesToProcess;
for(int index = this.currentOperation.VertexCount; index < endIndex; ++index) {
  this.indices[this.usedIndexCount] = (short)index;
  ++this.usedIndexCount;

  int vertexIndex = indices[startIndex] + startVertex;
  this.vertices[this.usedVertexCount] = vertices[vertexIndex];
  ++this.usedVertexCount;

  ++startIndex;
}

The vertexIndex value somehow gets a value of -32767 when I try to render 47070 vertices with 282564 indices, so it generates an "Index was outside the bounds of the array." exception when it tries to read vertices[vertexIndex]. I'll try and track down the nuclex author and ask him whats going on there. It seems to be caused because one of the indices + startVertex yields -32767.

edit: fixed it. Stupid code.
Code:
int vertexIndex = (int)(ushort)indices[startIndex] + startVertex;


Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox language bindings
PostPosted: Tue Jan 18, 2011 6:25 am 

Joined: Sat Jan 15, 2011 3:49 pm
Posts: 38
http://dl.dropbox.com/u/6281166/cubicvoxels.jpg
Cubic mesh extraction is wrapped. I tried to do mesh decimation as well, but array and subarray were causing some compilation errors that I don't know how to work around.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox language bindings
PostPosted: Tue Jan 18, 2011 5:02 pm 

Joined: Tue Jul 13, 2010 8:02 am
Posts: 5
Location: Germany, Kiel
could you upload what you've done so far? or is the dropbox link up to date? i want to try it out tomorrow or the day after tomorrow :)


Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox language bindings
PostPosted: Tue Jan 18, 2011 6:04 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
ape wrote:
Cubic mesh extraction is wrapped. I tried to do mesh decimation as well, but array and subarray were causing some compilation errors that I don't know how to work around.

Nice work! Though it's strange about the Array. I just skimmed the code and the MeshDeecimator doesn't appear to use Arrays at all. Whereas the SurfaceExtractor does use them (internally, not in the interface) and that one is wrapped and working :?


Top
Offline Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 54 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  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