Archived

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

DorRaba

D3D9 lighting problem

Recommended Posts

DorRaba    122
Hi, I use a Spot Light that lights on a 20x20 surface, the problem is that the light is not shown as a circle on the surface, its shape is very sharp, the light is like its created from the triangles of the surface. this is how i created my light, if there is something wrong please tell me how to fix it ZeroMemory(&d3dlight1, sizeof(D3DLIGHT9)); d3dlight1.Type=D3DLIGHT_SPOT; d3dlight1.Diffuse.r=1.0f; d3dlight1.Diffuse.g=0.0f; d3dlight1.Diffuse.b=0.0f; d3dlight1.Ambient.r=0.0f; d3dlight1.Ambient.g=0.0f; d3dlight1.Ambient.b=0.0f; d3dlight1.Specular.r=0.0f; d3dlight1.Specular.g=0.0f; d3dlight1.Specular.b=0.0f; d3dlight1.Position.x=0; d3dlight1.Position.y=5; d3dlight1.Position.z=0; d3dlight1.Direction.x=0; d3dlight1.Direction.y=-1; d3dlight1.Direction.z=0; d3dlight1.Falloff=0.0f; d3dlight1.Phi=0.5f; d3dlight1.Theta=1.0f; d3dlight1.Attenuation0=1.0f; d3dlight1.Attenuation1=0.0f; d3dlight1.Attenuation2=0.0f; d3dlight1.Range=100.0f; g_pd3dDevice->SetLight(1, &d3dlight1); g_pd3dDevice->LightEnable(1, TRUE); the surface has no Y axis so the light should down to the surface and make a round circle.

Share this post


Link to post
Share on other sites
Palidine    1315
that''s just how lights are done with dynamic lighting. they are done on a per-vertex basis, which is why it''s called per-vertex lighting. to get nice circle lights either use a more detailed mesh or look into lightmaps which is how most games get good looking spotlights. or look into pixel shaders which you can get to do just about anything AFAIK....

-me

Share this post


Link to post
Share on other sites
DorRaba    122
I saw in the microsoft directx sdk samples, the Lighting sample, and they didn''t use anything special in there, maybe i''m not getting smooth circle of light because I didn''t make the surface using mesh object, instead I used only a vertex buffer, could it be the problem, are meshes, respond to light better then a regular polygon?

Share this post


Link to post
Share on other sites