That blog does not exist

Game Development Community

dev|Pro Game Development Curriculum

How to create a pre-rendered background for use with the Adventure Kit

by Laralyn McWilliams · 01/04/2007 (11:28 pm) · 24 comments

I realized today that you could use the Adventure Kit along with a pre-rendered background and get a similar effect to Baldur's Gate. Here's a tutorial on what I found out through experimentation (including work on a project years ago with pre-rendered backgrounds). There may be easier ways to do some of this--if so, don't hesitate to let me know and save me some work. ;-)

This tutorial assumes you're using 3D software and Photoshop. It is easiest with a 3D app that supports isometric cameras. If your 3D app doesn't let you simply set a camera to be isometric, you'll have to research that part and get it figured out before you start the tutorial.

The goal of the first few steps is to set the image resolution for your entire project. The key to making your life easier with pre-rendered backgrounds is to always have everything at the same visual size or scale. That means you don't want to create your camera settings based on a single room, then move the camera back to fit an entire house, because that will make your characters and all of the objects visually smaller in the image. The easiest solution is to figure out the largest scene you'll ever want in an entire level, then determine the image resolution based on what gives you the figure size you want on screen. It sounds wackier than it really is, trust me. :-)

Think about the kind of game you're making. How big do you expect a single level to get? Do you want large outdoor areas, like Baldur's Gate? Here's a comparison of two Baldur's gate levels: one outdoor, and one indoor. Both are at the same scale, so you can see the difference in the amount of "turf" in each level.

www.eluminarts.com/torque/room/bg.jpg
Also think about how large you want your character on screen when the app is running full-screen. It can help to find a game you like, get a screen shot of it, make sure it's the resolution you want for your app, then keep it open in Photoshop for comparison.

1) In the 3D app, insert a plane or a flattened cube as the ground. Insert a figure at a scale that makes sense to you (like height = 2 meters, or 6 feet, etc.) at 0,0. Insert a camera and set it to "isometric" mode. Make sure one of your windows is set to look through the camera's POV (that's what you'll be rendering.

2) Make the ground cube as large in proportion to your figure as you think you might want to have in a level. If it helps, you can add rudimentary trees or something the height of a building, to get a sense for how the space works. Here's a shot from my setup to show the relative scales of the figure (red) and the ground (grey) that I settled on.

www.eluminarts.com/torque/room/step1.jpg
3) Once you like the size of your figure versus the environment, you can pick your resolution. You want to work in multiples of 256, because you'll be cutting the large images into 256X256 cubes when you bring them into TGB. How large you need the resolution depends on how big your ground is. It's hard to have any real sense of it when you look at your scene in the 3D app (at least, it is for me). What I do is render the scene at a resolution I think will work, then open the image in Photoshop and view it at 100%. If you want to be *really* thorough, reduce the canvas size (with the figure still at the center) to whatever your final app resolution is, and take a look at how the figure fits on the screen. Once you have the resolution you want, resize the ground and figure together to create the right size for your character on screen. Again, rendering then checking at 100% is the best way to do this.

I used 5120 X 5120, and here's a shot of how big my sample character would be full screen at 1024X768.

www.eluminarts.com/torque/room/step2.jpg
4) Once you like the resolution, lock the camera so you can never accidently move or alter it, and save that file as a template. You'll begin every level in that template, at 0,0 then save under a new name to leave your template pristine.

Before the next step, I created a simple room out of blocks. Here's a shot of the room as it sits in the full image resolution. Note that there is a lot of leftover space--that's OK, because it's the amount of space I need for larger levels, and I'm going to throw away the parts of this image that are not required.

www.eluminarts.com/torque/room/room_full.jpg
5) With either the sample image or any image at your final resolution, create guides at every 256 pixels starting at zero. You can create a new guide by choosing View/New Guide. You're going to create vertical and horizontal guides every 256 pixels to cover the whole image. When you're done, choose View/Lock Guides so you can't accidently move them. Here's how my guides looked when I was done.

