# Voxel Coordinate Conversion Issues

## Recommended Posts

ChristOwnsMe    374
So I have a Chunked LOD planet rendering system. It is rendered using 6 unit cube faces [-1,1] and then transformed to scale. The heightmaps of the patches on the planet are generated on the GPU using perlin noise. When the camera gets close to the surface, it switches from patch rendering to voxel block rendering(minecraft style). I am having a problem with noise coordinate systems. My planet contains a large cubic voxel volume of 12,000,000^3. Voxels are generated in this coordinate space.

Since the noise is generated using unit cube coordinates[-1,1], and the voxels at the surface are generated in world coordinates (voxels can be within a xyz volume of 12,000,000^3), if I have generated a mountain that I can see from space, and I zoom into that mountain, when I get close enough to the mountain and start generating voxels using noise, the voxels I am generating are at some high integer position (i.e SetVoxel(100000,100000,100000) ). The noise generated at this point is not going to be a mountain like it was for the very small unit cube position.

I hope I have conveyed the problem well enough. Thank you for any ideas/design help.

##### Share on other sites
ChristOwnsMe    374
The current solution I have is to convert my world coordinate to unit cube coordinates, then convert the mantisa of my unit cube position to an integer and then render a voxel at that position. So for instance, I generate noise at noise(.0005000,0,1), then I multiple each point by 10,000,000 to get the mantisa of the float, so .0005000*10m=5000,0,1*10m=10m, then say SetVoxel(5000,0,10,000,000). Does this solution make sense/possible?