Hi Guy, > Obviously, the meshed FLT file could ne invalid, right? So I used a > different application (an old 3D Explorer app) to load the meshed version and > it works correctly. > > I can't exaplin it.
I'm able to see the mesh (osg & flt) in osgviewer with and without lighting enabled but that's probably because alpha blend is not enabled. With lighting disabled I get a pink tint (1 0 1) on the texture. It would be interesting to know how other OpenFlight viewers renders this model. Regards Brede On Thu, Mar 18, 2010 at 7:12 PM, Guy Volckaert <[email protected]> wrote: > I'm hoping that someone can help me with a weird problem I'm having with an > openflight terrain I have. > > It seems that when I mesh my terrain (with Multigen Creator 2.5.1) I can't > see it anyore. Note that the problem only occurs when I disable lighting (i.e > GL_LIGHTING). However, when I un-mesh the terrain (seperate faces) then it > works correctly, regarless of the lighting state. > > I converted the *.FLT to *.OSG so that I can look at the different between > the meshed and un-meshed version. What I discovered was that the color array > in the meshed version contained invalid RGBA components - they do not > correspond to the color set within Creator. The color should be (1,1,1,1) but > I'm getting (1,0,1,0). So it's normal that I don't see the terrain because > the alpha is 0. The green component also 0, which I can't understand as well. > > For example: > > > Code: > > ColorBinding PER_VERTEX > ColorArray Vec4Array 9 > { > 1 0 1 0 > 1 0 1 0 > 1 0 1 0 > 1 0 1 0 > 1 0 1 0 > 1 0 1 0 > 1 0 1 0 > 1 0 1 0 > 1 0 1 0 > } > > > > > The reason why I want to use the meshed version of the terrain is to improve > rendering performance. > > We've isolated the problem in the LocalVertexPool::readRecord() function in > the openflight plugin. It seems that the <alphaIndex> value extracted from > the FLT is incorrect (see snipit below). > > > Code: > > virtual void readRecord(RecordInputStream& in, Document& document) > { > [...] > if (mask & HAS_COLOR_INDEX) > { > uint32 alphaIndex = in.readUInt32(); [b]// << Bad > alphaIndex.[/b] > > int index = alphaIndex & 0x00ffffff; > uint8 alpha = alphaIndex >> 24; > osg::Vec4 color = document.getColorPool()->getColor(index); > color.a() = (float)alpha/255; > vertex.setColor(color); > > if (!color.valid()) > { > osg::notify(osg::NOTICE)<<"Warning: data error detected in > LocalVertexPool::readRecord color="<<color.r()<<" "<<color.g()<<" > "<<color.b()<<" "<<color.a()<<std::endl; > } > } > > [...] > } > > > > > Obviously, the meshed FLT file could ne invalid, right? So I used a > different application (an old 3D Explorer app) to load the meshed version and > it works correctly. > > I can't exaplin it. > > I've attached a snipit of the terrain for you to look at. It contains the > following files: > > .\gr01.rgb > .\gr01.rgb .attr > .\small_faces.flt : unmeshed version > .\small_faces.osg > .\small_mesh.flt : meshed version > .\small_mesh.osg > > Can anyone shed some light of this problem? > > Cheers, > Guy > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=25823#25823 > > > > > Attachments: > http://forum.openscenegraph.org//files/smallflt_129.zip > > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

