Solved

3D Engine and problems

Posted on 2002-04-20
2
197 Views
Last Modified: 2013-12-26
Hey, im making a dx8 engine, if you want to see the first version, visit http://www.y3knetwork.com and goto rendertech. Im having a slight problem though. Im trying to make lights, and I cant set the attenuation range. can someone explain?
Thanks
0
Comment
Question by:alkakios
  • 2
2 Comments
 
LVL 4

Accepted Solution

by:
joachimc earned 25 total points
Comment Utility
Hmm the attenuation is set on spotlights

In the D3DLIGHT8 you have
D3DLIGHT8 myLight;
D3DCOLORVALUE myColor;
D3DVECTOR myPosition;
D3DVECTOR myPointAt;

//Set position of light
myPosition.x = 10;
myPosition.y = 10;
myPosition.z = 10;

//Set direction of light
myPointAt.x = 0;
myPointAt.y = 0;
myPointAt.z = 0;

myColor.r = 1;
myColor.g = 1;
myColor.b = 1;
myColor.a = 1; //Alpha

//Linear attenuation
myLight.Attenuation0 = MyLightAttenuation;
//squared attenuation
myLight.Attenuation1 = MyLightAttenuation;
//exponential attenuation
myLight.Attenuation2 = MyLightAttenuation;
myLight.Diffuse =

Then you have to create a spotlight
myLight.Type = D3DLIGHT_SPOT;
myLight.Position = myPosition;
myLight.Direction = myPointAt;
myLight.Diffuse = myColor;
myLight.Specular = myColor;

//Turn on light
myD3DDevice->SetLight(0, &myLight);
myD3DDevice->LightEnable(0, TRUE);
myD3DDevice->SetRenderState( D3DRS_LIGHTING, TRUE );

Experiment with the Attenuation to get it right.
That's about it
/Joachim

0
 
LVL 4

Expert Comment

by:joachimc
Comment Utility
so

What's happening here ???

/Joachim
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

What is RenderMan: RenderMan is a not any particular piece of software. RenderMan is an industry standard, defining set of rules that any rendering software should use, to be RenderMan-compliant. Pixar's RenderMan is a flagship implementation of …
As game developers, we quickly learn that Artificial Intelligence (AI) doesn’t need to be so tough.  To reference Space Ghost: “Moltar, I have a giant brain that is able to reduce any complex machine into a simple yes or no answer. (http://www.youtu…
This video discusses moving either the default database or any database to a new volume.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now