Jump to content

  • Log In with Google      Sign In   
  • Create Account

Lighting problem on Intel HD Graphics 3000


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
12 replies to this topic

#1 Phil UK 87   Members   -  Reputation: 115

Like
0Likes
Like

Posted 20 February 2013 - 08:58 AM

Hi guys, I'm working on a project which uses DirectX 9 to render a detailed 3D scene and I have a problem. The program was developed for machines with Nvidia graphics on which it works correctly, but now it needs to be altered to run on a laptop with HD Graphics 3000 (2nd gen i7).

 

It seems that lighting isn't working at all; textures are visible but they look like they are being lit with white ambient lighting instead of the lights in the scene. Everything that isn't textured appears white (invisible against the white background) although some edges of objects are partially visible. Does this sound like a familiar problem to anyone? If anyone has any advice it would be greatly appreciated. I've already tried setting the program to load only one object and that didn't change anything, so it doesn't seem to be the amount of 3D data that's causing the problem.



Sponsor:

#2 Seabolt   Members   -  Reputation: 633

Like
2Likes
Like

Posted 20 February 2013 - 09:14 AM

Unfortunately, this can happen for a lot of reasons. You best bet is to bring up your scene in PIX and see exactly what is going wrong in the shader.


Perception is when one imagination clashes with another

#3 Nik02   Crossbones+   -  Reputation: 2923

Like
2Likes
Like

Posted 21 February 2013 - 06:28 AM

Also, if you haven't already, update the Intel graphics driver :)

 

The ones that are commonly pre-installed are usually very poor in terms of features, even though they would be stable otherwise.

 

It is also worth noting that Intel integrated graphics have never been - nor likely will be - as feature-rich as discrete GPUs from NVidia or AMD, even though later versions of D3D do try to fix the feature parity issue.


Niko Suni


#4 Phil UK 87   Members   -  Reputation: 115

Like
0Likes
Like

Posted 21 February 2013 - 10:02 AM

Thanks for the help. I couldn't get PIX to work with the program, I think I'd have to strip it down to just DirectX code which would take ages because it's a massive project and the DirectX code is mixed in with lots of other classes.

 

I already updated the graphics driver which didn't change anything. Nik, I'm not sure what you mean by "later versions of D3D", do you mean that I should update the DirectX runtime? i.e. from here: http://www.microsoft.com/en-us/download/details.aspx?id=8109

 

One more thing, the renderer isn't particularly complicated in that it just uses diffuse lighting and some texturing, no shaders as far as I can tell. It's just that there is a massive amount of geometry (hundreds of MBs of .x files). I think due to this complexity the programmers who worked on it before did something to optimize the renderer for Nvidia cards which could be why the Intel GPU has trouble with it. Unfortunately the other programmers moved on a while ago so I can't ask them what they did.



#5 Seabolt   Members   -  Reputation: 633

Like
1Likes
Like

Posted 21 February 2013 - 10:21 AM

Can you post your device creation code?


Perception is when one imagination clashes with another

#6 ATEFred   Members   -  Reputation: 1127

Like
1Likes
Like

Posted 21 February 2013 - 12:48 PM

