(solved, now with movie!) multitexturing clouds

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
snowblind
Gnoblar
Posts: 14
Joined: Tue Jan 25, 2005 5:51 am
Contact:

(solved, now with movie!) multitexturing clouds

Post by snowblind » Fri Feb 04, 2005 7:22 pm

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
{
	technique
	{
		pass
		{
			texture_unit
			{
				scroll_anim 0.0001 0
				texture earth.jpg
				
			}
			texture_unit			
			{
				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:

Image

Thanks![/code]
Last edited by snowblind on Sat Feb 05, 2005 5:54 am, edited 1 time in total.
0 x

User avatar
Kencho
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4011
Joined: Fri Sep 19, 2003 6:28 pm
Location: Burgos, Spain
x 1
Contact:

Post by Kencho » Fri Feb 04, 2005 8:53 pm

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 ;)
0 x
Image

User avatar
Goosey
Halfling
Posts: 88
Joined: Wed Sep 29, 2004 3:33 am
Location: Ohio, USA
Contact:

Post by Goosey » Fri Feb 04, 2005 9:23 pm

Woo please post a video of it in action, that is one nice looking earth, even with the 'darkside issues'!
0 x
I <3 the OGRE Wiki, and SO SHOULD YOU! :)

snowblind
Gnoblar
Posts: 14
Joined: Tue Jan 25, 2005 5:51 am
Contact:

Post by snowblind » Sat Feb 05, 2005 5:53 am

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...

Image

...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.
0 x

User avatar
Goosey
Halfling
Posts: 88
Joined: Wed Sep 29, 2004 3:33 am
Location: Ohio, USA
Contact:

Post by Goosey » Sat Feb 05, 2005 11:19 am

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!
0 x
I <3 the OGRE Wiki, and SO SHOULD YOU! :)

User avatar
Kencho
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4011
Joined: Fri Sep 19, 2003 6:28 pm
Location: Burgos, Spain
x 1
Contact:

Post by Kencho » Sat Feb 05, 2005 1:23 pm

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!
0 x
Image

snowblind
Gnoblar
Posts: 14
Joined: Tue Jan 25, 2005 5:51 am
Contact:

Post by snowblind » Sat Feb 05, 2005 10:11 pm

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!
0 x

User avatar
Goosey
Halfling
Posts: 88
Joined: Wed Sep 29, 2004 3:33 am
Location: Ohio, USA
Contact:

Post by Goosey » Sat Feb 05, 2005 10:38 pm

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 :)
0 x
I <3 the OGRE Wiki, and SO SHOULD YOU! :)

User avatar
Kencho
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4011
Joined: Fri Sep 19, 2003 6:28 pm
Location: Burgos, Spain
x 1
Contact:

Post by Kencho » Sat Feb 05, 2005 11:48 pm

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 :)
0 x
Image

Fredz
Greenskin
Posts: 122
Joined: Wed May 26, 2004 1:45 pm
Location: Perpignan, France

Post by Fredz » Sun Feb 06, 2005 3:41 am

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
http://astronomy.swin.edu.au/~pbourke/t ... spheremap/

Spherical Projections (Stereographic and Cylindrical)
http://astronomy.swin.edu.au/~pbourke/p ... spherical/

Spherical Textures
http://www.vterrain.org/Textures/spherical.html

[Request for help] Texture mapping an icosahedron
http://www.gamedev.net/community/forums ... _id=116339

[Request for help] Texture mapping a subdivided icosahedron
http://www.gamedev.net/community/forums ... _id=116312
0 x

User avatar
TobascoSpam
Halfling
Posts: 86
Joined: Thu Nov 18, 2004 2:30 am
Location: Texas

Post by TobascoSpam » Mon Feb 07, 2005 5:31 am

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 http://www.projectxenocide.com/ have something similar to this.
0 x

Post Reply