<p>I've been using OpenGL for years, but after trying to use D3D for the first time, I wasted a significant amount of time trying figure out how to make my scene lights stay fixed in the world rather than fixed on my objects.</p>

<p>In OpenGL light positions get transformed just like everything else with the MODELVIEW matrix, so to get lights fixed in space, you set up your MODELVIEW the way you want for the lights, and call glLightPosition then set it up for your geometry and make geometry calls.   In D3D that doesn't help.</p>

<p>(Comment -- I eventually figured out the answer to this one, but I couldn't find anything helpful on the web or in the MSDN.  It would have saved me a few hours of head scratching if I could have found this answer then.)</p>

[{'answer_id': 71802, 'author': 'Baxissimo', 'author_id': 9631, 'author_profile': 'https://Stackoverflow.com/users/9631', 'pm_score': 2, 'selected': False, 'text': '<p>The answer I discovered eventually was that while OpenGL only has its one amalgamated <code>MODELVIEW</code> matrix, in D3D the "world" and "view" transforms are kept separate, and placing lights seems to be the major reason for this.  So the answer is you use <code>D3DTS_VIEW</code> to set up matrices that should apply to your lights, and <code>D3DTS_WORLD</code> to set up matrices that apply to the placement of your geometry in the world.</p>\n\n<p>So actually the D3D system kinda makes more sense than the OpenGL way.  It allows you to specify your light positions whenever and wherever the heck you feel like it once and for all, without having to constantly reposition them so that they get transformed by your  current "view" transform.  OpenGL has to work that way because it simply doesn\'t know what you think your "view" is vs your "model".  It\'s all just a modelview to GL.</p>\n\n<p>(Comment - apologies if I\'m not supposed to answer my own questions here, but this was a real question that I had a few weeks ago and thought it was worth posting here to help others making the shift from OpenGL to D3D.  Basic overviews of the D3D lighting and rendering pipeline seem hard to come by.)</p>\n'}, {'answer_id': 71879, 'author': 'Lee Baldwin', 'author_id': 5200, 'author_profile': 'https://Stackoverflow.com/users/5200', 'pm_score': 0, 'selected': False, 'text': "<p>For the fixed function pipeline, the lights position and direction are set in world space.  The docs for the light structures do tell you that, but I'm not surprised that you missed it in the docs.  There's not much information on the fixed function pipeline anymore as the focus has to programmable shaders.</p>\n"}]
['https://Stackoverflow.com/questions/71720', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/9631/']