Terrain Texturing

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
Post Reply
User avatar
RyanN
Halfling
Posts: 82
Joined: Thu Aug 19, 2004 6:41 am
Location: Victoria, Australia
Contact:

Terrain Texturing

Post by RyanN »

Whats the best way to paint a terrain?
I want to get a similar effect used in FarCry with different high detailed textures blending together in specified areas.
Multitexturing i guess is the only way but how can i have textures with their own masks?
User avatar
tuan kuranes
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2653
Joined: Wed Sep 24, 2003 8:07 am
Location: Haute Garonne, France
x 4
Contact:

Post by tuan kuranes »

search "splatting" in these forum, or try ogreaddons paginglandscape
User avatar
PeterNewman
Greenskin
Posts: 128
Joined: Mon Jun 21, 2004 2:34 am
Location: Victoria, Australia
Contact:

Post by PeterNewman »

That's not exactly the effect he's after, though. I happen to know this because RyanN is my art guy.

He's got a texture that has green for grass and brown for path and so on, that's fairly low detail and just defines ther area's. He'd like to put a higher detail tiled "rocky" texture on where the path area's are, and a higher detail tiled "grass" texture on the grass, and "cliff wall" on the cliffs, and so forth.

We've done something like this already by using multiple texture units and modulative blending, but this really only worked for producing a lightmap.
User avatar
tuan kuranes
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2653
Joined: Wed Sep 24, 2003 8:07 am
Location: Haute Garonne, France
x 4
Contact:

Post by tuan kuranes »

That is splatting to me.

you associate an alpha map with a type of texture or a texture, and it is drawn where alpha > 0.

splattting depends on the alpha map, but it's not limited to height or slope charecteristic, it can be alpha map done by hand, like path or so...
User avatar
monster
OGRE Community Helper
OGRE Community Helper
Posts: 1098
Joined: Mon Sep 22, 2003 2:40 am
Location: Melbourne, Australia
Contact:

Post by monster »

I'm guessing that as this post's in the "Artists & Content Creators" section you're not really interested in the technical details of how splatting (or whatever you want to call it) happens, you just want some tool (or "arty" type mechanism ;) ) that allows you to paint your landscape from high up in that air and which then automatically applies details to it as you get closer. Yes?

