From: Alexander G. <ale...@gm...> - 2012-03-14 03:27:54
|
Because we obviously had samples (I'll see if I can find one in my collection!) that specified 1.0, but meant, against the spec, 'I am fully opaque', which would give AI_MATKEY_OPACITY=0 (i.e. transparent). Of course a file with this error would also return the wrong value for 0.9, but at least it would not be totally invisible in most viewers. Fixing transparency=1 to give AI_MATKEY_OPACITY=1 would have almost the same effect, except that the usual convention on Assimp material keys is that we omit them if we're unsure how to interpret the input values (this also means we don't make up default values or so). Bye, Alex Am 14.03.2012 04:12, schrieb Thales Luis Rodrigues Sabino: > I understand the fact that fully transparent objects are almost never > required, but I still didn't get why check for <1.f. > > Anyway, is it not simpler to clamp to [0,1]? > > And thanks for the reply. > > On Tue, Mar 13, 2012 at 11:53 PM, Alexander Gessler > <ale...@gm... <mailto:ale...@gm...>> wrote: > > Hi, > > this is indeed strange. Even stranger is the source code (written by > myself 2 years ago :-) > > // transparency, a very hard one. seemingly not all files are > following the > // specification here .. but we can trick. > if (effect.mTransparency > 0.f && effect.mTransparency < 1.f) { > effect.mTransparency = 1.f- effect.mTransparency; > mat.AddProperty( &effect.mTransparency, 1, AI_MATKEY_OPACITY ); > mat.AddProperty( &effect.mTransparent, 1, > AI_MATKEY_COLOR_TRANSPARENT ); > } > > My interpretation: I seem to have encountered files that claimed to be > fully transparent because of an opacity/transparency mixup in their > exporters. To keep AssimpView and other viewers from rendering such > objects as fully transparent, I didn't set the key for values of 0 and > 1. This makes sense: assuming full opacity if nothing else is specified > is common and fully transparent stuff is almost never needed. > > The question is, what to do. > > Bye, Alex > > > Am 13.03.2012 22:21, schrieb Thales Luis Rodrigues Sabino: > > I recently got an strange behavior when reading the AI_MATKEY_OPACITY > > from a Collada file. > > If the value lies in the range (0,1) it reads it fine. But, if the > value > > is 0 or 1 it is not being read and the return is an AI_FAILURE. I'm > > gonna check the collada parser. I just want to know if this is > really a bug. > > > > Here is the piece of code I'm using to check the opacity values. > > > > aiReturn ret = mat->Get<float>( AI_MATKEY_OPACITY, out ); > > bool suc = ( teste == AI_SUCCESS ); > > cout << "out " << out << " " << suc << endl; > > > > The output: -1 0 > > > > Here is the collada file I'm using > > > > <technique sid="common"> > > > > <phong> > > <emission> > > <color sid="emission">0 0 0 1</color> > > </emission> > > <ambient> > > <color sid="ambient">0 0 0 1</color> > > </ambient> > > <diffuse> > > <color sid="diffuse">1 1 1 1</color> > > </diffuse> > > <specular> > > <color sid="specular">1 1 1 1</color> > > </specular> > > <shininess> > > <float sid="shininess">511</float> > > </shininess> > > <reflective> > > <color>0.09765744 0.1602153 1 1</color> > > </reflective> > > <reflectivity> > > <float>0</float> > > </reflectivity> > > <transparency> > > */_<float sid="transparency">1.0000</float>_/* > > </transparency> > > <index_of_refraction> > > <float sid="index_of_refraction">1.6</float> > > </index_of_refraction> > > </phong> > > </technique> > > > > For instance, If transparency is equal to 0.7 it is returning 0.3, > which > > is fine. Just when it gets a value of 0 or 1 it is returning -1 > > > > Thanks in advance. > > > > -- > > Anyday, anytime. > > > > http://www.capimlokura.com.br > > > > Thales Luis Rodrigues Sabino > > TLuisRS > > > > > > > ------------------------------------------------------------------------------ > > Keep Your Developer Skills Current with LearnDevNow! > > The most comprehensive online learning library for Microsoft > developers > > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, > MVC3, > > Metro Style Apps, more. Free future releases when you subscribe now! > > http://p.sf.net/sfu/learndevnow-d2d > > > > > > > > _______________________________________________ > > Assimp-discussions mailing list > > Ass...@li... > <mailto:Ass...@li...> > > https://lists.sourceforge.net/lists/listinfo/assimp-discussions > > > ------------------------------------------------------------------------------ > Virtualization & Cloud Management Using Capacity Planning > Cloud computing makes use of virtualization - but cloud computing > also focuses on allowing computing to be delivered as a service. > http://www.accelacomm.com/jaw/sfnl/114/51521223/ > _______________________________________________ > Assimp-discussions mailing list > Ass...@li... > <mailto:Ass...@li...> > https://lists.sourceforge.net/lists/listinfo/assimp-discussions > > > > > -- > Anyday, anytime. > > http://www.capimlokura.com.br > > Thales Luis Rodrigues Sabino > TLuisRS > > > ------------------------------------------------------------------------------ > Virtualization & Cloud Management Using Capacity Planning > Cloud computing makes use of virtualization - but cloud computing > also focuses on allowing computing to be delivered as a service. > http://www.accelacomm.com/jaw/sfnl/114/51521223/ > > > > _______________________________________________ > Assimp-discussions mailing list > Ass...@li... > https://lists.sourceforge.net/lists/listinfo/assimp-discussions |