What range of values may I expect in the ‘shininess’ element of the Blinn and Phong elements? I noticed that some of the moon buggy shininess values go up to around 264.
Is it possible to derive a value that would be compatible with the specular shininess material property of OpenGL (0-128)? My goal is to render the moon buggy with lighting as near as possible to the reference image provided, if this is possible.
Thanks in advance,
From the spec:
To maximize application compatibility, it is suggested that developers use the Blinn-Torrance-Sparrow for <shininess> range of 0 to 1. For <shininess> greater than 1.0, the COLLADA author was probably using an application that followed the Blinn-Phong lighting model, so it is recommended to support both Blinn equations according to whichever range the shininess resides in.
That’s for the <blinn> element. For <phong>, I believe the range is just unconstrained.
Here’s what I would do for mapping to fixed function OpenGL, for both <blinn> and <phong>:
if the value is in the range [0, 1], scale it to [0, 128]
if the value is outside that range, clamp it to [0, 128]
Thank you for getting back to me so quickly.
I had been working along those lines by taking a min and max sample of each shininess value during XML parsing and then scaling them accordingly during the ‘build’ process.
Further to your suggestion, I am now clamping rather than scaling for values greater than 1.0.
Unfortunately, in the OpenGL fixed function pipeline, the specular highlights still appear quite dramatically ‘spread out’ even with this measure in place, making the moon buggy look very bright and shiny all over.
I tried ‘hard-coding’ the specular exponent to 128.0 as a test and this made the render look very similar to the reference image, though clearly this isn’t a workable solution.
Should I be considering writing a GLSL phong shader to get closer to the reference image, or should the fixed function pipeline be capable producing something near to what I can see in the reference image?
Further to my previous message, I realised that the specular exponent of Phong is not the same as the specular exponent of Blinn-Phong. So when working with the OpenGL fixed-function pipeline, some translation of the value will need to occur unless a phong shader is used.
Is it possible to confirm whether the reference image for the moon buggy has been rendered with any specular? Looking more closely, specular highlights appear to be missing - I may be mistaken of course. Clearly they are in the .dae file.
I’m not sure what reference image you’re referring to. In general there isn’t any Collada renderer out there I really trust, so I wouldn’t worry too much about how things look in any one particular renderer. This sucks though because it makes it hard to validate your own renderer.
Actually your best bet for a reference image is to look at it in the source package. So if it’s made in Maya check it out in Maya, etc.
There’s a sample render included with the moon buggy in JPEG format (sample.jpg) which has been very useful up to a point. It’s unclear what what used to render the image but I assume that it was Maya since the descriptive elements of the .dae file refer to Maya 8.0 explicitly.
Unfortunately, in the absence of a .ma file, it’s only possible to open it up in Maya by re-importing the .dae. In Maya 2008 we found that this resulted in some of the geometry going missing so that wasn’t a workable solution.
However, I believe that we have ended up with something that is hopefully a close facsimile to the original model by examining the sample JPEG as well as the lighting values in the .dae file. It has been a very useful model for testing purposes since it incorporates a number of fundamental schema elements.
I am puzzled by the shininess range of 0 to 1 that supposedly is there “To maximize application compatibility…”. If I read Blinn’s 77 SIGGRAPH paper as referenced in the COLLADA specification, then the range for shininess c2 in the Torrance-Sparrow model is 0 to infinity and any meaningful values for c2 are > 1. More precisely, the proposed conversion from Torrance-Sparrow to Phong shininess is:
c1 = -log(2)/log(cos(sqrt(log(2))/c2))
which suggest that the c2 shininess value that achieves a c1 shininess of 128 (OpenGL max) is around 8. (OpenGL fixed pipeline is using the Phong model).
So, my question is: What is the source of the [0,1] range for shininess that supposedly represents the c2 in the Torrance-Sparrow model? And why wasn’t the choice made for the Phong shininess exponent c1 in the spec that everyone in graphics is using?
BTW, almost all examples in the spec show a shininess value > 1.
I can only suspect the authors of the spec had physically-based lighting models in mind when they speak about the shininess range 0…1.
Typically this is meant as a dimensionless surface roughness parameter, with 0 being very rough, and 1 being very smooth. This way it can be meaningfully bound to a texture. The blinn-phong exponent is then usually something like exp2( factor * roughness ). But in order for this to make sense, the model must be normalized. You can google for “normalized blinn-phong” to see what I mean.