Re: [Plib-devel] specular exponent in 3ds files
Brought to you by:
sjbaker
From: Steve B. <sjb...@ai...> - 2005-02-03 00:17:47
|
Bram Stolk wrote: > Wings3d, an excellent 3d modeling application, can export to 3ds. > If I read the 3ds file into plib, specular lighting is horrible. > > This is caused by the fact that GL_SPECULAR is set to 1,1,1,1 > whereas GL_SHININESS is the OpenGL default 0.0 > This gives ugly results. > > I think that the wings3d exporter is at fault here, by specifying > the specular colour, but NOT the specular exponent. Plib's 3ds loader > does not seem to encounter shininess data in the file. > > Should this be handled in some smart way by plib, or would you > think this is strictly a wings3d issue? For what it's worth: SGI's > OpenGL|Performer renders 0.0 exponents for 1,1,1,1 specular without > artefacts by presumably disabling specular light for 0.0 exponents. Yes - it does. That's because it was originally implemented on top of IrisGL (the predecessor of OpenGL) - and IrisGL treats a shininess of zero as 'no specular component whatever'. OpenGL sets the exponent of the specular component to the shininess value - and an exponent of zero produces a huge shiney patch. Performer had specific code to 'fix' the OpenGL behavior to mimic IrisGL so that existing Performer programs would still work. In OpenGL (and hence PLIB), the correct way to get non-shiney surfaces is to set the material's specular colour to 0,0,0,x or the specular light source colour to 0,0,0 - at which point, it doesn't matter what the shininess setting is. So - what should the 3DS loader do? The colours and shininesses in 3DS files are not necessarily intended to have the same meaning as OpenGL gives them - so doing something like: if ( shininess == 0.0f ) spec_colour = { 0,0,0 } ; ...might not be unreasonable if 3DS takes the same view of the world that IrisGL used to take. I guess the question is: "What does the real 3D Studio do when presented with one of these files?" ---------------------------- Steve Baker ------------------------- HomeEmail: <sjb...@ai...> WorkEmail: <sj...@li...> HomePage : http://www.sjbaker.org Projects : http://plib.sf.net http://tuxaqfh.sf.net http://tuxkart.sf.net http://prettypoly.sf.net -----BEGIN GEEK CODE BLOCK----- GCS d-- s:+ a+ C++++$ UL+++$ P--- L++++$ E--- W+++ N o+ K? w--- !O M- V-- PS++ PE- Y-- PGP-- t+ 5 X R+++ tv b++ DI++ D G+ e++ h--(-) r+++ y++++ -----END GEEK CODE BLOCK----- |