www.eluminarts.com/torque/room/step3.jpg
6) Save the file as something like Guides Template, because now you have a template that has the guides already set for your final image resolution, and you'll never have to do that again. :-)

7) Open up your working version (i.e. not the template). Click on the slice tool.

www.eluminarts.com/torque/room/step4.jpg
8) With the slice tool selected, choose Slices From Guides (a button that should be in the toolbar along the top of the window). That will slice your background image along the guides you set.

9) Choose File/Save for Web. You may get a message that Photoshop will behave slowly on an image this size, but that's OK because even if it's slow, it's saving you a lot of time.

10) Imageready will open, with your image in it. You may have to zoom way out to see the entire image. Once you zoom out, select all the slices by dragging across all of the slices. When you have a slice selected, it will not have the blue tint over it, but will show its normal colors (kind of the opposite of what you might expect). Here's what my image looked like in Imageready with all of the slices selected.

www.eluminarts.com/torque/room/step5.jpg
11) Change the preset on the right to PNG-24 instead of GIF, then click the Save button. Choose Images Only from the pull-down, then save. Let Imageready work at it for a few seconds, and when you check the folder where you saved, you will see a bunch of .png files created from your guides and slices.

12) Weed out all the blank images. For my image, I had only 14 images to use and I pitched the rest. Sure, I rendered out a bunch of blank space. On the other hand, I now have a setup that means I can render any level in my game without moving the camera or resizing any images, and all of my guides are already set up correctly. For example, I accidentally rendered my room with the figure in it. Oops! It took me literally 3 minutes to turn a new render without the figure into the final set of slices ready for TGB, because I simply pasted the new render into the template, sliced on the guides, exported, and tossed the blanks.

13) Fire up TGB and add the slices that make up your level as imagemaps.

14) Add a new tilemap that is roughly the same proportion to the camera view as your huge render is to the final app resolution. I took a 1024 X 768 image and pasted it into the full image so I would have a good idea what the proportion would be. We want the tilemap to be roughly the same proportion as the big image because we're going to use this image map as a template too, and copy and paste it for all future tilemaps. This ensures all future tilemaps will always have the same scale.

The white square in this image is 1024X768 laid over my full image resolution.

www.eluminarts.com/torque/room/room_proportion.jpg
15) Set the tilemap to however many grid squares you made with your guides. Mine was 20 X 20. Change the tile size to whatever makes your tile array fit the tilemap size.

16) Zoom back in and paint the tiles from your test room onto the tilemap. You'll get a good sense of how your tilemap is sized based on how those tiles fit onto the screen. I ended up adding a single small black image to put into the spaces that are blank, so you can scroll around and not hit the end of the tilemap.

www.eluminarts.com/torque/room/tgb_rooms.jpg
Here's how the experiment looks with the TGB Adventure Kit orc running around in it. He's not a good fit either in size or rendering angle, but he'll be replaced with a new character soon enough. Render out some of the items that need to be parsed for depth (like the walls), add some collision according to the guidelines in the Adventure Kit, and you're in business! :-)

www.eluminarts.com/torque/room/final.jpg
Page «Previous 1 2
#1
01/05/2007 (1:50 am)
fantastic!!
#2
01/05/2007 (5:10 am)
Nice!!!
#3
01/05/2007 (5:41 am)
Amazing tutorial! As a programmer and designer, the most common and difficult obstacle I face is asset creation, so I love it when tutorials like this are posted. If I ever get around to using the Adventure Kit, I'll be heading back here. Great work!
#4
01/05/2007 (6:15 am)
Great tutorial. Thanks for taking the time to write it out.

