#### Archived

This topic is now archived and is closed to further replies.

# How much is too much?

This topic is 6960 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Well, I can't really answer your first question (the one where 'how many divides is too much'), but I can give you some pointers.
First of all, if you have to do a lot of division, instead of dividing, multiply by the reciprocal. Multiplying is a lot faster than division.

reciprocal = 1.0f / value;

(x * reciprocal) == (x / value)

For texture mapping, you could precalculate the inverse Z1 and Z_delta, and linearly interpolate along there, and that way you wouldn't have to divide for each pixel, only multiply.

Also, for software perspective correct texture mapping, I recommend using the bilinear perspective correct method. This is where you recalculate the the correct coordinates every 8 or 16 pixels and then linearly interpolate between the coords. This is much faster and yields suprisingly decent results. This is what was done in the software rendering portions of Quake and Quake 2.

[This message has been edited by CodeDemon (edited November 22, 1999).]

##### Share on other sites
Thanks for the reply. I am aware of the various texture mapping techniques that can be used to avoid the divides. I was really just using it as an example so as to get a handle on my question whic still remains. Can today's Pentium Computers handle one divide per pixel in the rendering phase of a 3d engine and still have the application run in real time??

Thanx all.

##### Share on other sites
I'm not sure about integer division but, from the Intel Optimization Manual:

single-precision divide = 17 cycles
double-precision divide = 36 cycles
extended-precision divide = 56 cycles

So in answer to your question, Yes. But you probably won't have much time to do anything else!

I wrote a program recently that needed the effect of one floating-point divide per pixel. Rather than do the divide, I used a lookup table of the reciprocals described by CD.

##### Share on other sites
As I am fairly new to 3D programming I have yet to program a full 3D engine, I have merely tinkered around with teh various different aspects that go into an engine. Broadly stated, my quesion is, how much is too much. That is to say, how many divides can you have before you no longer have a real-time application? I know this is an extremely broad question so let me narrow it using an example.

To do exact perspective texture mapping requires at one per-pixel divide by z. If every other component of the engine was optimized would one per-pixel divide be too much??

1. 1
2. 2
3. 3
Rutin
15
4. 4
5. 5

• 10
• 9
• 9
• 11
• 11
• ### Forum Statistics

• Total Topics
633682
• Total Posts
3013308
×