From: Paolo Farinelli (paolo++at++sgi.com)
Date: 04/02/2003 11:43:37
Hi Rob,
Are you using perfly (or a perfly-derived app)? If so, I found a few
lines of perfly's source code that may be the cause for your problem.
From env.C (in /usr/share/Performer/src/sample/C++/common), in
function updateTimeOfDay:
if (ViewState->lighting == LIGHTING_SUN)
{
pfMatrix mat;
static pfVec3 nyaxis(0.0f, -1.0f, 0.0f);
mat.makeVecRotVec(nyaxis, t);
ViewState->sunDCS->setMat(mat);
ViewState->sun->setColor(PFLT_AMBIENT, 0.8f*tod, 0.8f*tod,
0.8f*tod);
}
else /* LIGHTING_EYE */
{
ViewState->sun->setColor(PFLT_AMBIENT, 0.0f, 0.0f, 0.0f);
ViewState->sunDCS->setMat(ViewState->viewMat);
}
As you can see, the ambient parameter of the pfLightSource is set to 0 when
LIGHTING_EYE lighting is enabled, and set to a higher value (which changes
with time-of-day) when LIGHTING_EYE lighting is enabled.
This could explain why the dark sides of the waves do not look so dark
under SUN illumination.
You can solve this by either reducing the ambient component of your
SUN light source, or by reducing the ambient component of the pfMaterial
associated with the sea surface geometry (through its pfGeoState).
Note that the ambient component of the active light-model also contributes
to the final color.. Here's a few lines from the glLightModel man page:
In RGBA mode, the lighted color of a vertex is the sum of the material
emission intensity, the product of the material ambient reflectance and
the lighting model full-scene ambient intensity, and the
contribution of
each enabled light source. Each light source contributes the sum of
three terms: ambient, diffuse, and specular. The ambient light source
contribution is the product of the material ambient reflectance and the
light's ambient intensity...
Hope this helps,
Paolo
Rob Body wrote:
>Hi All,
>
>RedHat Linux
>Performer 2.5
>
>I have a sea surface created as a mesh that is coloured and textured. I
>have calculated the normals for all the vertexes and these seem to be ok.
>When displaying the mesh using Sun lighting with Performer I can hardly see
>the different shading of the polygons, but when using eye lighting the
>effect is far more noticeable and gives the effect I would expect. I would
>like to be able to see the effect better with sun lighting. Is this
>possible or not ? I have seen numerous OpenGL examples but not any based
>for Performer. My normals are calculated based on the vertex position with
>in the mesh and take into account which vertexes appear in which polygon. I
>think that this is the correct way to do it as it looks ok under eye light
>conditions.
>
>I did another version that was wrong mathematically but just looked at each
>vertex and calculated the normal without looking at any of the other
>vertexes in the polygon and this gave a better result under sun light
>conditions but never showed the darker side of the wave.
>
>Has anyone who has succeeded at this ever have this problem and know how to
>fix it ?
>
>Thanks for any help.
>
>Regards
>
>Rob
>
>
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>Rob Body
>Simulator Manager
>
>HR Mardyn
>HR Wallingford
>Howbery Park
>Wallingford
>Oxon
>OX10 8BA
>
>Tel +44 (0) 1491 822327
>Fax +44 (0) 1491 832233
>
>E-mail r.body++at++hrwallingford.co.uk <mailto:r.body++at++hrwallingford.co.uk>
>
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
>
>**********************************************************************
>HR Wallingford uses Faxes and Emails for confidential and
>legally privileged business communications. They do not of
>themselves create legal committments. Disclosure to parties
>other than addressees requires our specific consent. We are
>not liable for unauthorised disclosures nor reliance upon them.
>If you have received this message in error please advise us
>immediately and and destroy all copies of it.
>**********************************************************************
>
>-----------------------------------------------------------------------
> List Archives, Info, FAQ: http://www.sgi.com/software/performer/
> Open Development Project: http://oss.sgi.com/projects/performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com
>-----------------------------------------------------------------------
>
>
-- Paolo Farinelli paolo++at++sgi.com Member of Technical Staff, OpenGL Performer 1-650-933-1808 Silicon Graphics 1600 Amphitheatre Pkwy, Mountain View, CA 94043
This archive was generated by hypermail 2b29 : Wed Apr 02 2003 - 11:43:42 PST