Fredrik S
#5
01/05/2007 (7:20 am)
Wow, thats funny, I was just thinking of exploring this topic last night. Very nice work!
#6
01/05/2007 (7:37 am)
Thats a great tutorial, but shouldnt it be a ressource, not in the blog?
#7
01/05/2007 (7:40 am)
Great job! I agree with Mathieu. This would make an excellent TDN art tutorial!
#8
01/05/2007 (7:45 am)
rock on!
#9
01/05/2007 (8:00 am)
Shouldn't your ISO camera be along the Z axis? I don't think the adventure kit / TGB Y sorting was set up for diagonal walls.
#10
01/05/2007 (8:01 am)
I've done two of these so far, but I wasn't sure where to add them in TDN. Under Adventure Kit? There doesn't seem to be a category that fits for them.
#11
01/05/2007 (8:19 am)
Another great .plan!
#12
01/05/2007 (8:29 am)
Great work! These .plans are invaluable!
#13
01/05/2007 (8:50 am)
The AdvKit cannot do true isometric sorting, but if your willing to fudge things with collision and prop placement you can get really damn close. Great job with this walkthru!
#14
01/05/2007 (9:41 am)
Here's a trick I figured out when I did my original test, which was with a Baldur's Gate background: if you cut out the walls the right way (so they are separate from the floor), you can use the Adventure Kit code for fading interiors in and out to make your walls work correctly. Put a trigger in the entire room set to trigger the problematic wall, set the fade time to 0, and you're set.

The only problem with that approach (that I have found so far) is that you want the trigger to respond on level start, not just the first time you step on it. For example, suppose I have two rooms, A and B. The character starts in room A, and room B is the one with a wall that needs to be iso sorted. I render out the wall between rooms A and B separately and bring it in as a layer higher than the avatar. I put a trigger in room B, set it to the interior fade datablock, set its trigger as the wall between rooms A and B, and set the fade time to zero. Now when I run around outside that room, the wall draws correctly on top of the avatar. When I run around inside the room, the wall fades out and my avatar is drawn correctly on top of the wall. When I start the level, though, I am outside the room and that trigger has never been initiated, so the avatar is drawn on top of the wall until I enter the room the first time (and from then on out, it is correct). I'm sure this could be resolved by the level start-up script, though.

What I actually plan to do in the long run is the true BG approach, where you leave the avatar on top of everything and instead fade him to 50% when he should be "behind" a wall. That way it looks like the avatar is actually behind the wall but made visible so players can still see what he's doing. I would bet, in the end, that's going to be a fairly simple thing to do.
#15
01/05/2007 (9:55 am)
Excellent tutorial! Thanks a ton, I was wondering how one would go about doing this!
#16
01/05/2007 (10:09 am)
Fantastic work, GamerGirl! Definitely TDN material. Any chance we could see some videos of your fading walls/avatar?
#17
01/05/2007 (10:52 am)
Great stuff GamerGirl :)
#18
01/05/2007 (12:03 pm)
Great .plan GamerGirl! Top Notch!

#19
01/05/2007 (1:11 pm)
This is great stuff!

I'm not sure what you mean by "render out" the walls though but I love how your writing this stuff up.

Which version of Photoshop are you using and when you refer to "3D APP" are you using Poser or 3D Max to do all this with?
#20
01/05/2007 (1:20 pm)
I'm using Photoshop CS2. I'm not sure when the guide/slice feature was added to Photoshop, but Elements may have it as well. The 3D app I'm using is Cinema 4D, but you could really use any 3D app for it. If the app doesn't support an isometric camera out of the box, you'd have to scout around the internet for a tutorial on how to simulate it. Moving the camera really far away (and I mean *really* far away) then having a very small focal length can get pretty close to isometric (from what I remember... it has been a while since I experimented with that).

So what I mean by rendering out the walls separately is that you render once with the entire scene. Then you grab everything that will always be behind the character (like the floor) and group it all, then hide it. Then you render again (with alphas on, if possible, because then it's easier to remove the background). You make the background following the tutorial, then cut up the second render into pieces that relate to each individual wall. You can do the same thing with furniture as well--render once with it in place, then render it again as a separate object. That lets the avatar pass behind it as needed, but it still has a shadow and scene lighting.

If there's enough interest, I can do a tutorial on it once I get my first "real" level done, along with a movie showing how the interior hiding function works on walls (Russell's request), and maybe showing the avatar fading as an alternative (assuming I can get that to work).
Page «Previous 1 2