Earth Atmosphere, Strange problem

Hi all,



I was pointed to this project http://www.stardust.ch which has a lot of example code since I am building a simple shooter for my uni project. However, I was implementing my own earth atmosphere but couldnt get it to work. Strangely, using the planet described at that site gives me the same problem! :S



This is how it looks:







The code is exactly like this:



http://www.stardust.ch/bugs/browser/branches/milestone-0.2/src/scene/PhysicsPlanet.java



And this is how I instantiate, also totally similar to the code from stardust to check whether I am doing something wrong. But it still renders white.



private void initPlanets(){
       
        Planet m = new Planet("Planet",getPhysicsSpace().createDynamicNode(),40,40,300,new Vector3f(50,20,300),TextureLoader.LoadTextureState("file:/c:/earth.jpg"));
               
          //      20,new Vector3f(0,0,-40),TextureLoader.LoadTextureState("file:/c:/earth.jpg"),getPhysicsSpace().createDynamicNode());       
        //Planet b = new Planet(300,new Vector3f(50,20,300),TextureLoader.LoadTextureState("file:/c:/earth.jpg"),getPhysicsSpace().createDynamicNode());       
        this.rootNode.attachChild(m.getPhysicsNode());
        //this.rootNode.attachChild(b.getPhysicsNode());
       
        this.rootNode.attachChild(m.getAtmosphere());
        //this.rootNode.attachChild(b.getAtmosphere());
         rootNode.updateRenderState();
        rootNode.updateGeometricState(0, true);
                     
    }



What is going on here?
Regards,
Frank

i am afraid a simple transparent sphere does not look very good as a atmosphere.

if you want a really nice looking planet you need to use use a shader, something like this one here:

Procedural planet generator

or this:

Sky scattering in jME




The problem in your screen shot is that you don’t have a AlphaState or a AlphaState with incorrect values for src/dst functions. I had to play with the Alpha/MaterialState a lot to get an ok looking atmosphere from a simple transparent sphere.

Well it wont be the pretty but its for a simple uni project :slight_smile:

One thing though,



How come his code does work and it doesnt work on my pc? Or wasnt it supposed to work in the first place and is it defunct?

The code is working (for me atleast :)).

What i initially did is set up keys to alter the src and dst functions of the AlphaState to get the correct settings.



My input action was somehting like:



AlphaState as = (AlphaState ) atmosphere.getRenderState(RenderState.RS_ALPHA);
as.setDstFunction(as.getDstFunction()++);
// same for SrcFunction
atmosphere.updateRenderState();



Then play with the values till you get an acceptable result.

Or even better create a swing dialog to easily alter such settings like the ShadowTweaker in flagrushtut.lesson9.

Hey Core-Dump,



How did you manage to do it? Even when I try to fill in values I either get a strange colour on the outside of the sphere and inside remains white. I am getting totally frustrated, it seems so simple and yet I cant get it to work, even using the exact code your using :S Aaargh…



Help help!

Regards,

Frank

:slight_smile: as i said, i just switched through every possible combination of src and dst functions and took what looked best for me.



But i just stole Anykeyh’s atmosphere shader and i’m trying to put together a simple example right now.

I think thats the way to go, to get a nice looking earth.

Anykeyh used 3 shaders to get his awsome looking Planets, but one will do for us.



Its still buggy now and seems to produce different results on nvidia and ati cards.


Sounds cool, I loved the other shaders.



And! I found the solution to my problem, I did not have any lightnodes in my scene. Without one, it wont render.