Trigonometry without sine/cosine
Moderator: MaxCoderz Staff
-
- Calc King
- Posts: 2195
- Joined: Sun 27 Mar, 2005 4:06 am
- Location: sleeping
- Contact:
-
- Regular Member
- Posts: 136
- Joined: Tue 11 Jan, 2005 10:10 pm
- Location: No longer in the Midwest... now in Seattle
- Contact:
Ok, I guess one assembly instruction might be a tad faster than an LUT, heh. I was thinking they were a Taylor expansion or something.benryves wrote:If the CPU can calculate trig itself, then you should have no real need for a LUT (unless the instruction was very ineffecient).
Of course, using maths to favour a LUT was what gave us the ATi DOOM3 shader tweak. So LUTs are not always the best.
They probably are, somewhere deep down below... Which is a little worrying, so to settle my nerves, I made a benchmark calculating a whole heap of sins and taking values from a high resolution LUT, compiled with all optimizations I could find for my amd64 3000+. The results were a little surprising, the LUT was nearly 100x faster I've never looked into any asm so I didn't use any weird vector-tricks with SSE to get a whole heap of values in a row.
This doesn't imply LUTs are better overall, remember that
This doesn't imply LUTs are better overall, remember that