Jump to content
  • Advertisement
Sign in to follow this  
LackOfGrace

2D matrix warp

This topic is 3162 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

im developing a simple 2d space game for simple testing of parallax backgrounds and space limitation ( more on that later ) in my 2d engine. getting a quick draft up was easy ( the math isn't too hard ;) ) so, i got the parallax functionality up and running and i got the limitation to work by limitation i mean that as an example a star should warp to the other side of the screen if it went outside creating an illusion of an endless star field problems arose when i started rotating the camera the stars would get all jumbled up ( looked like a snowstorm ) i found that the problem was my render state matrix ( which is a 4x4 transformation matrix ), and i cant for the moment wrap my head around how to elegantly solve this problem. the current solution i have is to transform a vector with the current matrix, check if it is outside the min/max for the globally vertical and horizontal axis, and then reflect this vector for the given axis. finally plugging this vector back into the matrix. but this really looks quite bad and it gives me pretty many costly matrix operations since i want to separate the horizontal and vertical warping to different values effectively doubling the amount of matrix calculations. anyway, im sure you guys here could shed some light or just give me some criticism

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!