Jump to content
  • Advertisement
Sign in to follow this  
yuppies

texturing a large terrain?

This topic is 4635 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i got a problem texturing my terrain the original size of the terrain is 257x257 implmented using GMM and tile texturing but when i scaled it to lets say around 10.0f,1.0f,10.0f (x,y,z) my texture appears to be blocky i already added some detail mapping at texture stage 1 and heres how i set the samplerstate texture stage 0 is my tiled texture texture stage 1 is the detail map texture
m_pGraphics->GetDevice()->SetSamplerState ( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
	m_pGraphics->GetDevice()->SetSamplerState ( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
	m_pGraphics->GetDevice()->SetSamplerState( 0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR );
	//for multi texturing
	m_pGraphics->GetDevice()->SetSamplerState (1, D3DSAMP_MAGFILTER, D3DTEXF_POINT );
	m_pGraphics->GetDevice()->SetSamplerState (1, D3DSAMP_MINFILTER, D3DTEXF_POINT );
	m_pGraphics->GetDevice()->SetSamplerState( 1, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR );

how can i fix it to let my texture do not appear blocky

Share this post


Link to post
Share on other sites
Advertisement
Good morning Yuppies,
how are you doing?

The Problem
Texturing a large terrain that has been scaled.

The Solution
My first thought would be since you scaled it that the terrain is stretched and depending on how you setup the texture coordinates that the texture might be stretched.
Another artifact/problme that might occur is that the texture might not conform to the 2^n+1 size. Which might cause your terrain to look blocky, One more thing that you might want to check out is maybe create mipmaps for your textures.
Texture Filtering with Mipmaps
"A high-resolution mipmap image is used for objects that are close to the user. Lower-resolution images are used as the object appears farther away. Mipmapping improves the quality of rendered textures at the expense of using more memory."

I am just shooting in the dark here, but some of this information might be worthwhile. Take care bud.

Share this post


Link to post
Share on other sites
Guest
I got the same problem some time ago. I will give you some code but I don't have it with me right now (I only work with documentation, don't realy like to learn ALL that stuff).

You have a few options:
- simply use a bigger texture (like 1024 X 1024);
- use texture wrapping, filters or diethering (these will for sure smooth your terrain): whatever works best for you.

You should consult the DirectX documentation, search for min and max filters: you will find everything there, including some nice examples...

Share this post


Link to post
Share on other sites
"texture appears to be blocky.."

Well first of all you could check that is is seamless texture, so it can be tiled (easily). Second, you are calculating your texture coordinates wrong.

Share this post


Link to post
Share on other sites
I didn't really have any problems with blocky textures when developing my terrain demo. I think wrapping is the way to go, along with splitting the terrain into chunks.

My terrain is 255x255 vertices, but split into 31x31 vertex chunks. Each terrain chunk has the texture coordinates set out, such that a texture completely covers one terrain chunk, rather than having the texture coordinates set up so that the texture covers the whole terrain (if you get what I mean by that).

Objects are rendered using an effects system I wrote, which parses text files in order to find out how to render an object in an arbitrary number of passes (a bit like DirectX's effect system). The effect file can specify a scaling factor for texture coordinates, if the texture still turns out to be too blocky.

My texture is 1024x1024 DXT compressed, but I can still get fairly reasonable results using a 256x256 texture, especially if I use an effect with a scaling factor on the texture coordinates.

Here's a screenshot. If I recall correctly, the terrain is scaled three times in each direction.

Free Image Hosting at www.ImageShack.us



EDIT: Here is a diagram which shows what I mean about the texture coordinates. In my opinion, this is the best way to lay out the texture coordinates for texturing terrain. This is just my opinion though, someone else might not agree, bear in mind I am not a graphics guru like some of the people here, that really know their stuff:

Image Hosted by ImageShack.us

[Edited by - Oxyacetylene on September 2, 2005 5:19:18 AM]

Share this post


Link to post
Share on other sites
so it means that i have LPDIRECT3DTEXTURE9 texture per chunk and then just call pDevice->SetTexture to switch the texture many times(dpending on the number of chunk)? isnt it costly? or maybe it may sloq my engine down?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!