|
(Follups sent to lugnet.cad.dev.)
In lugnet.cad, Kyle McDonald writes:
>
> Yes because of the way .DAT files are made, the most straight forward
> way of representing them in J3D is 1 triangle or quad -> 1 Object.
>
> J3D however does tremendously better on both speed and time if
> the triangles and quads are arranged in strips. Then each Strip
> becomes one object.
>
> I'm not sure how he wrote it up and wether or not he made much use of
> strips (I haven't read throught the sources yet,) but in my experience
> J3D makes very good use of the underlying library (OpenGL or DirectX)
> and can get very good performance.
>
> While there is a utility function that will
> try to combine triangles and quads into strips and fans, I haven't
> had much luck using it yet. I'm currently trying to write up something
> that will be able to 'stripify' .DAT files on the fly, but I'm not
> getting much time to work on it.
>
> 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.
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.
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.
> 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.
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.
--Travis Cobbs (tcobbs@san.REMOVE.rr.com)
|
|
Message has 1 Reply:
Message is in Reply To:
| | Re: JAVA - Viewer for dat-Files
|
| Hi, I'm also currently working on a very similiar program. (...) Yes because of the way .DAT files are made, the most straight forward way of representing them in J3D is 1 triangle or quad -> 1 Object. J3D however does tremendously better on both (...) (23 years ago, 25-Jan-02, to lugnet.cad, lugnet.cad.dat.parts)
|
20 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|