Page 1 of 5

Gas Giants

Posted: Tue Jan 07, 2014 10:33 pm
by FluffyFreak
How did it get to 22:30 already?

Nevermind!

Been thinking about Gas Giants and how our rendering / data generation for them is rather lacking.
I'd like to improve it but I don't really want to touch the GeoSphere stuff with a barge pole right now.

One reason for this is that it's been bent to the purpose of displaying *something* for Gas Giants but it's not at all appropriate.
We don't need the continuous refinement and quad tree complexity or threaded jobs generating it all.

All we really need from a distance is a decent, updating, texture map and the information that goes into deciding the planets bands / storms / clouds etc.
We could try implementing something like the INRIA link for cloud layers too, but honestly it might be pushing my skills a little bit :)
Once you get closer we sample that information and use it for 3D clouds - Similar to how X-frontier has it implemented.

So some resources:
Gas Giant texturing:
http://johnwhigham.blogspot.co.uk/2011/ ... iants.html
http://jwhigham.wordpress.com/2010/05/2 ... the-issue/

Clouds:
http://www.gamedev.net/page/resources/_ ... ting-r2273
http://hal.archives-ouvertes.fr/inria-00402100_v1

I have a branch where I'm trying to split things up so that we can use a GeoSphere or an alternative for Gas Giants.

As a side note this means that later on we can add a 3rd type for the new way of doing planets I've been thinking aloud about it the terrain topic (http://pioneerspacesim.net/forum/viewto ... 3&start=20)

...now I just need an extra 1000 hours per day!

Re: Gas Giants

Posted: Wed Jan 08, 2014 10:41 am
by FluffyFreak
Since I'm currently getting latest on 38909 files it seems I have a moment to type some more on this...

Unlike John Whighams approach I'm still planning on rendering a mesh for the cloud "surface".
This is because we have an actual atmosphere shader and mesh to render over the top of it all so we want to get down into the clouds themselves not just to the "surface" of the clouds.
This is much more like how the guy from X-Frontier says he's doing his gas giants and I think it's a reasonable approach to start with.

I'm sure we could do something much more complicated later on, I have ideas for how to spread voxels of clouds around based on large scale volume structures and animate them etc, but that can all wait until after the basics are in place.

Groundwork:
1- split out the dependency on GeoSpheres,
2- write an alternative that uses a fixed surface mesh and texture mapping,
3- generate a simple banded texture map to apply to the above mesh,
4- perturb the banded texture using noise - can be baked to texture or done at runtime?
5- add in cyclones based on Voronoi or other distribution on a sphere,
6- update texture(s) regularly based on time (change is very slow, but we have time acceleration1),
7- 3D cloud sprites perhaps using fixed/precalculated sets of cloud blocks to lower runtime cost? (experimentation needed),
8- review and adjust future plans!

Which sounds sane to me.

Re: Gas Giants

Posted: Sun Jan 12, 2014 10:43 pm
by FluffyFreak
Made progress on step 1 through 3.
Needs support for cube maps in the engine though so my branch has to pull in the SpaceBox https://github.com/pioneerspacesim/pioneer/pull/2570 branch too - I could do with that reviewing at some point not just because it's cool but also because I'm actually using cube map textures for the gas giant work and eventually the new terrain system.

Re: Gas Giants

Posted: Thu Jan 23, 2014 9:37 am
by FluffyFreak
I have it generating the cubemap textures using our existing terrain system right now, only problem is getting them to actually update the cubemap itself!
When dumped to disk they look perfect but there's something screwy going on with either the cubemap setup or the calls to update each face.

Still, progress is progress!

Re: Gas Giants

Posted: Fri Jan 24, 2014 10:40 am
by FluffyFreak
Last night I got this generating a continuous cubemap texture for the gas giants at a fixed target resolution without mipmaps.
The code is on my branch https://github.com/fluffyfreak/pioneer/ ... iant_split but is completely work in progress ;)

The system just uses the existing gas giant terrain colour generation system, is single-threaded etc.
What it produces is identical to a high orbit view of the existing gas giants, but possibly upside-down... small bug on my part, I might need to flip the texture generation algorithm.
Or I might just replace it entirely since I'm only using it to prove the concept right now and there's no point fixing something I'm going to throw away!

This gets me through stages #1 and #2.

Stages #3 to #5 are all about generating the texture(s) on the GPU using rendertargets, textures and shaders.

Re: Gas Giants

Posted: Fri Jan 24, 2014 10:53 am
by robn
Good stuff mate. Just so you know I am quietly following along at home, I just have nothing to add right now :)

Re: Gas Giants

Posted: Fri Jan 24, 2014 11:01 am
by FluffyFreak
That's ok, I'm just using this thread as a bit of a diary to help me keep track of where I am/was and any decisions I make.
It might help me write it up later for a blog post or as something to refer to jog my (absolutely terrible) memory.

Re: Gas Giants

Posted: Mon Jan 27, 2014 10:53 am
by impaktor

Re: Gas Giants

Posted: Mon Jan 27, 2014 12:20 pm
by FluffyFreak
I think that's a bit ambitious for me :)
I'm just updating the rendering a bit and feeling my way around some texture generation.
I might try for some primitive cloud rendering as said above but it will only be a vague attempt.

Re: Gas Giants

Posted: Sun Feb 02, 2014 4:25 pm
by FluffyFreak
For #3..5 I've decided to try generating / deforming the texture in realtime first.
So I generate a banded 2D texture on the CPU, then set this and sample it on the GPU, next I apply some noise from an open source GPU noise library that I've integrated.
It's fun but I'm nowhere near getting usable outputs yet!

Also there are some advantages of this method:
[] Per-pixel results regardless of texture resolution,
[] Realtime deformation and updating mean we can actually update the gas giants providing realtime animation,
[] Much less texture memory,
[] No mucking around with threading generation of textures etc.