Sign in to follow this  
Mounir_Arfi

How to render Q3 Textures with Lightmaps?

Recommended Posts

Hello everybody, I made a Q3 BSP Loader and all were loaded perfectly, but the thing I can't correct is to render Textures and Lightmaps together (at the same time). N.B: both Textures and lightmaps textures coordinates are different. That's why I can't render them at the same time. For this problem I want help. And thanks.

Share this post


Link to post
Share on other sites
You need to use multitexturing, basically you set the texture on a texture "layer" and the lightmap on another "layer", then you set the different UVs in the vertex buffer.

Sorry I am not very specific, I know how its done in OpenGL, but I have no idea on DirectX.

Share this post


Link to post
Share on other sites

struct MyVert
{
Vec3 Pos;
Vec2 Tex1;
Vec2 Tex2;
};
#define MYFVF (D3DFVF_XYZ|D3DFVF_TEX1|D3DFVF_TEX2)

//On rendering
Device->SetTexture(0, m_MyTexture1);
Device->SetTexture(1, m_MyShowdowMap);





You probably want to set a few more things to make the shadowmapping work.
These are the things I know from the top of my head.

Share this post


Link to post
Share on other sites

You did not understand my problem.

For example, I have a wall (4 vertices), I want to render two textures each one having different coordinates on these 4 vertices and then render them at the same time.


Verts[i].pos = vec3(-x, y, -z)
Verts[i].normal = vec3(x, y, z)
Verts[i].color = D3DXCOLOR(r, g, b, a)

and now texture coordinates:

Vert[i].texcoord = vec2(arr[j].s, arr[j].t)

where j is only 0 and 1: 0 for textures coords.
1 for lightmaps coords.

the problem is 'j'.

Share this post


Link to post
Share on other sites
Quote:

You did not understand my problem.

For example, I have a wall (4 vertices), I want to render two textures each one having different coordinates on these 4 vertices and then render them at the same time.


It seems to me that Tjaalie and Kwizatz told you exactly how you can solve your problem... You can have more than one textcoord set for a vertex (and it's called multitexturing)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this