Archived

This topic is now archived and is closed to further replies.

Programming Final Fantasy (VII/VIII/IX) with OGL Style

This topic is 5959 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

I suppose that most of you have tried Final Fantasy VII/VIII/IX, they use 3D textured polygon (except FF VII where most of the character is not textured) above 2D prerendered Bitmap. I Want to know how these bitmaps can overlay the character nicely (some covering parts of the character as if the whole game is a simple 2D game), I''ve played those games in an emu, ePSXe and used Lewpy''s Glide Plugin to check the wireframe. The backgroud is pure bitmap, only cracked in 16x16 "chunks", then arranged to be a big wallpaper. But then there are some sprites, I want to know how to render this nicely (realisticly, as if the 3D model blends nicely on the 2D bg), I want to know how to do this in OpenGL, because i usually use the Ortho Screen for 2D rendering (and it is in a completely diffrent world from the 3D space). If the backgrouns is not rendered in an Ortho kind of way, how do I draw 2D graphics on a 3D world correctly ? And as I have said that FF breaks its background to a small 16x16 px block and then arranged to form a big background (in the 320x224 resolution). I tried to do this in OpenGL and it worked fine (it eliminates texture size limitations, but surely eats up big VRAM), The problem is if my screen resolution is diffrent from my Ortho resolution there will be some texture cracks (in some places, makes a 1 big horizontal/vertical line), can someone explain to me why this happens ? It also happens if I use windowed and then maximize the window then restore it. Thanks all (sorry for the long post)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
If you''d read the RedBook or the opengl spec, you''d realise that all implementations of opengl must have a projection matrix stack which is 2 deep - therefore you can push/pop the projection matrix as you would the modelview matrix, and have both an Ortho view and a Pespective view.

Share this post


Link to post
Share on other sites
Hi Ak37,

I''m working on a similar engine now, more Resident Evil than FF but the rendering engine is similar. My engine is full-3d internally, with 2d just for the background and scores, etc. I don''t know how final Fantasy does it, but here is how I do it -

My (temporary) solution to this was have a seperate low-polygon mesh of the location that I also use for collision detection. I render this mesh which fills in the depth buffer, then draw the background with depth-writes turned off. This means that your character will appear behind pieces of the background that are nearer the camera. The problem with this method is that the near-camera portions of the background will normally be straight-edged and not detailed as it has to be represented by a low-polygon mesh. I have designed my locations around this restriction though, so it isn''t too much of a problem.

An idea that I''m going to try when I have time is to render items that could be in front of the character one at a time (no other items at all) but with same lighting in the 3d package. This will create an image that you can use to create an alpha-map and just draw a 2d alpha blended polygon in screen coordinates as a patch at the right depth over the top of the scene. The alpha channel would correspond to whether the individual items image had a background or an object pixel at the corresponding screen pixel. This may cause some aliasing problems at the edges of the item, but rendering it (in the 3d package) with both a black and a white background will let you work out an alpha value for each pixel of the object, so it should anti-alias itself over the top of you character properly. This idea is untested so far though, so I may be wrong. I can let you know how I get on next month once our basic prototype is done.

For your texture crack problem, have you tried turning on UV clamping rather than UV wrapping when your render the background? That fixed it for me.

Hope this helps or at least gives you some ideas to try,

Dan

Share this post


Link to post
Share on other sites
thanks to Anonymous Poster and danbrown for your reply.

(actually I''m kinda a newbie programmer, I don''t completely understand what both of you have said.)

Now, to dan, if you want to look a bit to the "wireframe" version of Final Fantasy, I can suggest the ePSXe emulator and Lewpy''s Glide GPU Plugin (it requires glide, but I''m sure there are tons of wrappers hangging out there). ou can switch the view to wireframe. Maybe you want to look at it.

From what I have saw, Final Fantasy VII''s 2D polygon arrangement is very "neat". Everything is like on a grid. Evan it has blue wireframe polys to tell you that that poly is "absolute top most" and pink wireframe to tell you that it is a sprite that can cover character polygons. While white wireframe indicates background.

