[Piglit] GL_LIGHTING test

Michal Suchanek hramrach at centrum.cz
Thu Aug 12 06:38:35 PDT 2010


On 12 August 2010 15:12, Brian Paul <brianp at vmware.com> wrote:
> On 08/12/2010 05:18 AM, Michal Suchanek wrote:
>>
>> On 12 August 2010 00:11, Brian Paul<brianp at vmware.com>  wrote:
>>>
>>> On 08/11/2010 10:01 AM, Michal Suchanek wrote:
>>>>
>>>> Hello
>>>>
>>>> I experience issues with some 3D applications rendering odd (too
>>>> bright) on a r600.
>>>>
>>>> Going through mesa demos I noticed that GL_LIGHTING produces different
>>>> result on r600 than other cards making the bright area larger.
>>>>
>>>> I wrote a test that checks for this difference.
>>>>
>>>> For me it fails on r600, r600g and llvmpipe and succeeds on swrast. It
>>>> should also succeed on r300 or i915 which render the demo much like
>>>> swrast but I did not actually run the test on them.
>>>>
>>>> The test can be found at
>>>> http://repo.or.cz/w/piglit/hramrach.git/shortlog/refs/heads/wip
>>>>
>>>> I would like to get a test for this issue into piglit so that it's
>>>> easy to check.
>>>>
>>>> If the test is inadequate please specify how it should be improved.
>>>
>>> I took a quick look and it appears that gallium/softpipe/llvmpipe are
>>> correct but swrast is wrong.  NVIDIA's driver agrees with gallium too.
>>>
>>> I think the issue is the light source is positioned behind the object so
>>> there should be no diffuse contribution to the final color.  I don't know
>>> why swrast (tnl, actually) is producing non-zero diffuse lighting in this
>>> case.
>>>
>>
>> AFAICT the light source is in front of the object. If it were behind
>> the whole object would be dark.
>
> The light position is:
>
> GLfloat light_position[4] = { 0, 0, -(1.0 * radius * 2.3), 1 };
>
> Z is negative there and the modelview matrix is the identity when the
> glLight() call is made.
>
> With gallium drivers and the NVIDIA driver the object is dark (no diffuse
> contribution), as I would expect.
>

With any driver the object is dark when the light is placed in the
positive z subspace.

The difference in rendering between swrast and llvmpipe is quite
subtle. The object is lit with either driver but the bright area is
slightly larger with llvmpipe and the gradient steeper around it than
with swrast.

There are two lighting results and which is correct is disputable. The
one produced by r300/swrast/Intel looks more natural to me than the
one produced by r600/r600g/llvmpipe but the scene is obviously
artifical so I can't judge unless I looked up some specs on the
lighting.

Thanks

Michal


More information about the Piglit mailing list