Solved

3D Engine and problems

Posted on 2002-04-20
2
210 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Recently, in one of the tech-blogs I usually read, I saw a post about the best-selling video games through history. The first place in the list is for the classic, extremely addictive Tetris. Well, a long time ago, in a galaxy far far away, I was…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

707 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