Diffrent thing in Resident Evil. Polygon arrangement is a total mess (you won''t see it in the normal view, but in wireframe, you''ll realize why RE can''t have a more rooms, one polygon management for one room is a mess).

Once I tought that FF and RE renders everything in normal prespective view, and using some depth sorting (It''s common in game programming to sort polys from farthest to nearest for perfect blending). But I realize that using that way is not easy and far 2D polys (sprites) will look smaller than the near parts.

I''m really hoping for a reply / solution

Share this post


Link to post
Share on other sites
I tried epsxe with FF8 and the glide driver (I have a voodoo 3 anyway) and could see the background was made of small tiles fine. The only colours though were white (textured+wireframe) or the actual texture colour (wireframe), so maybe FF8 does it differently? I sold my copy of FF7 a while back as I was short of cash and haven''t bought a new copy yet, FF9 wouldn''t work and I have RE on the PC so I couldn''t try it.

What you say makes sense though. The white-wireframe tiles would always get drawn first. Then the characters _and_ the pink-wireframe tiles (with alpha channel) are depth sorted and drawn. Then the blue-wireframe tiles get drawn before any overlays (dialogue, etc).

When I said the rendering engines are similar I didn''t mean they worked exactly the same way, just that a similar engine _could_ be used to do both games as they are both 3d placed in a 2d scene. RE sounds it usesa similar method to the old monkey island games and has a floor polygon that defines where the characters can move.

I use ortho mode for the background sections, then set the camera to the same as the current room and use perspective mode for any 3d elements. Even in ortho mode you can specify a z value and depth-sort the tiles and they will look the same size in the distance.

I can post a screenshot or two if you''d like to see it with/without the mesh that I use to hide the character if it needs to.

Dan

Share this post


Link to post
Share on other sites
Thanks Dan, the texture clamping does the trick, all looks great now.

And yes, I would love to see the screenshots.

I''m actually doing some kind of a full 2D engine using OpenGL now, it can''t do much but it has some basic needs such as sprites/translation/rotation and dilatation. My engine won''t be using any 3D objects I think.

I''m currently thinking of implementing some "offscreen drawing" to get some Motion Blur effects (like those Final Fantasy Battle scene transformation). But I don''t know how to manage the coordinates, it''s a little mess. The main idea is ::
Draw everything on screen
change it to textures (in small blocks).
Clear the screen,
draw the real scene and then
use the textures to add some effects (motion blur).

But concidering that window sizes can be diffrent and window coordinates is not the same as ortho coordinates this could be a hard thing, especially to think how many textures (blocks) that I have to create.

I have another problem :: I''m currently using a Voodoo3. And my textures all look bad in colors (V3 only suport anything 16bit) using smooth color gradation. I''ve tried to enable dithering but it didn''t help much. Does anybody have a solution.

Share this post


Link to post
Share on other sites
Ok, just remember that I''m not an artist

http://www.geocities.com/_danbrown_/drav-1.jpg
http://www.geocities.com/_danbrown_/drav-2.jpg
http://www.geocities.com/_danbrown_/drav-3.jpg
http://www.geocities.com/_danbrown_/drav-4.jpg
http://www.geocities.com/_danbrown_/drav-5.jpg

drav-1.jpg
This shows the character (a bruce willis .md2 I found on polycount.com) standing with one leg hidden behind the block.

drav-2.jpg
The same scene, but with the collision mesh drawn on top showing that it is what covers the leg.

drav-3.jpg
Shows the basic dialogue system I have working. It can handle multiple pages of text with very simple formatting.

drav-4.jpg
Shows that you can pick items up, although there is no inventory yet and the item stays in the room.

drav-5.jpg
The same room with the collision mesh drawn for comparison.

btw. The doors open when you leave the room along with a fade, and in one room (a long corridor), the engine switches bwtween 3 cameras automatically as you walk down it. It''s mostly controlled by text files, so you can add a new room by just putting the background, collision mesh and a .loc (location) file in the data directory. The frame rate needs some work, I believe this is from tweening the .md2 model each frame as it makes little difference turning off all the other graphics.

Dan

Share this post


Link to post
Share on other sites