Level of Detail Part 3

By
Dave
Project
Published
5 Nov 2011 17:54
Last Modified
13 Jan 2013 17:39

I described in Part 1 and Part 2 the basis of an approach for a planetary renderer with Level of Detail (LOD) support, and I've been working on integrating this into the project, as shown below in Figure 1.

LOD tiles

Figure 1. Level of Detail (LOD) tiles for Earth and Moon.

I previously thought that my background process for loading LOD textures was not locking the rendering loop, however it turns out this was not the case it was using Texture2D.FromFile to load a LOD texture which locks the GraphicsDevice1.

I therefore needed to minimise the time spent loading textures, and tried the following:

Content Pipeline

Running some LOD tiles for Earth through the Content Processor. L0-L5 tiles for texture, specularity, normals and clouds (10,920 files) took just over 48 minutes to process on my machine, not a problem given that I only needed to do this once. However, it resulted in 10.6Gb of .xnb files wasn't a practical approach nor significantly reduced lock time on the GraphicsDevice.

HTM and TOAST

Switching from an equirectangular to a Tessellated Octahedral Adaptive Subdivision Transform (TOAST) projection, as I descibed previously, provides a more even coverage of texture tiles across the surface of a sphere, thus minimising texture loads. Pressure on IO was further reduced by using smaller tile sizes (256px square).

Background Image Loads

Loading image data on a background thread can be done independently from the GraphicsDevice. The data can then be set on a Texture2D from memory, locking the GraphicsDevice for minimal time. I load the System.Drawing.Bitmap as follows:

int[] pixels = new int[256 * 256];
using (Bitmap bitmap = (Bitmap)Bitmap.FromFile(path))
{
   // PixelFormat.Format32bppArgb
   BitmapData data = bitmap.LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);

   // copy bitmap data into buffer
   System.Runtime.InteropServices.Marshal.Copy(data.Scan0, pixels, 0, pixels.Length);

   // unlock bitmap data
   bitmap.UnlockBits(data);
}

I can then use Texture2D.SetData(int[] pixels) to create the texture.

Loading images in this way currently provides an acceptable lock time.

1 See Shawn Hargreaves' blog entry on Lock contention during load screen animations

Comments

By
Anthony Robinson FCMI
19 Apr 2012 11:34
Dave, one of my colleagues pointed your NUIverse out to me and suggested that you and I should get together. He thought there might be synergies. Please take a look at www.et3.com This is the public website of Evacuated Tube (ETT) and Evacuated TubeTransport Technologies (ET3). ET3 - the company and patent - is owned by Mr Daryl Oster in USA. The organisational structure is a consortium of licensees at present as it is not yet invested with venture capital.,
I am a licensee and on the advisory board as a strategist.


regards,
Anthony Robinson
e mail: info@yorkrise.co.uk
Linked In: Anthony Robinson FCMI
telephone (UK) 07906 181 348
www.yorkrise.co.uk

Add Comment

*
*
*
Captcha
*
*Required