There was a really impressive terrain engine knocking around a while back. But they (http://www.gscape.com/) seem to have disappeared. This had an editor that did, I think, exactly what you're after. You painted on it with big thick brushes roughly what type of textures you wanted where and the engine applied the necessary details to make it look nice close up.

Unfortunately I don't think such a tool exists (yet) for Ogre. But I haven't looked at the PLSM lately, so I could be wrong.
Dorkula
Gnoblar
Posts: 22
Joined: Tue May 18, 2004 6:08 am
Location: Portland, Oregon
Contact:

Post by Dorkula »

Commercial engines are like fine wine, only rich people drink it, ogre is like water... but everybody drinks water.
User avatar
RyanN
Halfling
Posts: 82
Joined: Thu Aug 19, 2004 6:41 am
Location: Victoria, Australia
Contact:

Post by RyanN »

A tool would really help :wink: but i dont mind diving into the material file to do stuff. I was just woundering would it be done using multiple passes so that each texture layer won't effect the others?
User avatar
semicolon
Halfling
Posts: 94
Joined: Sun Jul 04, 2004 4:42 pm
Location: Bangkok, Thailand
Contact:

Post by semicolon »

Yes, Ryan you can do some texture blend on top of the other. There are 2 ways you can do it. First, with scene_blend operations, you are to blend texture on top of the scene pixels. If you want to create like a tree plain, you have to create a tree texture with an alpha channel.

Code: Select all

material Tree_texture
{
	technique
	{
		pass
		{
			ambient 0.588235 0.588235 0.588235 1
			diffuse 0.588235 0.588235 0.588235 1
			specular 0.9 0.9 0.9 1 0
			scene_blend alpha_blend

			texture_unit
			{
				tree_texture.png //say tree_texture is a texture with alpha channel
				filtering point point point
			}
		}
	}
}
Second, colour_op or colour_op_ex, you can blend between texture layer but this won't affect the current scene pixels, only inside the texture unit. This you will allow you to blend 2 textures to create some effect that you want.
"Nature is the mother of learning"
User avatar
RyanN
Halfling
Posts: 82
Joined: Thu Aug 19, 2004 6:41 am
Location: Victoria, Australia
Contact:

Post by RyanN »

yes i already use that code to add transparency to my PNG files, but im still wondering how to combine multiple texture layers without affecting the already blended layers to create a texture effect like that used in the Unreal2 engine.
User avatar
tuan kuranes
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2653
Joined: Wed Sep 24, 2003 8:07 am
Location: Haute Garonne, France
x 4
Contact:

Post by tuan kuranes »

get ogreaddons
loook in paginglandscape media folder.
look for the splatting materials.

here is an excerpt :

Code: Select all

material SplattingMaterial

	technique
	{
		lod_index 0
		pass
		{
			// Base Pass
			ambient 1.0 1.0 1.0
			diffuse 1.0 1.0 1.0
			texture_unit
			{
				// Base Texture
				texture none
				tex_address_mode clamp
				alpha_op_ex source1 src_texture src_texture
				colour_op_ex modulate src_current src_texture
			}
		}
		pass
		{
			// Snow Pass
			ambient 1.0 1.0 1.0
			diffuse 1.0 1.0 1.0
			scene_blend alpha_blend
			depth_func equal
			texture_unit
			{
				// Snow Alpha map
				texture none
				tex_address_mode clamp
				alpha_op_ex source1 src_texture src_texture
				colour_op_ex source1 src_current src_current
				alpha_rejection greater_equal 2
			}
			texture_unit
			{
				// Snow Splat
				texture splatting_snow.jpg
				tex_address_mode mirror
				alpha_op_ex source1 src_current src_current
				colour_op_ex source2 src_current src_texture
				scale 0.01 0.01
			}
		}
		pass
		{
			// Sand Pass
			ambient 1.0 1.0 1.0
			diffuse 1.0 1.0 1.0
			scene_blend alpha_blend
			depth_func equal
			texture_unit
			{
				// Sand Alpha map
				texture none
				tex_address_mode clamp
				alpha_op_ex source1 src_texture src_texture
				colour_op_ex source1 src_current src_current
				alpha_rejection greater_equal 2
			}
			texture_unit
			{
				// Sand Splat
				texture splatting_sand.jpg
				tex_address_mode mirror
				alpha_op_ex source1 src_current src_current
				colour_op_ex source2 src_current src_texture
				scale 0.01 0.01
			}
		}
		pass
		{
			// Grass Pass
			ambient 1.0 1.0 1.0
			diffuse 1.0 1.0 1.0
			scene_blend alpha_blend
			depth_func equal
			texture_unit
			{
				// Grass Alpha map
				texture none
				tex_address_mode clamp
				alpha_op_ex source1 src_texture src_texture
				colour_op_ex source1 src_current src_current
				alpha_rejection greater_equal 2
			}
			texture_unit
			{
				// Grass Splat
				texture splatting_grass.jpg
				tex_address_mode mirror
				alpha_op_ex source1 src_current src_current
				colour_op_ex source2 src_current src_texture
				scale 0.01 0.01
			}
		}
		pass
		{
			ambient 1.0 1.0 1.0
			diffuse 1.0 1.0 1.0
			scene_blend alpha_blend
			depth_func equal
			texture_unit
			{
				// Rock Alpha map
				texture none
				tex_address_mode clamp
				alpha_op_ex source1 src_texture src_texture
				colour_op_ex source1 src_current src_current
				alpha_rejection greater_equal 2
			}
			texture_unit
			{
				// Rock Splat
				texture splatting_rock.jpg
				tex_address_mode mirror
				alpha_op_ex source1 src_current src_current
				colour_op_ex source2 src_current src_texture
				scale 0.01 0.01
			}
		}
	}
	technique
	{
		lod_index 1
		pass
		{
			ambient 1.0 1.0 1.0
			diffuse 1.0 1.0 1.0
			texture_unit
			{
				// Base Texture
				texture none
				tex_address_mode clamp
			}
		}
	}
}
The "texture None" are replaced realtime by the engine, loading an alpha only map, that determine if the current texture (snow, rock, etc..) si blended or not.
User avatar
RyanN
Halfling
Posts: 82
Joined: Thu Aug 19, 2004 6:41 am
Location: Victoria, Australia
Contact:

Post by RyanN »

thanks tuan kuranes, thats what i was talking about. I guess it textures could be specified but a real-time, walk around and paint the ground (like that used in FarCry) would be good in the future as a tool.
User avatar
PeterNewman
Greenskin
Posts: 128
Joined: Mon Jun 21, 2004 2:34 am
Location: Victoria, Australia
Contact:

Post by PeterNewman »

Just like to say thanks tuan kuranes, that was what we were after, I was just thinking of it from a different direction so it didn't seem like splatting to me. My bad! :oops:
rmmt
Gnoblar
Posts: 23
Joined: Sun Apr 03, 2005 7:14 am
Location: Philippines
Contact:

Post by rmmt »

I'm gonna go back a few steps.. if, for example, I'm using freeworld3d, which generates an alpha map per layer that I use to splat textures on the land, how do I get that to become a .material file?

SOrry if this sounds dumb, so please bare wth me :)
Ramon Miguel M. Tayag
User avatar
tuan kuranes
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2653
Joined: Wed Sep 24, 2003 8:07 am
Location: Haute Garonne, France
x 4
Contact:

Post by tuan kuranes »

@rmmt : just check the material file posted above...
replace the "texture none" by your alpha maps. (or using plsm2, name your file accordingly to plsm2 naming scheme (mapname.alpha.layer.Z.X.png, X and Z being page coordinates.))
User avatar
Greed
Gnoblar
Posts: 11
Joined: Mon May 09, 2005 9:51 pm
Location: Montreal

Post by Greed »

Can i get a link to ogreaddons please?
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Post by jacmoe »

From the Ogre site:
Community Add-on Projects
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Post Reply