To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cadOpen lugnet.cad in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / 5672
5671  |  5673
Subject: 
VB - parts and transformation matrices, Z-ordering, optional lines, bow-tied quads - help!
Newsgroups: 
lugnet.cad
Date: 
Mon, 26 Mar 2001 12:22:25 GMT
Viewed: 
426 times
  
I've been messing with some VB code to read DAT files and draw them on the
screen, and have been surprised at how quickly I managed to pull it together
(esp. after spending some time poring over the LDraw FAQ trying to work out
the transformation matrix equations before realising that they were slightly
wrong, the x in the 'a*x' etc is not the same as the x in '+ x' at the end
of the calc!) but I have 2 problems.

1). If I load up 3626bp01.dat everything looks fine except the eyes, the
disc and cut-out primitives are placed in the middle of the head and
slightly rotated. I've toyed with the idea that the matrix I'm using is
wrong but it works for every other subpart and primitive, so I'm a bit
stuck. And it happens with all heads with eyes, and makes a complete mess of
torsos with patterns. I'll post some outputs to Brickshelf if anyone is
interested in helping and needs to see what is happening.

2). Z-ordering. At the moment I'm just drawing the polygons in the order
they appear in the DAT files, but obviously I need to handle Z-ordering so
that the parts are rendered correctly. Any idea on where I might find some
sample VB code that could be applied to DAT files easily, or a pointer to
algorithms I could write in VB to handle this?

3). Any sample VB code on handling optional lines? At the moment I just have
an option to turn them on and off, but if they're on I'm just drawing all
the lines indicated by the points which makes a bit of a mess, and I'm
having trouble sorting out the equations needed to work out which lines to
draw (it's been over 10 years since I left school and my memory's going).

4). Any algorithms for sorting out bow-tied quads? I've found a few parts
that don't render well at all, and it appears that the points are not stored
in a clockwise/anti-clockwise direction, so my filled polygons come out as 2
triangles meeting at vertices.

This little project has really helped me work more out about DAT files, and
hopefully I'll be able to continue and complete the Darth Maul and Darth
Vader heads soon, plus maybe sort out a utility to make pattern authoring a
bit easier using a click/drag-and-drop interface to place pattern points and
automatically generate the appropriate triangles and quads to map the
pattern onto the part. Here's hoping ;)

Dan



Message has 2 Replies:
  Re: VB - parts and transformation matrices, Z-ordering, optional lines, bow-tied quads - help!
 
(...) Sounds like it's a problem in your code to handle type-1 lines. Could you post some images of the problem renders? (...) You can't completely sort polygons by z-order -- some polygons cross each other in z-depth. Are you using a z-buffer to (...) (24 years ago, 26-Mar-01, to lugnet.cad)
  Re: VB - parts and transformation matrices, Z-ordering, optional lines, bow-tied quads - help!
 
(...) Another Viewer comming up. <:) (...) You are probably Pos-Multiplying the modeling Matrix, instead of Pre-Multiplying. I had that problem too ! (...) You could you the Painters Algorithm, but that is going to be slow, but prevents you from (...) (24 years ago, 27-Mar-01, to lugnet.cad)

8 Messages in This Thread:



Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR