Jump to content
  • Advertisement

Archived

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

sdoherty55

Direct3D 8.1 Lighting

This topic is 5436 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 this post


Link to post
Share on other sites
Advertisement

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) },
};

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!