iDevGames Forums
2d parallax scrolling - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: 2d parallax scrolling (/thread-1364.html)



2d parallax scrolling - NelsonMandella - Apr 30, 2009 03:59 PM

I'm working on a completely 2d opengl isometric game very similar to diablo II. The one thing about the diablo II engine I can't figure out is how they achieved the parallax scrolling effect which adds a kind of pseudo 3d perspective(I believe that Diablo II, like my game, uses textures quads as sprites and no 3d geometry). Might anyone have any insight into just how they pulled this off?


2d parallax scrolling - Oddity007 - Apr 30, 2009 06:30 PM

Code:
zfactor=(z-near)/far
screenpos={x*zfactor,y*zfactor}
This is what Opengl does in hardware anyway.
This results in further points moving slower.
Scale an image by the zfactor to get it scaled to perspective.


2d parallax scrolling - NelsonMandella - Apr 30, 2009 08:03 PM

The only problem with that is that you can't scale 2d isometric tile sprites, they become misaligned.


2d parallax scrolling - AndyKorth - Apr 30, 2009 09:34 PM

I think they might have done some sort of render to a texture effect in diablo II.

Although here some other guy has a different idea:
http://www.gamedev.net/community/forums/topic.asp?topic_id=532278


2d parallax scrolling - Skorche - Apr 30, 2009 10:20 PM

I never really played Diablo much, but I do remember seeing the effect you are talking about. I seem to recall thinking that they probably just rendered the scene actually in 3D using a pseudo-perspective transformation. You certainly can't get the effect just by adjusting offsets of your tiles.


2d parallax scrolling - NelsonMandella - Apr 30, 2009 11:05 PM

Skorche Wrote:I never really played Diablo much, but I do remember seeing the effect you are talking about. I seem to recall thinking that they probably just rendered the scene actually in 3D using a pseudo-perspective transformation. You certainly can't get the effect just by adjusting offsets of your tiles.

What exactly is a "pseudo-perspective transformation"? Also when you say 3d do you mean sprites or billboards rendered in 3d space?


2d parallax scrolling - Skorche - May 1, 2009 07:09 AM

I mean that it didn't quite look like a normal perspective transform to me, but I don't really remember why.

Sprites and upright scenery would be drawn as billboards, but you would have to give everything a z-coordinate. The ground would have to be drawn as a quad for each tile placed flat horizontally to the camera so that it would get the perspective distortion effect.