Page 1 of 1

(solved, now with movie!) multitexturing clouds

Posted: Fri Feb 04, 2005 7:22 pm
by snowblind
I'm trying to multitexture Earth, and I have a question about how to go about putting the clouds on top of the land. It's really just my cluelessness about the material system so far...

I found two nice textures from this website--the first and third pics in the top row are the ones I'm using.

The first picture is the land, the second is the "cloud layer." The cloud image has no alpha channel--and is just black and white.

My naive approach to multitexturing them on top of each other in one pass was this:

Code: Select all

material earth
				scroll_anim 0.0001 0
				texture earth.jpg
				scroll_anim 0.01 0
				colour_op add
				texture earthclouds.jpg
This puts the clouds on top--but there's a problem. In the "dark" half of the earth, the part NOT lit by the sun, the clouds are fully bright!

Now I understand why this is happening, but I'm not sure how I can fix it. Do I need to:

a) write a shader to to lookup the prev texture's diffuse value?
b) Photoshop the cloud layer so that it has an alpha layer?
c) open the texture as a luminence texture (does Ogre do these? I remember them in GL as a nice way to do flares and other effects)

d) or hopefully: use a different definition in my material script (!)

Here's a shot of the problem:



Posted: Fri Feb 04, 2005 8:53 pm
by Kencho
You need the photoshop option. Change the blend mode (colour_op) to alpha blend. Then, in photoshop, create an alpha channel from the colour channel, and then fill the colour channel with flat white. This will do the same at first sight, but it now receives light without losing transparency ;)

Posted: Fri Feb 04, 2005 9:23 pm
by Goosey
Woo please post a video of it in action, that is one nice looking earth, even with the 'darkside issues'!

Posted: Sat Feb 05, 2005 5:53 am
by snowblind
Thanks Kencho, that was exactly what I needed!

It took some working to figure out how to get those channels swapped in Photoshop :)

If anyone's interested, the colour op line now looks like this:

Code: Select all

colour_op_ex blend_texture_alpha src_diffuse src_current
And the result is quite a nice looking earth! Here's a small DivX movie showing it off...


...but it's far from finished! I need (at least) two more elements to make it look REALLY nice. First--atmospheric glow. My first stab at it is just going to be to whip up a glow in Photoshop and put it onscreen as a billboard. If that doesn't work I know there are some ray scattering techniques out there that are a little more expensive but visually pretty nice.

And second, is specularity for the water (maybe). I don't really know though--is there even any real degree of specularity on the ocean's surface when viewed from space? I'll have to do some experimenting.

Posted: Sat Feb 05, 2005 11:19 am
by Goosey
Wow snowblind that looks really nice. It is advancing excellently!

I did some google search, and to answer your question about if oceans have a specularity from space: it doesn't seem like it. It might look cool to put it in anyway though. ;)

Might I suggest: Take a stab at animating the cloud-cover. That seems to me like the best change you could do, although I understand the inhernt difficulty in that off of such a nice high-resolution source. ;) Good luck!

Posted: Sat Feb 05, 2005 1:23 pm
by Kencho
Cool pic. I have some suggestions:
- Reduce the ambient color to pure black. The light casted on the earth from the back side is almost null ;)
- For the glow, the first working thing you should try is the billboard. Easy, fast, really low performance cost, and nice effect (unless you need to change the colour...)
- Add another channel for the city lights for the dark side. You'll have to play a lot with blending modes to get the effect, but could be cool!

Posted: Sat Feb 05, 2005 10:11 pm
by snowblind
Billboard glow is in, and ambient color is pure black. I'm still not happy though--its going to be a pretty major element in the backdrop for an epic space battle!--so I'll look at some other techniques.

I know I had a hard time finding code for generating the sphere with shared vertices and getting the tex coords to look right--so I put my finished code up in the CodeSnippits section of the Unofficial Ogre Wiki. Hopefully some others can find it useful too.

More to come soon!

Posted: Sat Feb 05, 2005 10:38 pm
by Goosey
Kencho wrote:- Add another channel for the city lights for the dark side. You'll have to play a lot with blending modes to get the effect, but could be cool!

I just wanted to second this oppinion. This would look so awsome :)

Posted: Sat Feb 05, 2005 11:48 pm
by Kencho
snowblind, if you just want to use it as an scenario for epic space battles, then just look for a more artistic depiction, rather than a realistic one. After all, that should look cool! So begin looking for nice nebulas and starfields for the deep space :)

Posted: Sun Feb 06, 2005 3:41 am
by Fredz
snowblind: I did some searches in the past about texture mapping on spheres and came up with the following links. I guess it's a bit too late now, but here they are anyway :

Parametric Equation of a Sphere and Texture Mapping ... spheremap/

Spherical Projections (Stereographic and Cylindrical) ... spherical/

Spherical Textures

[Request for help] Texture mapping an icosahedron ... _id=116339

[Request for help] Texture mapping a subdivided icosahedron ... _id=116312

Posted: Mon Feb 07, 2005 5:31 am
by TobascoSpam
Hey I've got a map of the earth at night on my pc if you care for it, put an email address down and I'll send it to you, if you need it. Nice work btw. Are you going to do a bump map for the mountains too? I know the guys at have something similar to this.