Try analysing a frame with intel GPA (intel's version of Pix/Nsight). It's pretty stable, and should give you a good idea of what is going wrong.



#7 phil_t   Crossbones+   -  Reputation: 4096

Like
1Likes
Like

Posted 21 February 2013 - 08:26 PM

Assuming it's not a driver issue, it's most likely some assumption your code is making - perhaps some undefined state that you're relying on, which just happens to be ok with most graphics cards. Or maybe (given the description of your problem) some problem with setting shader constants.

Have you tried enabling the DirectX debug runtime and seeing if it spits out any interesting messages?

 

 the renderer isn't particularly complicated in that it just uses diffuse lighting and some texturing, no shaders as far as I can tell

 

No shaders? Is it using the fixed function pipeline?



#8 Nik02   Crossbones+   -  Reputation: 2923

Like
1Likes
Like

Posted 22 February 2013 - 01:46 AM

If the geometry is extremely massive (as you say), you may hit the boundary of how many primitives you can draw in one call.

 

By "later versions" I mean D3D10 and later; in contrast to D3D9, the newer APIs aim to unify the feature set across same-era hardware, while the performance is the biggest varying factor between low and high end.


Niko Suni


#9 kubera   Members   -  Reputation: 968

Like
-2Likes
Like

Posted 22 February 2013 - 07:34 AM

The reason would be the lack of required shader model.

Maybe the GPU has no PS 2.0/3.0 support, which could not be emulated.

 

The latest Intel's GPUs work correctly, I think.



#10 mhagain   Crossbones+   -  Reputation: 8280

Like
1Likes
Like

Posted 22 February 2013 - 06:03 PM

The reason would be the lack of required shader model.

Maybe the GPU has no PS 2.0/3.0 support, which could not be emulated.

 

The latest Intel's GPUs work correctly, I think.

 

The Intel HD 3000 is DX 10.1 capable - I don't think we need be concerned with this as a possible explanation.


It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#11 Phil UK 87   Members   -  Reputation: 115

Like
0Likes
Like

Posted 12 March 2013 - 05:49 AM

Sorry it took me so long to reply, I'll try and answer everyone.

 

 

Can you post your device creation code?

 

Here is the device creation code and the code surrounding it:

 

// Display Mode properties
D3DDISPLAYMODE d3ddm;

// Get Adapter Display Mode
V_RETURN( m_pD3D->GetAdapterDisplayMode( D3DADAPTER_DEFAULT, &d3ddm ));

// Zero the DirectX Presentation Parameters
ZeroMemory( &m_d3dpp, sizeof( m_d3dpp ));

// Set the Presentation Parameter properties
m_d3dpp.Windowed               = TRUE;
m_d3dpp.SwapEffect             = D3DSWAPEFFECT_DISCARD;
m_d3dpp.BackBufferFormat       = d3ddm.Format;
m_d3dpp.EnableAutoDepthStencil = TRUE;
m_d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
m_d3dpp.PresentationInterval   = D3DPRESENT_INTERVAL_IMMEDIATE;

// Create the DirectX Device
V_RETURN( m_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_MIXED_VERTEXPROCESSING | D3DCREATE_MULTITHREADED, &m_d3dpp, &m_pd3dDevice ));	

// Setup the basic render state
V_RETURN( m_pd3dDevice->SetRenderState( D3DRS_ALPHAREF, ( DWORD )0x00000001 ));
V_RETURN( m_pd3dDevice->SetRenderState( D3DRS_ALPHATESTENABLE, TRUE ));
V_RETURN( m_pd3dDevice->SetRenderState( D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL ));

V_RETURN( m_pd3dDevice->SetRenderState( D3DRS_LIGHTING,TRUE ));
V_RETURN( m_pd3dDevice->SetRenderState( D3DRS_DITHERENABLE, TRUE ));
V_RETURN( m_pd3dDevice->SetRenderState( D3DRS_ZENABLE, TRUE ));
V_RETURN( m_pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_CCW ));
V_RETURN( m_pd3dDevice->SetRenderState( D3DRS_NORMALIZENORMALS, TRUE ));
V_RETURN( m_pd3dDevice->SetRenderState( D3DRS_SPECULARENABLE, TRUE ));
V_RETURN( m_pd3dDevice->SetRenderState( D3DRS_MULTISAMPLEANTIALIAS, TRUE ));

// Setup Texture Rendering States
V_RETURN( m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE ));
V_RETURN( m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ));
V_RETURN( m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_CURRENT ));
V_RETURN( m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ));
V_RETURN( m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ));
V_RETURN( m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ));

V_RETURN( m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR ));
V_RETURN( m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR ));

 

 

