Sky - Color gradient

Hey guys, :slight_smile:

I was trying to create a sky using a simple color gradient. I thought, this shouldn’t be too difficult, but none of the topics I found, helped me:

Deprecated API => https://wiki.jmonkeyengine.org/legacy/doku.php/jme2:skydome

Background was fixed (using a quad in the sky bucket) and didn’t look nice => http://hub.jmonkeyengine.org/groups/general-2/forum/topic/background-gradient/

…



I saw this screenshot of Mythruna, so it should be possible:

http://www.mythruna.com/mediawiki/images/c/ca/Main1298619562917.png



What is the easiest way to generate a color gradient sky?

(Of course, I could use a texture, but the best would be a dynamical solution :smiley:

(Because I’m planning to change the sky’s colors according to the daytime :))
)

Maybe it’s possible with a shader, but I’m toally new to shaders and I fear, this would be too difficult for me. :wink:



destro :slight_smile:

dynamically change a texture :wink:

:smiley: That should be a way, right.



Do you mean to directly “change” the texture image’s data like:

[java]texture.getImage().getData()[/java]



Or is there an easier way to apply color changes to a texture? To be honest, I have no idea, where to start at this point. :smiley:

Mythruna uses one very special texture and some texture coordinate tricks… and hours and hours and hours of tweaking.

You can already convert any buffered image into a jme texture with :



http://hub.jmonkeyengine.org/groups/contribution-depot-jme3/forum/topic/texture-generation-bufferedimage-image-utilities/



and you are lucky in already has the gradient method you ask.

First time i saw somebody with 2 logins :roll:.

i have my passwords/emails stored in my main computer, and since now i am on vacation i wont be able to access it.

@tralala2

Oh, thanks. I’ll look into it today. :slight_smile:

(I meanwhile succeed by using a sphere with generated vertex colors. Looks very clean and can be easily changed via code :slight_smile:)



An other little question related to this sphere: Does anyone know how to deactivate the camera frustum for it? I would like to have a frustum, because my world has a lot of objects, but the sky is far away, so that it’s beeing culled from the view.

Even placing the sphere in the sky bucket, setting it’s cull hint to Never, updating it’s model bound to infinity and so on as it’s described in the existing threads doesn’t help. :frowning:

I found out, that the behaviour of the standard sky (that is never culled) has something to do with the Sky material, but this material doesn’t support vertex colors… :frowning:

You cant set camera frustnum too big (more than 1000f) or too small (less than 0.1f), because it will start losing its accuracy from what i heard.



for my “sky / clouds” :

  1. i move it to camera position every simpleUpdate().
  2. it is big ( size = 300f - 400f )
  3. i dont use sky bucket, or anything special.

Yes, this seemed to be best solution for me, too. I was just wondering, if there was another “more performant” way. :slight_smile: