Jump to content
  • Advertisement
Sign in to follow this  
CaptCanada

creating a flashlight in XNA

This topic is 2089 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

Hi all

 

I have finished reading the XNA Game Studio 2nd Edition and, having read the chapter covering lighting systems, I am having trouble figuring out how to create a "basic" flashlight in XNA 3.1 (though I am currently reading Learning XNA 4.0) right now.

 

 I have tried tweaking the code and have been able to make the light used in the chapter example bright and dimmer, but haven't been able to dim the ambient light nor been able to "focus" the light into a beam shape.

 

I am currently coding using XNA 4.0 and VC# 2010.

 

Thanks for helping this old gamer/programmer!

 

 

Share this post


Link to post
Share on other sites
Advertisement

This is not for a game persay, just tweaking the code found in the book. I was trying to change it so that the light used in the example is more focues like a flashlight beam. I don't have access to the code used in the chapter at the moment, but can post it as soon as practicle.

 

The code is 3D as the author has created a camera system and is demonstarting the use of lighting by having a light follow the movement of the camera.

Share this post


Link to post
Share on other sites

Ya, I guess spotlight would be the best way to describe it.

 

Something similiar to the flashlight effect in say Slenderman or any other of the horror-survial-at-night genre of games.

Share this post


Link to post
Share on other sites

Basically it's just a spot-light, you can do more fancy texture projections or more complex lighting equations to give interesting variations..

 

Compute the dot product of the light-pixel vector and the light-target vector. Then you can use that to produce a light-cone.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!