How to create a sky with clouds floating in one direction

Hi everyone, I'm new here. I really need some help on this problem.



How do i create a sky with clouds floating in one direction.



do I need to actually generate an array of object_cloud and display the animation?



Thx!

there are so many ways of doing clouds, from volumetric cloud particles with lightscattering to impostors. do you have an idea of how you want it to look or how advanced it needs to be?



the easiest way is to have a simple textured plane and animate the texture coordinates(or use multitexturing with several cloudtextures to get a bit less ugly look)



a quick google on "cloud rendering" or so would get you lot of hits.

You might also consider a skydome + texture translation

thx alot, ill check out some of the articles on google first.



but basically i wanna create a skybox, and then there's a sea of clouds floating at the bottom. kind like what u'll c when u r in an airplane.



im thinking texture translation would be good enough. is there any tutorials that i can follow?



thx


import com.jme.app.SimpleGame;
import com.jme.image.Texture;
import com.jme.math.Vector3f;
import com.jme.scene.Controller;
import com.jme.scene.shape.Quad;
import com.jme.scene.state.TextureState;
import com.jme.util.TextureManager;

public class TestTextureTranslation extends SimpleGame {
  private static float TRANSLATION_STEP = .0005f;
 
  @Override
  protected void simpleInitGame() {
    Quad quad = new Quad("Q", 20f, 20f);
   
    final Texture texture = TextureManager.loadTexture(this.getClass()
        .getResource("jmetest/data/texture/clouds.png"), Texture.MM_LINEAR, Texture.MM_LINEAR);
    texture.setWrap(Texture.WM_WRAP_S_WRAP_T);
    texture.setTranslation(new Vector3f());
   
    TextureState state = display.getRenderer().createTextureState();
    state.setTexture(texture);
   
    quad.addController(new Controller() {

      @Override
      public void update(float time) {
        texture.getTranslation().x += TRANSLATION_STEP;
        if (texture.getTranslation().x >= 1f) {
          texture.getTranslation().x = 0f;
        }
      }
     
    });
   
    quad.setRenderState(state);
    rootNode.attachChild(quad);
  }
 
  public static void main(String[] args) {
    TestTextureTranslation app = new TestTextureTranslation();
    app.start();
  }

}

Probably better if:

texture.getTranslation().x += TRANSLATION_STEP;



were:

texture.getTranslation().x += TRANSLATION_STEP * time;

and in that case



if (texture.getTranslation().x >= 1f) {

  texture.getTranslation().x -= 1f;

}



otherwise you'd get a jerky motion…

you're both right.

if you just quickly throw some lines of code together you can't expect optimal results :stuck_out_tongue:

ALL code NEED to be PERFECT when posting!!!



kidding i couldn't have thrown it together better myself…that's what's good about a forum, other people can fill you in :wink:

wow, u guys r great!



thx so much for ur help.

sry about all the stupid questions, im still a newbie  :smiley:



how do i attach this textture translation to the skybox.



if i follow the code example sefera gave, after i rotate the camera, the texture cannot fully cover the entire sence anymore. how would i go and solve this?

did you tried this:



myTexture.setWrap(Texture.WM_WRAP_S_WRAP_T);



???
Landei said:

did you tried this:


myTexture.setWrap(Texture.WM_WRAP_S_WRAP_T);



???


yeah its in the example code

i'm not sure i understand your problem

em, this is what im planning to do.



i want to create several trimeshes, and load clouds models onto these trimeshes.

then i just do a localtranslation on all these "clouds" and when they float to a far enough distance that the user cannot c them anymore, ill reset their positions to the origin and keep doing this loop.



will this be a possible solution?



whats the downside about this and whats the good thing about this, if this solution actually works? i really wanna hear u guys opinions.



thx~

it really depends on how your clouds should look like and how many you will have.

it also depends ho what type of game/application you are making.



as mr coder said there are so many ways to make clouds. you just have to decide how your sky has to look like.

the downside of having cloud models is that usually you would need quite some geometry to make them look good. if you have many clouds on the screen that could sum up to quite a bit of geometry (and that only for the sky - but again, it depends how important clouds are in your app). also it's a known fact that clouds tend to stay quite long in the view if you have a low horizon :wink:



many cloud techniques use impostors for performance.

you should really google a bit about cloud rendering techniques. they're quite interesting.



http://vterrain.org/Atmosphere/Clouds/