Skip to main content
GameDev.net gamedev.net
🔒 Locked

Scaling multiple layers of textures over terrain

Started by strahan Dec 18, 2006 at 2:14 PM 3 replies 1.7k views
Original Post
strahan
strahan
Hello, I am looking for source that shows how to tile a texture over a terrain without using texture coordinates. This way, I can alpha blend any number of layers of textures onto the terrain. Each layer can have the texture at any Scale U and Scale V. Does anyone have such code or know of any tutorials that show how to do this in DirectX? Thanks in advanced.
ReaVeR-Andrey
ReaVeR-Andrey
vertex shaders are one way.

you do something like (in asm shaders):

mul oT0.xy, v0.xy, c4.xy

DX may require to break this code into couple of lines, depending on the version. you can also use matrices.
strahan
strahan
Hmm, I am still not clear on how to do this.

Is there a way to do it without vertex shaders (i have never used them).

For example, how do you take a texture, and set it to repeat over the terrain at a given Scale U and Scale Y

Thanks.
strahan
strahan
Let me re-word this question in hopes that someone can help! :)

Given a texture and a mesh that holds my terrain:

Texture myTexture;
Mesh terrainMesh;

How do I render the mesh such that the texture repeats at a given Scale U and Scale V interval?

I do not want to use texture coordinates.
EnochDagor
EnochDagor
Well... odd... not sure if you can texture without texture coords...

But if I understand your problem, you want volume texturing of terrain. Almost all of the video cards that run DirectX 9 feature volume texturing abilities.

    Private Structure terVert        Public p As Vector3        Public n As Vector3        Public tu As Single        Public tv As Single        Public tw As Single        Public tu2 As Single        Public tv2 As Single        Public tw2 As Single    End Structure    Private terVertFmt As VertexFormats = VertexFormats.Position Or VertexFormats.Normal Or VertexFormats.Texture1 Or _      VertexFormats.Texture2 Or VertexTextureCoordinate.Size3(0) Or VertexTextureCoordinate.Size3(1)


That's an example of the terrain vertex definition for FF pipeline. Then you could use the DirectX Texture Tool to make your texture... etc...

HTH... otherwise, I have no idea.

-E

[Edit to get rid of large page width]
[Edit: My structure definition above allows for multi-texturing because of the application uses two textures. One is a volume texture, the other is a non-volume texture but still requires the tw value.]
Enoch DagorLead DeveloperDark Sky EntertainmentBeyond Protocol

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.