• Announcements

Archived

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

Direct3D 8.1 Lighting

Recommended Posts

sdoherty55    122
When I render my mesh, it doesn't seem to make such of a difference whether I have the light source on or off. Furthermore, it doesn't seem to matter what direction I point the light. The only numbers that have any effect are the diffuse color and ambient color. I sure there is a simple explaination? Thanks
cLight Light;
Light.SetType(D3DLIGHT_DIRECTIONAL);
Light.SetDiffuseColor(255,255,255);
Light.SetAmbientColor(16,16,16);
Light.Move(0,0,-10);
Light.Point(0,0,0, 0, 0, 1);
m_Graphics.SetLight(0, &Light);
m_Graphics.EnableLight(0, true);


Share on other sites
sdoherty55    122
Material Material01            {                0.800000;0.800000;0.800000;1.000000;;                0.000000;                0.000000;0.000000;0.000000;;                0.000000;0.000000;0.000000;;

This is my mesh material, keep in mind that I am using a texture. When I enable lighting loose the color in my vertex buffers unless I create a material as follow:

	cMaterial Test;	Test.SetDiffuseColor(255,255,255);	Test.SetAmbientColor(255,255,255);	m_pCGraphics->SetMaterial(&Test);

Not sure which render/states neet to be set so the material will be taken as the color input?

Generally, where should the light source reside in relation to the mesh and the Camera?

VB Data Structure
SVertex SVerts[4] =	{						{ 2.0f,  2.0f, -2.0f, D3DCOLOR_RGBA(255,0,255,0) },						{-2.1f,  2.0f, -2.0f, D3DCOLOR_RGBA(255,255,0,0) },						{ 2.0f,  2.0f,  2.0f, D3DCOLOR_RGBA(255,0,255,0) },						{ -2.0f, 2.0f, 2.0f, D3DCOLOR_RGBA(255,255,0,0) },						};