Archived

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

aker_jus

Prerendered backdrop management

Recommended Posts

aker_jus    122
I''m trying to make a prerendered map system, like FF7-9 had. But, I have ran into a small problem. I have a scene rendered which is 640x480 saved as jpeg. Should I load this texture anyway into a IDirect3DTexture9 interface and render it on a 640x480 quad? I know the best way is to divide this into power of two textures, but it is difficult to preserve the original image without stretching it. Any ideas?

Share this post


Link to post
Share on other sites
S1CA    1418
quote:
Original post by aker_jus
I''m trying to make a prerendered map system, like FF7-9 had. But, I have ran into a small problem. I have a scene rendered which is 640x480 saved as jpeg. Should I load this texture anyway into a IDirect3DTexture9 interface and render it on a 640x480 quad? I know the best way is to divide this into power of two textures, but it is difficult to preserve the original image without stretching it.

Any ideas?


Split it into multiple power of 2 textures (where caps indicate you should), and render to multiple quads. For example for 640x480 you could use 2 power of 2 textures:

+-------+--+
| A |B1|
| +--+
| |B2|
+-------+--+


Texture A is 512x512
Texture B is 256x256

For texture B you render two quads one (B1) from the left side of the map, the other (B2) from the right side of the map.

You''ll notice that you have 32 more pixels than you need for the height (512-480=32), just adjust the texture coordinates of the quads you render to ignore those 32 pixels.

Alternatively you could use those extra 32 pixlels for scrolling/special effects.


You could load the 640x480 JPEG into the SCRATCH pool so that there aren''t any hardware restrictions, then chop that up into the 2 separate textures (if the device caps say its necessary) after it''s loaded.


--
Simon O''Connor
ex -Creative Asylum
Programmer &
Microsoft MVP

Share this post


Link to post
Share on other sites
aker_jus    122
That was what I was thinking. However, as you have noticed in prerendered games, such as FF7, or RE, the backdround isnt always static. Some parts are moving, etc, which has led me to a conclusion that the engine is using small chunks, perhaps 16x16 to fill the entire backdrop scene. Now, I can easily do it using large textures, but my scenes wont have animation.. This is my last question on this topic, any ideas?

Share this post


Link to post
Share on other sites
S1CA    1418
Games like FF7 tend to be done in a way that takes advantage of the way the hardware they''re written for works. Often that does mean tiled backgrounds, say 16x16.

There''s nothing to stop you from layering smaller quads on top of the larger 3 backdrop quads. For example put all the truly static elements in the 3 larger backdrops then render smaller individual animated elements on top (using Z buffering, alpha blending etc).

Going for 16x16 tile quads will also still be fine, and there''s nothing to stop you storing multiple tiles in one big texture.

To be honest, most 3D hardware isn''t going to have any trouble at all with a screen full of 16x16 tiles (40x30=1200 tiles). 1200 tiles == 2400 polygons, which at 60 frames per second is 144,000 polygons per second. A GeForce256 will do something like 15,000,000 polygons per second. So even if you do things really inefficiently, you should still get good frame rates with 16x16 tiles.

Share this post


Link to post
Share on other sites
aker_jus    122
I see. What if I rendered all my static background into some 256x256 textures, and leaving blank 16x16 chunks for the place where an animated texture should be placed. It would be quite more efficient these days to do so IMO.

Well, I guess I can come back here if I get stuck. Thanks a lot for the replies Simon!

Share this post


Link to post
Share on other sites