Jump to content

Streaming Voxel Terrain


SpiderPig
 Share

Recommended Posts

Been working on streaming voxel terrain and I'm pretty happy with the results so far.  Nearly completed the streamer class.  Each tile below is a 1024x1024 r16 heightmap.  The area in view is about 50km2.  The red tiles are tiles I've removed from the dataset because each pixel in those maps are zero (below the water surface).  The test data set I made is a grid of 120x120 tiles which was 14,400 heightmaps files.  However after removing all the tiles that were of zero height it became about 5,600 tiles.  About 10GB all up.  Should be able to compress that in a zip but will need to do more testing yet... was giving mixed results.

StreamingVoxelTerrain.thumb.png.bfbab3d3b9b326df2b436cc985f2b653.png

StreamingVoxelTerrainWireframe.thumb.png.50dfe49673306c81339aa2fd7c688963.png

Simple to set up. :D

void CreateStreamingVoxelTerrain() {
	voxel_brush = CreateVoxelBrush();
	voxel_brush->SetSurfaceFunction(CalculateTerrainSurface);

	voxel_world = CreateVoxelWorld(world, 1024, 16.0f, 7);
	voxel_world->EnableStreaming(true, "Maps\\Data");
	voxel_world->SetDimensions(490000.0f, 1617.0f, 490000.0f);
	voxel_world->FlipY();
	voxel_world->AddBrush(voxel_brush);
	voxel_world->AddObserver(camera);

	voxel_world->DrawVoxelObjectBounds();
	voxel_world->DrawPatchBounds();
	voxel_world->DrawBounds();
}

 

  • Like 3
Link to comment
Share on other sites

Took a few days but I now have high res normal maps generated on the fly as patch's of real-world heightmap data are streamed in.  Need to get multithreading working now as its a bit slow.  Materials are painted based on slope in the shader.  Still loads of work to do there too.

StreamingVoxelTerrainNormalMaps.thumb.png.da5281cb639d23aae83aa4d710205d9e.png

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...