All pastes #557417 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-06-10 23:51 UTC
rendered paste body

LOD- What Is It?
LOD stands for Levels-Of-Detail, It is a BZFlag mapping technique that was enabled by code that Trepan added to BZFlag.
It's main purpose is to allow complex map objects to be rendered faster. A few tests I have run with a single LOD, 
appear to increase rendering speed by about fifteen percent. However, in certain circumstances (more LOD levels) I 
beleive this may increase rendering speed to maybe twice as fast as without LOD, or even faster. LOD also allows objects 
to move, though interaction with tanks and bullets is insufficient.
Trepan was hoping to complete the code in time for the release of BZFlag 2.0.4, but it wasn't quite ready, so 2.0.6 is
the first version where LOD is fully developed. Trepan did document the changes somewhat before he left the development
team, but since no mapper was versed in the techniques, LOD was mostly forgotten by the mapping community. 

LOD- A Puzzle.
Over a year after 2.0.6 I got fed up with the inactivity and decided I was going to do whatever it takes to make some 
of what I was then calling "drawinfo." Google can be your freind. The first thing I discovered was that drawinfo is
a generic word used in many settings to represent graphical data, and was the first dead end in my research. 
The only example of drawinfo that I had was a map I had saved from Trepan's test server.  Here it is...
http://www.garrettsites.net/bzmaps/index.php?page=mapdetail&id=212
This map didn't really help me all that much. The sphere has 8000 vertices! All it gave me was another direction for
my research, tristrips. I needed an application (that I could use on a macintosh) that would convert an object that
I did know how to create, into tristrips. For a week or so I played around with this, http://www.cs.sunysb.edu/~stripe/
It almost got me where I needed to go, but turned out to be another dead end. I think it might be worth it to take 
another look at stripe someday..
Next i went to vaarious web pages like this one, http://www-users.informatik.rwth-aachen.de/~roberts/software.html#Bamg
and spent a week of my spare time making messes. I even started thinking about spending money for software. (horriffic)
I had just about given up on LOD when someone mentioned that Louman's Churchyard map had some trees that included LOD.
I instantly got a copy of the map, and finally had more than one example of LOD in use, it even had quads and trifans, 
and less than 100 vertices. Now I could finally see simpler representations of LOD, and wasn't restricted to tristrips.
In a few more days I was able to create a pyramid that didn't have correct texturing, but it was good enough to add
to the Planet Mofo "Passion" map for an April Fool's Day special.

LOD- An Example
Here I will present the simplest possible representation of LOD, in an attempt to explain the syntax. This is the  
pyramid I made, and not even close to perfect. 

material
 name pyrmat
 texture pyrwall.png
end

define pyramid
mesh
  name attemptdrawinfo
vertex 25.000000 0.000000 -0.000000
vertex 0.000000 -25.000000 0.000000
vertex -25.000000 -0.000000 0.000000
vertex 0.000000 25.000000 -0.000000
vertex 0.000000 0.000000 15.000000
normal 0.867371 0.000000 0.497663
normal 0.000000 -0.867371 0.497663
normal -0.867371 0.000000 0.497663
normal -0.000000 0.867371 0.497663
normal 0.000000 0.000000 1.000000
texcoord 0.001469 0.002450 0.000000
texcoord 0.002927 0.996503 0.000000
texcoord 0.167564 0.851543 0.000000
texcoord 0.177459 0.143798 0.000000
texcoord 0.531782 0.423244 0.000000
texcoord 0.875309 0.861438 0.000000
texcoord 0.885204 0.153693 0.000000
texcoord 0.995522 0.000993 0.000000
texcoord 0.996979 0.995045 0.000000
# Everything to this point you should be familiar with. I created a pyramid and applied textures using wings3d.
# However, wings3d adds more texcoords than i can use in my LOD. I don't have a solution for that.
# FACES are optional for LOD

  drawInfo                   # an arbitrary word  
   dlist                     # DISPLAY LIST 
    # extents -1 -1 0 1 1 1  # Extents and sphere are genrated automatically by bzfs. 
    # sphere 0 0 0.5 2.2 5  # You don't need to worry about them at all.
    
      angvel 20              # Angular Velocity  # Add details here 
      
      corner 0 0 0           # Corner Indexing Is the biggest problem I have at this time.
      corner 1 1 1           # What It means is the first vertex, first normal, and first texcoord (etc) are now grouped 
      corner 2 2 2           # together, for use In the LOD(s) 
      corner 3 3 3           # FIxing the index buffer is priority #1 at this time.
      corner 4 4 4
     
      lod                    # I am only using one Level Of Detail in this object. 
        lengthPerPixel 0     #  Add details here 
        matref pyrmat        # invoke material 
          dlist              # I have no clue why there are two dlists.
# Here's where the fun begins. I'm using tristrips, which means the object must use only triangles..
# but the bottom of the pyramid is square.           
          tristrip 4 0 1 2 4 3 0 2 
          
          
          end  # material -1
      end  # lod 0
      
    end  # drawInfo


end
enddef 

group box
  matref pyr
  shift  0 0 0
end





LOD- What I Learned.
Here I will relate some of the conclusions I have arrived at, in no special order.
A. The LOD code is a little incomplete. For instance a tank entering a LOD object using the osxillation overthruster flag
will suffer client crash. I'm not sure if this is requires face data to be included in the object definition or not.
More testing is needed.
B. It appears that trifans are used only for cones.
C.