Thread: RE: [Plib-users] SSG for 3ds and ASE
Brought to you by:
sjbaker
From: Dave M. <Dav...@dy...> - 2000-08-08 21:47:24
|
Dan wrote: > I'm trying to use SSG for loading up some models out of > 3DSMax, and I'm > having a few problems. Sorry if these are newbie issues, I > just started > trying to use Plib. I looked through the mailing list > archive but didn't > see these problems mentioned. > > 1. Objects with just plain color properties, no textures, > show up as white > instead of the correct color. Textured objects work > properly. I've taken > the tux_example and replaced the tux model with models from > 3DSMax, but > only textured objects show up properly. Is there something I > need to enable? all my ASE models are textured but i've been meaning to fix that. thanks for supplying the motivation. > 3. Some models load in 3ds format, but crash in ASE format. The crash > seems to happen in ssgFlatten. i've seen this too. don't use ssgFlatten or Stripify for now. Steve- can we put ssgOptimiser.cxx and ssgKeyFlier.h in ssgaux? > > I have sample files that reproduce the problems. great! please send them to me and i'll get right on it. mailto:dp...@ef... --Dave |
From: Dave M. <Dav...@dy...> - 2000-08-09 22:34:37
|
Steve Baker wrote: > > > > Dan Gelb wrote: > > > > 1. Objects with just plain color properties, no textures, > > show up as white instead of the correct color. Textured > > objects work properly. I've taken the tux_example and > > replaced the tux model with models from 3DSMax, but > > only textured objects show up properly. Is there > > something I need to enable? > > > It sounds like texturing is enabled - but no texture is > currently bound. > The problem turned out to be null color and normal arrays in a ssgVtxArray. GL_TEXTURE_2D was disabled, as it should be. The ASE exporter in 3DSMAX can dump vertex colors (if you mark the checkbox for them) but they were not present in the files you gave me. You might have to *bake* them in first using the "Assign Vertex Color Utility". It takes the scene lighting and computes each vertex color. What is you see in 3DSMAX is what you get in SSG. I always bake my colors and use texture mapping, so I didn't see the problems you were having. Regardless, ssgLoadASE should handle this better so I addressed this problem and did a CVS commit. The source change in ssgLoadASE is based on ssgLoadAC: if ( data -> st -> isEnabled ( GL_LIGHTING ) ) { if ( data -> cl == NULL ) { sgVec4 c ; sgCopyVec3 ( c, mat -> diff ) ; c[3] = 1.0f - mat -> transparency ; data -> cl = new ssgColourArray ( 1 ) ; data -> cl -> add ( c ) ; } if ( data -> vl -> getNum () >= 3 ) { sgVec3 n ; sgMakeNormal ( n, data -> vl -> get(0), data -> vl -> get(1), data -> vl -> get(2) ) ; data -> nl = new ssgNormalArray ( 1 ) ; data -> nl -> add ( n ) ; } } I already explained how to get proper vertex colors. To get proper vertex normals, things get tougher. The ASE format has vertex normals but they are wrong. :( You'll either have to compute them yourself or fix the ASE exporter and use that. The ASE exporter source comes with 3DSMAX in the MAXSDK cdrom folder. Blake Senftner has a *fixed* ASE exporter here: http://www.pond.net/~davem/asciiexp/. I have not had time to look at this. If the format is still compatible with the *old* ase format and the vertex normals are correct, I can fix the ASE loader in SSG to read them. Please let me know if you can help investigate. Anything that relates to improving support for the ASE format in SSG is very important to me. Thanks for reporting the ASE bugs. -- Dave McClurg mailto:dav...@dy... http://www.dynamix.com mailto:da...@po... (home) http://www.pond.net/~davem |
From: Steve B. <sjb...@ai...> - 2000-08-10 03:09:40
|
> Dave McClurg wrote: > The problem turned out to be null color and normal arrays in a ssgVtxArray. GL_TEXTURE_2D was disabled, as it should be. Ah - that'll do it! > I already explained how to get proper vertex colors. To get proper vertex normals, things get tougher. The ASE format has vertex normals but they are wrong. :( You'll either have to compute them yourself or fix the ASE exporter and use that. The ASE exporter source comes with 3DSMAX in the MAXSDK cdrom folder. Blake Senftner has a *fixed* ASE exporter here: http://www.pond.net/~davem/asciiexp/. I have not had time to look at this. If the format is still compatible with the *old* ase format and the vertex normals are correct, I can fix the ASE loader in SSG to read them. Please let me know if you can help investigate. Can you detect when you get an old-style file and generate normals like ssgLoadAC does? (AC3D files *never* contain normals). -- Steve Baker HomeEmail: <sjb...@ai...> WorkEmail: <sj...@li...> HomePage : http://web2.airmail.net/sjbaker1 Projects : http://plib.sourceforge.net http://tuxaqfh.sourceforge.net http://tuxkart.sourceforge.net http://prettypoly.sourceforge.net |
From: Dave M. <Dav...@dy...> - 2000-08-10 17:41:40
|
> Can you detect when you get an old-style file and generate > normals like ssgLoadAC does? (AC3D files *never* contain > normals). > ssgLoadAC doesn't generate normals. That happens in ssgOptimiser (void OptVertexList::makeNormals()). This code crashes when it runs on an ASE model. What is worse is that ASE models create indexed ssgVtxArrays and shared verticies imply shared normals. ssgOptimiser creates face normals instead of vertex normals. This means a shared vertex may require two *different* normals and the indexed ssgVtxArray would have to be rebuilt. ugh. --Dave |
From: Steve B. <sjb...@ai...> - 2000-08-11 06:42:16
|
> Dave McClurg wrote: > > > Can you detect when you get an old-style file and generate > > normals like ssgLoadAC does? (AC3D files *never* contain > > normals). > > ssgLoadAC doesn't generate normals. That happens in ssgOptimiser > (void OptVertexList::makeNormals()). This code crashes when it runs > on an ASE model. What is worse is that ASE models create indexed > ssgVtxArrays and shared verticies imply shared normals. > ssgOptimiser creates face normals instead of vertex normals. > This means a shared vertex may require two *different* normals > and the indexed ssgVtxArray would have to be rebuilt. ugh. Yikes! You understand this unholy mess better than I do! We really need to stop and think about "Loader Service Routines" before we go too much further down the loader writing curve. I'd expect nearly any loader to benefit from: * Polygon decimation to triangles. * Optimal Tristrip creation. * Parser support. * Callbacks for applications that need to extend the file format via comment fields, etc. * Callbacks for applications that need to build their own ssgStates. * Surface normal generation. * Degenerate triangle/vertex removal. * Flattening (multiplying out the matrices in ssgTransform nodes and doing a one-time transform of vertices in the leaf node) * Degenerate group removal (eg deleting ssgBranch nodes with either one or zero children - but only if the node isn't known to the application - or a derived class of ssgBranch). * ssgState sharing between leaf nodes. * Texture coordinate size reduction. ...and probably a lot more. Back when it looked like AC3D and maybe one other might be the only loaders there would ever be, I didn't take too much time to modularize this stuff. But with the likelyhood that we could end up with a dozen or more loaders eventually (especially since the advent of PPE), we need to seriously look into this. -- Steve Baker HomeEmail: <sjb...@ai...> WorkEmail: <sj...@li...> HomePage : http://web2.airmail.net/sjbaker1 Projects : http://plib.sourceforge.net http://tuxaqfh.sourceforge.net http://tuxkart.sourceforge.net http://prettypoly.sourceforge.net |
From: Steve B. <sjb...@ai...> - 2000-08-09 02:57:45
|
> Dave McClurg wrote: > > 3. Some models load in 3ds format, but crash in ASE format. The crash > > seems to happen in ssgFlatten. > i've seen this too. don't use ssgFlatten or Stripify for now. > Steve- can we put ssgOptimiser.cxx and ssgKeyFlier.h in ssgaux? They need to be rewritten to make less assumptions about what they are optimising before we can do that. Meanwhile, those routines should really only be used on something that ssgLoadAC created. -- Steve Baker HomeEmail: <sjb...@ai...> WorkEmail: <sj...@li...> HomePage : http://web2.airmail.net/sjbaker1 Projects : http://plib.sourceforge.net http://tuxaqfh.sourceforge.net http://tuxkart.sourceforge.net http://prettypoly.sourceforge.net |