OpenGL API Specifications
Documents and Learning ResourcesSupport Libraries and FrameworksFunction Libraries and GeneratorsThis list contains some basic resources for getting started with, and developing for, OpenGL 3.0 and onwards. Contact your forum moderator if you want to contribute to the list or have any comments.Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.
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.
Posted 16 July 2012 - 08:38 PM
Posted 16 July 2012 - 09:39 PM
This is the case, because you don't want to affect the vector by a translation, when multiplying with a transformation matrix. The transformation should only rotate the vector.I realize the final coordinate, the w-coordinate, should be 0.
(1,0,1)upper-west
When you transform a vertex or vector you move it from one space (i.e. world space) into an other space (i.e. camera space aka eye view). Lighting is often done in camera space, therefore you need to transform all vectors/vertices into the same space. When transforming a model this is done automatically by the transformation matrix, when you set a direction vector for lightning you need to transform it before uploading it to the GPU, that is transform * (lx,ly,lz,0) .Also, are there any gotcha's with lighting when it comes to directional lighting? I saw something about having to apply the light's position AFTER pushing in all of your geometry, otherwise it doesn't translate/move correctly.
Edited by Ashaman73, 16 July 2012 - 11:05 PM.
Posted 16 July 2012 - 10:23 PM
Follow my RTS game ICBM
https://twitter.com/dpadam450
http://www.gamedev.net/blog/2202-dpadam450s-journal/
Posted 17 July 2012 - 12:00 PM
From http://www.opengl.or...tml/glLight.xml : When glLight* is called with the GL_POSITION argument, the "position is transformed by the modelview matrix when glLight is called (just as if it were a point), and it is stored in eye coordinates."Also, are there any gotcha's with lighting when it comes to directional lighting?
Posted 17 July 2012 - 09:42 PM
Posted 17 July 2012 - 09:53 PM
yesWouldn't to the west and up (as per my prior description) be (-1,0,1)
A light with w = 0, means it is directional and not effected by translation basically 0*translation is what the math comes out to be. If you want a positional light such as a lamp post then yea something like that.Assuming that for whatever reason I had translated to some arbitrary point, making it the center (say, [x, y, z]), the resulting light would require the light direction to be (x -(-1), y, z - 1) => (x + 1, y, z -1), correct?
Follow my RTS game ICBM
https://twitter.com/dpadam450
http://www.gamedev.net/blog/2202-dpadam450s-journal/
Posted 18 July 2012 - 08:58 AM
Posted 18 July 2012 - 09:16 AM
Follow my RTS game ICBM
https://twitter.com/dpadam450
http://www.gamedev.net/blog/2202-dpadam450s-journal/
Posted 18 July 2012 - 09:52 AM
Posted 18 July 2012 - 12:27 PM
Follow my RTS game ICBM
https://twitter.com/dpadam450
http://www.gamedev.net/blog/2202-dpadam450s-journal/
Posted 18 July 2012 - 12:51 PM
Posted 18 July 2012 - 01:22 PM
So you have shadows but not lighting? Post a pic.The Shadow Mapping part works great at the bottom, but the top part seems to be screwing up somehow.
Follow my RTS game ICBM
https://twitter.com/dpadam450
http://www.gamedev.net/blog/2202-dpadam450s-journal/
Posted 18 July 2012 - 05:36 PM
Edited by Terin, 20 July 2012 - 11:33 PM.
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.
GameDev.net™, the GameDev.net logo, and GDNet™ are trademarks of GameDev.net, LLC.