To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cad.dat.partsOpen lugnet.cad.dat.parts in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / LDraw Files / Parts / 3284
3283  |  3285
Subject: 
Re: JAVA - Viewer for dat-Files
Newsgroups: 
lugnet.cad, lugnet.cad.dat.parts, lugnet.cad.dev
Date: 
Sat, 26 Jan 2002 05:38:20 GMT
Viewed: 
288 times
  
Travis Cobbs wrote:

> (Follups sent to lugnet.cad.dev.)
>
> In lugnet.cad, Kyle McDonald writes:
>

>>I'm curious if any of you OpenGL/LDraw guys do much in your code
>>to generate strips from the DAT files to improve performance? I think
>>I have most of the available C/C++ code, but I haven't looked through
>>much of it yet. I know OpenGL can perform better if the data is in
>>strips, Have you found a need to do aything like that yet?
>>
>
> Well you have to careful when you do this.  The problem with strips
and fans
> is that they can only be used for smooth surfaces.  You only get one
surface
> normal for each point, so any faces connected to that point get smoothed
> around it.  This happens for all the points, and the result is smooth
> shading.  This is great for curved surfaces, but doesn't work in general.
>

I expected to run into this problem but I haven't gotten that
far yet.


> The solution to this is usually to only combine faces if the angle
between
> their surface normals is less than some critical value.  However,
while this
> will work with a lot of the surfaces on LEGO pieces, there are some
pieces
> that would show up as being curved but are actually faceted.  You
could of
> course set the critical angle to be nearly zero, and then it would only
> combine co-planar faces.
>

The utility code that comes with Java3D does have a setting for
this. It's actually pretty good. The reason I haven't tried to
use it is that it want's to know whether you're passing it
triangles or quads, and whether you want strips or fans.
Unfortunately at the time I'd like to call it, all I have is
a bunch of quads and triangles. I can separate them out (or
break the quads into triangles,) but I have no idea, which
(strips or fans) to tell the utility to turn the triangles
into.

Also J3D (and the utility i think) will let me specify both
vertex and face normals, so I may be able tune the outcome
somewhat.


> However, it is quite difficult to produce a good set of strips/fans
from an
> arbitrary set of triangles and quads.  There are programs that do it,
> though. I've seen one on an SGI workstation that processed a data set and
> then came up with an optimal set of triangle strips.  I can't
remember how
> long the processing took, though.
>


I think the J3D algorithm does this pretty good. Wouldn't
surprise me if it was related to the code SGI had :)


>
>>An Idea I've had recently was a possible extension to the DAT format
>>for strips. Maybe some thing like
>>
>>0 STRIP Begin Triangle
>>3 ...
>>3 ...
>>3 ...
>>0 STRIP End
>>
>>But I've been putting off suggesting it, because I'm still hopeful
>>to find an algorithm that can build the strips on the fly from the
>>data already in the DAT file. who knows.
>>
>
> That would make life a whole lot easier, but would definitely require the
> parts authors to thouroughly understand strips and fans.  I'm not
sure how
> much luck you will have with stripifying on the fly though (while still
> keeping the model load time relatively low).  I'm not positive, but I
think
> truly optimal stripifying is an NP-Complete problem.  The complexity
is cut
> way down if you don't allow strips to cross part boundaries, though.
>

Yes. Because of how I build the scenegraph, and because I try
to reuse the geometry on a file by file basis, I was planning
on only 'stripifying' together geometry that came from the same
.DAT file.

I also considered trying to expand all the primitives out for
each .DAT found in the PARTS directory, so that maybe I could
optimize the geometry for each part, and still reuse the
geometry each time the part is reused. But I've put that idea
off for now. Duplicating the geometry and transforming the
vertices seemed like it might take too much time and memory.


> In LDView I only use strips and fans during primitive substitution at the
> moment.  I think all my substitued primitives use them, though.  This
gives
> me a performance increase and forces me to properly calculate the surface
> normals for smooth shading.
>


The fact that most of the geometry commands are located in the
primitives had occurred to me, and I have investigating
replacing the common primitives with J3D optimized geometry that
I could build into the program. I just haven't gotten that far
yet. Maybe I should look into that first.

Thanks for the info. I think I grabbed your source. I think I'll
look through it this weekend.


-Kyle


--
   _
-------------------------------ooO( )Ooo-------------------------------
Kyle J. McDonald (o o)        Systems Support Engineer
Sun Microsystems Inc. |||||
High End Server Engineering   Kyle.McDonald@Sun.COM
1 Network Drive BURL03-403 \\\//         voice:   (781) 442-2184
Burlington, MA 01803 (o o)            fax:   (781) 442-1646
-------------------------------ooO(_)Ooo-------------------------------



Message is in Reply To:
  Re: JAVA - Viewer for dat-Files
 
(Follups sent to lugnet.cad.dev.) (...) Well you have to careful when you do this. The problem with strips and fans is that they can only be used for smooth surfaces. You only get one surface normal for each point, so any faces connected to that (...) (23 years ago, 26-Jan-02, to lugnet.cad, lugnet.cad.dat.parts, lugnet.cad.dev)

20 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