Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

LostLogic

Multitexturing in DX8, plz help

This topic is 6594 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

Ok, for this example I have a primitive with 2 faces. Lets say that this is a terrain object, so I want a grass texture on it. This part works fine. But, now I want to overlay a road texture with alpha map on top of the grass. This way the dirt road will blend nicely with the grass. How can I accomplish this with DX8? I used to have code to do it in DX7 but have lost it. I know that I have to set the textures and stages, but in what fashion. A code sample would be greatly appreciated. Thanks for any help, LostLogic

Share this post


Link to post
Share on other sites
Advertisement
hi,
well, i too have the same question
i know how to multi texture but i dont know how to set the UVs for the second texture (which is to be blended with the first)

the question is - how do i set the UVs for the second texture when using multi texturing????


thnx in advance!

Raptor

Share this post


Link to post
Share on other sites
quote:
Original post by Jesava

Raptor:
Each vertex can have multiple texture coords. Don''t know if thats what you want tho.


If someone needs more help:
It''s quite easy, you,ve just to use the Strided drawPrimitive. You set up your own vertex format:
the mssdk sample ( in lightmaps.exe ) is clear enough

struct MT_VERTEX
{
D3DVERTEX vertex;
float tuBase,tvBase; // first coords
float tuLightmap,tvlightmap; //second coords
}

Then you set up the DRAWPRIMITIVESTRIDEDATA structure ( or something like that ) with the adress of your arrays:
the vertices,
the coords: m_Data.DrawCoords[0] = &my_vertices[0].tuBase;
m_Data.DrawCoords[1] = &my_vertices[0].tuLightmap;
And then you don''t forget to use the TEX2 flag in the DrawPrimitiveStrided to specify that your format use 2 sets of coordinates.

You setup which texture with which coords
You setup the TextureStage and all is good

My explanation is not too accurate, You''d better check the doc for Strided Primitives and the lighmaps exemple in the MSSDK.



Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!