• Advertisement
  • entries
  • comments
  • views

Planet texturing

Sign in to follow this  


Missing the atmosphere. I'm currently playing with the parameters, contrasts, and trying to improve the clouds (they look good in a separate texture but i'm not satisfied when they're applied to the planet). No fancy shader yet (per pixel lighting, bumps, specular, etc.. to come).

Sign in to follow this  


Recommended Comments

How are you going to implement the atmosphere effect? I tried looking at that atmosphere demo, but as I told you it was too slow in C#.

So i was experimenting with another kind of solution.. it's not a mathematical approach.. well it's more of an hack but it seems to work :)

I thought that by applying an "edge glow" postprocessing effect I could achieve that kind of effect. The only problem was that by using a normal edge detect filter, the lightning would not be taken into consideration so the "glow" would be always active, even when parts of the planet are not lighted.
So I thought of applying a color edge detect filter on a diffuse-shaded sphere having the same size of the original planet and rendered in the same location, so that the color edge detect would only find the part of planet's outline that were lighted and not be "disturbed" by the planet's texture.
Then I downsampled the resulting outline, applied the bloom effect and composited it with the original image.

The resulting effect is shown here (I've not yet implemented it, I was experimenting it using Rendermonkey):

I'm not entirely satisfied with it, especially with the second image where the planet is not fully lighted, so I was wondering if you were taking some other approach.. :)

Share this comment

Link to comment
Well, my approach will involve Rayleigh and Mie scattering (see ATI's paper and demo). The hard part is actually to take into account the air density, because the paper assumes the viewer's always at ground altitude, but in reality air density is a function of altitude. I have some ideas which involve lookup tables and CPU updates, but i've yet to experiment them.

Your screen-space trick is nice but could be improved. Earth atmosphere is a lot thinner than that, and it should also affect the pixels of the planet, not only the countour. Correctly calculating the air density along a pixel's view path involved an integral and casting a ray through a sphere, but i'll obviously choose a more simple approach.. as long as it looks good, it's good enough for me.

Edit: Sean O Neil has an article here on gamedev, but i'll try to find an alternative that uses less CPU/GPU power.

Share this comment

Link to comment
That image of your planet is pretty sweet.
Your texture generation routines do a pretty nice job.

Concerning the atmosphere:
It all seems to work pretty well if you simplify each integral by taking the midpoint rule,
i.e. int_a^b f(x) dx = (b-a) * f((a+b)/2)
That reduces all nasty nested integrals to one function call.
It does a very good job when flying into the atmosphere - you get a very smooth transition.
It has some problems when the ray through the atmosphere is very long (i.e. dusk/dawn). Inscatter is too red, then.

I've implemented the ATI stuff in a vertex shader, so all computations are on the GPU. It looks like this:

Share this comment

Link to comment
Really great stuff! Did you look at Eve Online? Their programmers will soon need to find another job, I'm afraid :D

I have some questions about this kind of effect. I've had a look (albeit superficial) at the paper (the math is somewhat "obscure" to me.. :) ) but out of curiosity I would like to know some things:

I've found here on gamedev (in this thread) a shader implementation of this effect. But it is not entirely clear to me how this shader is used. I suppose it is applied on a skybox-face.. is that correct? And can the same shader be also used to model the atmospheric light scattering from out of space?

I looked at the demo's code, at the atmosphere class in particular. There is the CalculateScatteringConstants, but it seems that the multiplier constants only matter when interpolating between atmospheres (argh the horror! the "+" and "*" operators of the atmosphere are overloaded :D).. So are those parameters (betaR, betaMie, betaDr, etc.) always the same?
I would like to learn about this, because if that shader can also be used to model outer space light scattering I could try to adapt it to my game, if it not too complicated.

My goal is to achieve an effect that in terms of gameplay and usability (I know, I became an academic!) conveys information to the user. If it is 100% physically correct but too subtle to detect then maybe it's not the right choice. If on the other hand it is more noticeable the goal is achieved (IMHO). For example by looking at a planet with a red atmosphere the player might easily recognize that its atmosphere is "toxic" (I'm developing a Master of Orion game) and so on. If it is too subtle this information may be lost.

Anyway, thanks for the tips Ysaneya, I had forgotten about that.. Unfortunately these days I rarely get out of space :D If I can't implement that kind of light scattering in my game I'll try to improve the screen-space effect.

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement