Page 1 of 1

[1.12] DirectX 9 + lighting gives black texture

Posted: Fri May 10, 2019 8:38 am
by Julianis
Ogre Version: :1.12:
Operating System: :Windows 10:
Render System: :DirectX 9:

I just updated our application with the 1.12 version (thanks for the support of #include with glsl, it is much appreciated) and it seems there is an issue with the DX9 render system.

We got simple materials: texture 1D or 2D, lit or not, using the fixed pipeline.

When the lighting is enabled, with DX9, the texture becomes all black but is still lighted.
If I disable the lighting, the render is correct.
If I use the opengl rendersystem, all renders are ok.
And of course it was correctly rendered with 1.11.5.

Image
DX9 without lighting, render is ok

Image
DX9 with lighting enabled, render is not ok

Image
opengl with lighting enabled, render is ok.

Regards

Re: [1.12] DirectX 9 + lighting gives black texture

Posted: Fri May 10, 2019 10:53 am
by paroj
can you reproduce the issue with any of the samples? Or alternatively provide a simple scene to reproduce it?

Also please try 1.11.6 as it will help narrowing down the offending change.

Re: [1.12] DirectX 9 + lighting gives black texture

Posted: Fri May 10, 2019 12:58 pm
by Julianis
I'm building with 1.11.6 to check the results.

In the meantime, I found out it seems to be related to the light and not the texture. If I switch to a spotlight, I got the following:


Image

instead of

Image

The dark area should be lighted.

So it seems I got a black light instead of a coloured one.
I'm rechecking the light configuration but it seems ok.

Re: [1.12] DirectX 9 + lighting gives black texture

Posted: Fri May 10, 2019 1:19 pm
by Julianis
Ok, seems I found out the issue:

Code: Select all

    void D3D9RenderSystem::applyFixedFunctionParams(const GpuProgramParametersSharedPtr& params, uint16 mask)
    {
        D3DMATERIAL9 material;
[b]        D3DLIGHT9 d3dLight;[/b]
        ...
      }
The variable d3dLight is configured from the shaders parameters.
But the d3dLight.ambient variable is never configured. So it is left unitialised with random value and incorrect.

In 1.11.5 it was set to 0 with ZeroMemory().
If I set the d3dLight.ambient to 0, the display is ok.

Re: [1.12] DirectX 9 + lighting gives black texture

Posted: Mon May 13, 2019 11:17 am
by Julianis