Archived

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

Darkening

Transformed but unlit vertex

Recommended Posts

So you want D3D to light your transformed vertex? I think that''s possible. Your FVF description would be something like D3DFVF_XYZRHW / D3DFVF_NORMAL / D3DFVF_TEX1. It''s probably not a good idea, though -- D3D will have to "back-transform" the vertex to world-space in order to light it, which kinda defeats the purpose of transforming the vertex before-hand.

Share this post


Link to post
Share on other sites
Im confused on what exactly you are looking to do. If you want to do your own transforms then the above post covered it. If you are looking to do you own lighting then:

The 'Flexible Vertex Format' you need is D3DFVF_LVERTEX.

By using this format, you have to supply the lighting information in the color and specular variables.


typedef struct _D3DLVERTEX {
union {
D3DVALUE x;
D3DVALUE dvX;
};
union {
D3DVALUE y;
D3DVALUE dvY;
};
union {
D3DVALUE z;
D3DVALUE dvZ;
};
DWORD dwReserved;
union {
D3DCOLOR color;
D3DCOLOR dcColor;
};
union {
D3DCOLOR specular;
D3DCOLOR dcSpecular;
};
union {
D3DVALUE tu;
D3DVALUE dvTU;
};
union {
D3DVALUE tv;
D3DVALUE dvTV;
};
} D3DLVERTEX, *LPD3DLVERTEX;








"You know you're obsessed with computer graphics when you're outside and you look up at the trees and think, "Wow! That's spectacular resolution!""




Edited by - emfb on June 15, 2000 1:18:15 AM

Share this post


Link to post
Share on other sites
What I want to do, is use the lightning system of Direct3D but not it''s transform system.
I''m not good enough with all the matrix to use the transform pipeline.
What I want is a dynamic lightning system. I have an isometric engine using D3DTLVERTEX and I want to add dynamic lightning in it.

Darkening

Share this post


Link to post
Share on other sites
I don''t think so. Isn''t a lightmap just a special type of texture?

I think the DirectX lighting engine just calculates light components of vertices -- it doesn''t do anything with lightmaps. I''m hardly an expert, though...

Share this post


Link to post
Share on other sites
When you use a light map you just apply another texture to the polygons. There is no lightning calculation by DirectX necessary if you use lightmaps. Maybe some ambient lightning.
Yoshi

Share this post


Link to post
Share on other sites
I''d like to see this TVERTEX too: the normal (untransformed) lightning effects are imo better than the ones used in transforming.

Share this post


Link to post
Share on other sites
You could perform your own lighting by coloring the vertex with the correct diffuse value. You wouldn't get specular colors, but then again, I don't see grass with a high specular reflection

D3DF_XYZRHW / D3DF_DIFFUSE

struct myvert
{
float x,y,z,w;
DWORD color;
};


Edited by - mitchw on June 15, 2000 10:26:28 AM

Share this post


Link to post
Share on other sites