How to render Q3 Textures with Lightmaps?

Started by
3 comments, last by cobru 17 years, 2 months ago
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.
Advertisement
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.
struct MyVert{  Vec3 Pos;  Vec2 Tex1;  Vec2 Tex2;};#define MYFVF (D3DFVF_XYZ|D3DFVF_TEX1|D3DFVF_TEX2)//On renderingDevice->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.
if (*pYou == ASSHOLE) { pYou->Die(); delete pYou; };

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.pos = vec3(-x, y, -z)
Verts.normal = vec3(x, y, z)
Verts.color = D3DXCOLOR(r, g, b, a)

and now texture coordinates:

Vert.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'.

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)
Q: How many programmers does it take to write a nice piece of software?A: MORE.

This topic is closed to new replies.

Advertisement