[1.12] DirectX 9 + lighting gives black texture

Problems building or running the engine, queries about how to use features etc.
Post Reply
Julianis
Gnoblar
Posts: 4
Joined: Fri May 10, 2019 8:17 am
x 3

[1.12] DirectX 9 + lighting gives black texture

Post 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
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

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

Post 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.
Julianis
Gnoblar
Posts: 4
Joined: Fri May 10, 2019 8:17 am
x 3

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

Post 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.
Julianis
Gnoblar
Posts: 4
Joined: Fri May 10, 2019 8:17 am
x 3

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

Post 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.
Julianis
Gnoblar
Posts: 4
Joined: Fri May 10, 2019 8:17 am
x 3

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

Post by Julianis »

Post Reply