Solved

3D Engine and problems

Posted on 2002-04-20
2
204 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 4

Accepted Solution

by:
joachimc earned 25 total points
ID: 6979661
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
ID: 7036509
so

What's happening here ???

/Joachim
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Artificial Intelligence comes in many forms, and for game developers, Path-Finding is an important ability for making an NPC (Non-Playable Character) maneuver through terrain.  A* is a particularly easy way to approach it.  I’ll start with the algor…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

726 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