Volumes Of Fun
http://www.volumesoffun.com/phpBB3/

uint8_t and density
http://www.volumesoffun.com/phpBB3/viewtopic.php?f=2&t=351
Page 1 of 1

Author:  nicoo [ Mon Apr 02, 2012 1:29 pm ]
Post subject:  uint8_t and density

hi dudes! what's up?
I played with polyvox lastnight... yep no gf... I never saw/used uint8_t type before, what it is his min/max value ? what's the reason of it use ?

I also played with libnoise to generate coherent noise, libnoise gives a double value between zero and one.

how can I use this double value for the density ?

another question, the density have to be zero or max only ? is there a reason to have the mid value for example ? because I can't imagine how ogre/opengl can deals with that, to build the mesh.

Author:  David Williams [ Mon Apr 02, 2012 2:22 pm ]
Post subject:  Re: uint8_t and density

Firstly I'll assume you are using the last stable snapshot, because the current Git version is undergoing some changes in this regard.

uint8_t is an 8-bit unsigned integer, with a range from 0 to 255. If you have a double in the range 0.0 to 1.0 then you can convert this to uint8_t by multiplying by 255 and then casting to uint8_t. Note that the multiply must come before the cast!

In the last stable version it is difficult to use the doubles directly, but this will change soon.

I assume you are using the marching cubes surface extractor (rather than one of the cubic ones) in which case the middle values are indeed useful. They basically make sure the terrain appears smooth.

Author:  nicoo [ Mon Apr 02, 2012 3:58 pm ]
Post subject:  Re: uint8_t and density

I don't have the current GIT for sure, I still have the one I compil several weeks ago.

If uint8_t go from 0 to 255 I'll do what you said, multiply by 255

Quote:
Note that the multiply must come before the cast

ok

Quote:
I assume you are using the marching cubes surface extractor

i'm using PolyVox::SurfaceExtractor.

thank you for your help!

Author:  nicoo [ Mon Apr 02, 2012 4:16 pm ]
Post subject:  Re: uint8_t and density

AWESOME!!!!
Image
Image
Image

Author:  David Williams [ Mon Apr 02, 2012 7:19 pm ]
Post subject:  Re: uint8_t and density

Well that's satisfying, glad you got it working so easily :-)

Author:  nicoo [ Mon Apr 02, 2012 8:34 pm ]
Post subject:  Re: uint8_t and density

David Williams wrote:
Well that's satisfying, glad you got it working so easily :-)

yeah, we should say that you guys make a good work.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/