Author Topic: Atmosphere  (Read 939 times)

Offline osamoelle

  • byte
  • *
  • Posts: 4
    • View Profile
Atmosphere
« on: October 09, 2013, 12:18:05 am »
Hello,
At first, thanks a lot for this very usefull library!
I'm trying to create an atmoshpere around planets.
To do that, I put a sphere around another slightly smaller with a transparent texture. But the largest sphere is not visible on the side of smallest sphere as i was hoping.
I tried different value of transparency, size, culling mode, etc... outside of the smallest sphere, the side of largest still invisible.
Do you have any idea how to do this ? what I'm doing wrong ?

Thanks a lot !

Some code:
Code: [Select]
        Object3D planet = Loader.loadASC(new FileInputStream("res/meshes/sphere.asc"), (float) planet_radius, true);
        Object3D atmo = Loader.loadASC(new FileInputStream("res/meshes/sphere.asc"), (float) planet_radius, true);
       
        atmo.rotateX((float) (Math.PI/2));
        planet.rotateX((float) (Math.PI/2));
       
        atmo.setOrigin(new SimpleVector( center[X], center[Y], center[Z]));
        planet.setOrigin(new SimpleVector( center[X], center[Y], center[Z]));
       
        atmo.scale((float) atmo_radius);
       
        atmo.setTexture("atmo");
        atmo.setSpecularLighting( true );
        atmo.setCulling(false);
        atmo.setTransparency(0);
        atmo.setTransparencyMode( Object3D.TRANSPARENCY_MODE_ADD);
        //atmo.setAdditionalColor(255,255,255);
        planet.setTexture( textureId );
       
        planet.build();
        atmo.build();
        planet.addChild(atmo);


[attachment deleted by admin]

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Atmosphere
« Reply #1 on: October 09, 2013, 07:22:49 am »
Sorry, but i don't get the problem. The screen shot looks fine to me. What am i missing?

Offline osamoelle

  • byte
  • *
  • Posts: 4
    • View Profile
Re: Atmosphere
« Reply #2 on: October 09, 2013, 09:26:58 pm »
Sorry.
You can find 2 new attachments.
'Atmo_explain.jpg' is what I try to get. With two spheres, 1 is the smallest, 2 is the biggest. I put some texture on the sphere 1 and a transparent one on sphere 2.
Like the sphere 2 is biggest, i was hoping that the texture beyond the perimeter.
I try to draw on the sample that you can see into the file 'atmosphere2.jpg'.
I will certainly make a mistake somewhere.
Thanks a lot for your help.

[attachment deleted by admin]

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Atmosphere
« Reply #3 on: October 09, 2013, 09:34:40 pm »
I see....and i don't see what's wrong in your code unless you specify 1 for

Code: [Select]
atmo.scale((float) atmo_radius);
What's the actual value of atmo_radius?

Offline osamoelle

  • byte
  • *
  • Posts: 4
    • View Profile
Re: Atmosphere
« Reply #4 on: October 09, 2013, 09:50:41 pm »
Today, value is:
 double atmo_radius = planet_radius * 2f;

When i removed theses lines:

        atmo.setTransparency(0);
        atmo.setTransparencyMode( Object3D.TRANSPARENCY_MODE_ADD);

I got this (see file)

Maybe my problem come from my skydome ? I have a huge sphere around with disabled culling and texture.

[attachment deleted by admin]

Offline osamoelle

  • byte
  • *
  • Posts: 4
    • View Profile
Re: Atmosphere
« Reply #5 on: October 09, 2013, 11:18:28 pm »
I am awfully sorry I found the source of my error. My sky dome rendered after the rest of the world. Now everything works.
Thank you very much and I apologize for the inconvenience.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Atmosphere
« Reply #6 on: October 09, 2013, 11:35:08 pm »
...Whatever.... ;D I'm glad that you've solved it.