Saturday, September 5, 2009

MyFirstPlanet Video

Here's the first video showing the planet with textures and atmosphere shader. I used fraps (windows only) and recorded it while running in OpenGL mode. DirectX would probably be smoother but I haven't ported the shaders to HLSL yet.

My First Planet - Work In Progress - Ogre3d Engine from petrocket on Vimeo.



Now I'm still working on a simple way to pull terrain patch textures and normal maps from the disk when they're available instead of creating them on the fly - this way I hope to be able to modify the diffuse textures and customize the planet (so easy to say, so hard for me to do).

My first idea is to create a resource pool for the terrain patch diffuse images and normal map images and then load files from disk into those resource pools as need from the build thread. Not sure if this will work well enough because it may just not be loading enough images in advance to keep ahead of demand.

I should probably create a second thread that is a low priority thread with an entirely different quad tree based on the camera position in the future (assuming the user keeps moving in the same direction). I could update this quad tree and load images for this future position when the real camera position based quad tree isn't updating/building (and when would that be???)

5 comments:

Tretle said...

open source

petrocket said...

it will be

Anonymous said...

I find this very interesting, open source or not, so I hope you'll tell us more about your journey :)

Eggsworth said...

Hello. I am attempting to accomplish a similar project in java using the JMonkey Engine.

I have a question, in regards to your vertex normals.

For my implementations, using blocks of size 33 x 33, it can take my program 200-300 milliseconds per child of the parent chunk (so 800 - 1200 milliseconds) per split to calculate vertex normals.

I am just curious, are you generating these vertex normals on the cpu, and if so, is the process multithreaded?

How long does it take you to produce your vertex normals?

Thank you very much!

alex peterson said...

I am using the CPU to compute vertex normals and it does take roughly 200-300 per 33x33 patch, but that was before using OpenMP threading and running the build process in the background thread - where it actually takes longer, but is not as noticable.

Currently I just calculate 6 1024x1024 vertex height maps and normal maps and then write them to disk. This handles the first few levels of the planet, and then after that you can switch to generating 33x33 patches on the fly. Either way, I recommend experimenting with caching multiple patches to disk and reading them back in via background thread.

Please read Steven Witten's article on normal map generation for the most efficient/quick way to generate planet normals I know of.