Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] some coding advice requested


Chronological Thread 
  • From: Peter Shirley <shirley@cs.utah.edu>
  • To: manta@sci.utah.edu
  • Subject: [MANTA] some coding advice requested
  • Date: Fri, 13 May 2005 09:58:03 -0600 (MDT)


I'm doing some restructuring of the innards of the materials
(especially to get rid of shadow rays for specular surfaces) and
while I'm at it I am trying to clean some things up.  There are
a few trade-offs I'd like some feedback on.

1. Often we can either go stack or heap, e.g.

    float *co = new float[4];   // 4 rays in this particular packet

    vs

    float co[32];  // 32 is max packet size

   I am inclined to change the former to the latter in the current code
   but perhaps my insincts are wrong?

2.  A lot of the direct lighting code is:

    if shadow directions are normalized
        for each shadow ray
             20-30 lines of code
    else
        for each shadow ray
             normalize
             20-30 lines of code

   I am inclined to bite the bullet and change this to

    if shadow directions are not normalized
        for each shadow ray
             normalize
    for each shadow ray
         20-30 lines of code

    My guess is that extra loop is just not that expensive, and the code
    is cleaner/smaller.

Opinions on either appreciated.  I know profiling is a good answer,
but we don't yet have a full working system with complex models so
I am leery of that now.






Archive powered by MHonArc 2.6.16.

Top of page