Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm looking to create an FoV implementation and I was wondering which algorithm is faster - raycasting or shadowcasting?

share|improve this question
1  
I'm a game industry veteran. What's a FoV implementation? What is shadowcasting? Never heard of either. –  bmcnett Apr 13 '11 at 3:29
1  
Do you mean inside a roguelike? –  Tetrad Apr 13 '11 at 5:14
1  
How about precomputing visibilty with BSP like the good old Quake did? Afterwards you just need to iterate your ray-/shadow-casting over all visible leafs. –  LumpN Apr 13 '11 at 8:45
2  
Is it a 2D or 3D world? Is it grid-aligned? Are there many different types of walls? –  Sam Hocevar Apr 13 '11 at 13:04
    
Sorry about the delay, I'd posted just before an major interruption and was unable to get back to you all right away. @bmcnett, an FoV implementation is a field of view implementation. There's all sorts of information on the web if you Google it. @Tetrad yes. @LumpN how would I go about that? @Sam Hocevar it's a 2D word, grid aligned, one type of wall. –  Elliot Bonneville Apr 14 '11 at 1:12
add comment

1 Answer

Raycasting and shadow casting are types of algorithms, not algorithms themselves (in this context). So neither have any performance characteristics, per se, and thus neither one is faster than the other.

"Shadow casting" as a FOV technique isn't very common, I've only ever seen the term used widely in Roguelike development circles (and in fact the RogueBasin has a number of articles on shadow casting FOV techniques, such as the spiral path implementation and plenty of articles on FOV in general).

You also might find this article from GDNet interesting.

It's important to remember that there are more factors to consider than just performance -- while shadowcasting techniques tend to be faster than their raycasting counterparts, you pay a trade off in the shape of the results. Some algorithms generate more anomalies and artifacts than others, some procedures don't produce exactly uniform or symmetric results.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.