Advertisement

Trig Functions - Are LUT's the answer?

Started by October 18, 2002 08:13 PM
3 comments, last by h0-0t 22 years, 4 months ago
I''ve recently begun work on a 3D Engine with a friend of mine as a personal hobby, and we have come accross an interesting thought...the penalty for using trig functions. Right now, we have implemented the camera (you can look around with the direction keys and move about...that''s about it) and we obviously have to do rotations. Here is where the trig functions come in. Testing the engine on a P2 466 shows us that there is no real speed loss, but we''re assuming that, eventually, the computing time required to calculate cos(theta)and sin(theta) may cause a bit of lag. I was wondering if perhaps an LUT would be much of a benefit in the end when we want to add cool features like special particle effects and more complex environment rendering, or if their implementation would be virtually useless.
:: h0-0t ::
So you''ve profiled it, found it isn''t a bottleneck and you''re still here looking for ways to optimise it? You know, the reason people go on about premature optimisation being the root of all evil isn''t that they are evil and want your programs to be slow. They go on about it because it''s true. I find it extremely unlikely that a few trig functions to rotate your camera will have any impact on performance at all. And even if they did, I doubt you would gain anything from a LUT. I''m sure you have more important stuff to do early in the project than to optimise trig functions.
Advertisement
The trig functions obviously won''t only be used for camera rotations, as you can well imagine. A FPS will typically use a lot of these functions for various reasons, I believe.

I''m not optimizing as I go along, but rather optimizing my trig stuff before I start implementing them.
:: h0-0t ::
You kinda missed GameCat''s point. You *are* prematurely optimzing because you''re looking for a way to speed up a low-level function before it poses any problem at all.

To answer your question, yes, using LUTs for trig is completely useless for your purposes.

Peace,
ZE.

//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links

[twitter]warrenm[/twitter]

Oh ok makes perfect sense then.

Thank you very much, guys
:: h0-0t ::

This topic is closed to new replies.

Advertisement