Try analysing a frame with intel GPA (intel's version of Pix/Nsight). It's pretty stable, and should give you a good idea of what is going wrong.

 

I couldn't get GPA to work on XP, and could only find a version which requires Vista / 7. Do you know if there is still a version available which will run on XP?

 

 

Assuming it's not a driver issue, it's most likely some assumption your code is making - perhaps some undefined state that you're relying on, which just happens to be ok with most graphics cards. Or maybe (given the description of your problem) some problem with setting shader constants.

Have you tried enabling the DirectX debug runtime and seeing if it spits out any interesting messages?

 

 

 the renderer isn't particularly complicated in that it just uses diffuse lighting and some texturing, no shaders as far as I can tell

 

No shaders? Is it using the fixed function pipeline?

 

It doesn't seem to be using shaders, at least I haven't seen any shader code. Is there any reason why the fixed funtion pipeline would cause problems, apart from how limiting it is compared to a shader based renderer?

 

 

If the geometry is extremely massive (as you say), you may hit the boundary of how many primitives you can draw in one call.

 

By "later versions" I mean D3D10 and later; in contrast to D3D9, the newer APIs aim to unify the feature set across same-era hardware, while the performance is the biggest varying factor between low and high end.

 

As I said, I have changed the code to only render one object and the problem still remains. I agree about the DirectX versions though, perhaps if DirectX 10 was used we wouldn't have this problem.

 

 

The reason would be the lack of required shader model.

Maybe the GPU has no PS 2.0/3.0 support, which could not be emulated.

 

The latest Intel's GPUs work correctly, I think.

 

The Intel HD 3000 is DX 10.1 capable - I don't think we need be concerned with this as a possible explanation.


I agree, especially if it doesn't use any shaders as I think it does.

 

 

Also, I've tried running the program with D3DDEVTYPE_REF on both the laptop and one of the machines with Nvidia graphics, and in both cases the same rendering problem occurs (it only works properly on the Nvidia machine using D3DDEVTYPE_HAL). This makes me think there is something wrong with our DirectX code, because I thought that D3DDEVTYPE_REF was meant to work on any hardware.



#12 mhagain   Crossbones+   -  Reputation: 8280

Like
1Likes
Like

Posted 12 March 2013 - 07:25 AM

The reference device is just a software emulation of the entire D3D pipeline, so if it doesn't work on that then the most obvious explanation is that you've got a code bug but the NVIDIA device is doing something non-standard to make it appear as though it's working.

 

You could try creating with D3DCREATE_SOFTWARE_VERTEXPROCESSING, which will run the per-vertex pipeline in software; this is more of a test than anything else and I'm willing to bet that it will also reproduce the bug on all devices.

 

One possible explanation is that the NVIDIA has a bad initial state somewhere.  The D3D documentation specifies the initial values for all Render/TextureStage/Sampler states, but the NVIDIA driver may be doing something different - in other words what I'm saying is that the devices where it doesn't work are actually doing the right thing, whereas the NVIDIA is doing the wrong thing but the hypothetical bad initial state is causing it to appear as if it were working.

 

One way of testing this would be to do a bunch of GetRenderState/GetSamplerState/GetTextureStageState calls at startup for each device and comparing the results; if the theory is correct you should see something different for the NVIDIA.


It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#13 Phil UK 87   Members   -  Reputation: 115

Like
0Likes
Like

Posted 13 March 2013 - 08:01 AM

I tried D3DCREATE_SOFTWARE_VERTEXPROCESSING (with D3DDEVTYPE_HAL) but this caused a blank screen on the laptop i.e. no geometry visible. On the Nvidia machine this causes a BSOD.

 

I added a lot of GetRenderState/GetSamplerState/GetTextureStageState calls at the end of the main render function, traced the results and did a comparison for both machines. The only difference was:

D3DRS_POINTSIZE_MAX = 1174405120 (Nvidia)
D3DRS_POINTSIZE_MAX = 1132462080 (Laptop)

 

I don't know if this could cause a problem. I could post some more results from the GetRenderState/GetSamplerState/GetTextureStageState calls if you think that would help.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS