HeightFieldShape resolution power of 2 #400
-
There is something i'm a bit confused on regarding HeightFieldShapes. The comments state "inSampleCount: inSampleCount / mBlockSize must be a power of 2 and minimally 2.". I was thinking that the sample count would need to be (inSampleCount-1) / mBlocksize as a power of 2 so that it would always be an odd number of points for subdividing up the heightmap. (Ex. with a blocksize of 2 and a resolution of 65x65 I would expect to get (65-1)/2 = 32 which is a power of 2 and would give me a field of 64x64 squares.) Am I misunderstanding something or is it not possible for me to generate a HeightFieldShape object that would represent the space of 64x64 squares and contain a resolution of 65x65? The comment gives me the impression that I would need to create a HeightFieldShape with a resolution of 64x64 which would yield me a grid of 63x63 squares. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
The number of samples needs to be a power of 2, so if you create a heightmap of 64x64 samples this gives you 63x63 squares. Note that you can apply any scale to the heightmap, so you if you want it to span 64x64 meters you can do so. The reason for this is that the heightmap in our case is also used on GPU as a texture so must be a power of 2 and we stretch it so that it fills a power of 2 meters. |
Beta Was this translation helpful? Give feedback.
The number of samples needs to be a power of 2, so if you create a heightmap of 64x64 samples this gives you 63x63 squares. Note that you can apply any scale to the heightmap, so you if you want it to span 64x64 meters you can do so.
The reason for this is that the heightmap in our case is also used on GPU as a texture so must be a power of 2 and we stretch it so that it fills a power of 2 meters.