[Mesa-users] lighting problem with mesa software rendering
Brian Paul
brianp at vmware.com
Tue Jul 24 10:05:21 PDT 2012
OK, great. I'll post a patch for review. I should go into 8.0.5 and
8.1 when they're released.
-Brian
On 07/24/2012 11:01 AM, Wendt, Lars Henning wrote:
> Hi Brian,
>
> Thank you for your fast solution.
>
> It seems to work in our complex configuration too.
>
> best
> Lars
>
> -----Original Message-----
> From: Brian Paul [mailto:brianp at vmware.com]
> Sent: Dienstag, 24. Juli 2012 17:41
> To: Wendt, Lars Henning
> Cc: mesa-users at lists.freedesktop.org
> Subject: Re: [Mesa-users] lighting problem with mesa software rendering
>
> On 07/24/2012 07:56 AM, Wendt, Lars Henning wrote:
>> Hi all,
>>
>> I'm using mesa as software renderer and I get some strange lighting effects.
>> In some cases it looks like the source of light is relative to the model while it should be relative to the camera.
>> Attached you'll find some apitraces to reproduce the error.
>>
>> The problem was reproduced with the following versions of mesa:
>> 6.5.1 linux
>> 7.8.2 windows/linux
>> 8.0 windows
>>
>> It seems to me that it could be a numeric problem.
>> As you will see the modelview matrix contains rather small numbers.
>> Nonetheless other implementation doesn't have this problem or can cope with it.
>>
>> Does anybody have an idea what is wrong? Is it a bug? Is there any chance the behavior will be improved in future mesa versions? Or did I get something wrong?
>
> I think I see the problem.
>
> In src/mesa/math/m_matrix.c near line 518 we have:
>
> if (det*det< 1e-25)
> return GL_FALSE;
>
> det = 1.0F / det;
>
>
> The det (determinant) value is very small here and by returning false we're giving up on computing the inverse of the combined modelview * projection matrix.
>
> That check code dates back to 2000 or earlier. I'd guess it was a check to avoid floating point divide by zero. But I'm not sure why the square of det is used.
>
> I changed the check to read "if (det< 1e-25)" and it seems to fix the problem. Can you try that too and see what happens?
>
> -Brian
More information about the mesa-users
mailing list