• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Phil UK 87

Lighting problem on Intel HD Graphics 3000

12 posts in this topic

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.

0

Share this post


Link to post
Share on other sites

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.

2

Share this post


Link to post
Share on other sites

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.

2

Share this post


Link to post
Share on other sites

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.

0

Share this post


Link to post
Share on other sites

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.

1

Share this post


Link to post
Share on other sites

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?

1

Share this post


Link to post
Share on other sites

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.

1

Share this post


Link to post
Share on other sites

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.

-2

Share this post


Link to post
Share on other sites

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.

1

Share this post


Link to post
Share on other sites

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.

0

Share this post


Link to post
Share on other sites

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.

1

Share this post


Link to post
Share on other sites

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.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0