|  | 
 
 Something like this, I'd imagine: 
 The good news is, if you have Bryce, it's dead easy -- you just have to know a few tricks. 
 Load up Bryce. The first thing you're going to want to do is to set up the document the way you need it, so go to Document Setup in the File Menu. You'll get this screen:   
 The important things here are to set the Document Aspect Ratio to 1:1, and to set the Document Resolution to something comfortable: in this image, I'm creating 512x512 skybox textures -- and they look good at that size, but they eat up lots of memory. Next, you want to unlink the sun to the view -- it's a cool feature when you want to see what the sun looks like from every angle, but all that's going to do in a skybox is give you five suns. You can do it like this: 
 Make sure it's UNchecked, not checked like in the picture, and we can move on. Next, we need to set the camera's Field of View (FOV) just right so that we only capture exactly as much of the scene as we need, no more or less. It would make sense if that meant you wanted to set the FOV to 90 -- so that way you got four snapshots of 90 degrees of the environment, which would total the full 360 degrees. Bryce is screwy, though, and there's an old bug they haven't decided to fix in order to keep the renderer consistent. Go figure. Anyway, you need to set FOV to 112.5. Double-click on the huge trackball to bring up the Camera Options dialogue, and enter FOV here: 
 With all of this setup out of the way, now you need to make the skybox look pretty. I'd highly suggest turning shadow casting on, making sure you're NOT rendering as a Volumetric World, and doing spherical clouds, as they tend to look better. Also be sure that you have something other than the default Bryce grey plane stretching out into the horizon; your player will end up seeing the horizon at some point, and you'll want it to look as realistic as possible when they do. Plop terrains across the horizon, texture an infinite plane, add some water if you feel the urge, but don't just let it be flat and boring. So your skybox is now a work of art. Now we need to take some very specific snapshots. Once again, go into the Camera Options dialogue by double-clicking on the huge trackball. This time you're setting the Camera Rotation values, like so: 
 The values that are currently entered in there are for the "front" face of the skybox -- named arbitrarily, just to keep track of which sides you've snapped and which you haven't. Once you've set up the camera rotation, hit Render to Disk in the File menu. At this point it's smart to come up with a consistent naming scheme; what I do (and what's in the demo) is to give my skybox textures a common prefix, an underscore, and then a consistent set of names. For instance, if I had a nice summery skybox for rolling hills, I might decide to call the first snapshot "rhills_front.bmp" -- then "rhills_back.bmp", "rhills_left.bmp" and so forth. Obviously, do whatever you need to do, but doing it like this can save you grief later. In all, you'll need to take six snapshots -- one snap for each side of the skybox you're rendering. After each view finishes rendering, you'll need to go back into the Camera Options dialogue and change the Rotation settings for the new view. The handy little grid that follows tells you what settings you'll need for what views: 
 
 * If you're using Bryce 2, swap these two values And that's it: you now have six images, perfect for making a skybox. We'll use them in code in a bit, but what you want to do right now is to SAVE THE BRYCE FILE as well. Not only so you can adjust it later if you want to, but the sun and lighting settings are critical for lighting and shadowing your terrain, and if you lose these settings you'll probably have to re-render the skybox to get the lighting correct. 
 Go back into the Document Setup screen from the file menu. This time, you're going to want to make a viewable screen slightly larger than the texture you want to create, as it's more of a cut-and-paste operation than a nice, seamless, automated one. If I'm generating a 512x512 terrain texture, I use 640x640 (and I highly recommend the 512x512 texture for the terrain, as it can easily get nasty and pixellated at lower resolutions). You don't need to change the FOV of the camera, as you won't be using it, but if you want to change it back to Bryce's default 60 degrees, go ahead. Create a terrain, select it and hit E to enter the terrain editor. Before you get started, hit the GRID control and change the default setting: 
 Set it to whatever you like, but I'd suggest a minimum of 256 for a decent-looking terrain. Now edit the heck out of it. Make it look exactly the way you want it to; paint on it, fractalize it, ridge it, crag it, and don't forget to texture it. ;) When you're done, accept your changes to go back to the main view screen, and then hit E again to re-enter the editor, then select the Pictures tab, and hit Copy at the bottom of the first image, like so: 
 Why did you quit out and re-enter? Take another look at that screenshot. See how the terrain I've been editing is completely different from the one in the pic? That's because I haven't confirmed my changes yet. When I confirm and re-enter the terrain editor, that image will have the correct, updated heightmap in it. Now open up your favorite image editor, hit paste, and save the results. Your heightmap's complete -- now on to the terrain texture map. Go back to the main edit screen, and select the orthagonal overhead view from the view selector, like this: 
 You won't be able to trust the main viewscreen for what you're seeing now, so you're going to have to eyeball the nano preview to see if you're in the ballpark, but what you need to do now is change the Camera Options to zoom in until the terrain takes up nearly all of the view. No, you can't double-click on the huge trackball to change your camera position anymore, but you can still get to those values. Go here: 
 See the circled down-arrow? If you hit it, you can still adjust the camera position. It's currently flying high, around 5000 units or so. Dropping down to the range of 1250-1500 should give you a screenful of terrain: 
 Don't worry if it doesn't completely fill the screen -- you've made the screen larger than the texture you want, anyway, so a little cropping isn't a bad thing. Now do a full render from this perspective, and either save the file or get a screen capture with Print Screen. Bring the image into an image editor, and trim it so that you have a perfectly square texture, without any background. If you have a busy skybox plane, it may be easier to make it hidden for this render, so you can more easily see where to snip. Once you're done, scale it down to 512x512 and save it. That's it: you've got your terrain texture! 
 For the most part, the code speaks for itself, but it's worthwhile to mention a couple of things, to help you optimize how your environment looks and understand the limitations of the technique. MOUSELOOK. I had the toughest time figuring a decent mouselook routine; I could never get the rotations right; the camera always ended up rolling instead of just pitching and yawing, and forcing the camera roll to 0 just didn't work real smoothly. RobinS came up with the idea of an articulated camera -- a camera parented to a pivot. You move and turn the pivot, and you raise and lower the camera -- and this solution works perfectly. I've used it here; my implementation isn't overly smooth or ultraprofessional, but it gets the job done. SKYBOX. This stuff is ripped shamelessly from Mark Sibly's castle demo, and was written by Rob Cummings (Hi, Rob!). This isn't a tutorial about Blitz's native mesh construction methods so I'm not going into detail here, but suffice to say it's probably the best skybox code around. This version will check to make sure that all skybox textures are present, and if they aren't, it won't create a skybox (useful if you just want to preview a terrain without the skybox). Something useful to know about the skybox: it's not as big as it looks, it's just drawn before anything else is (that's what the EntityOrder statement is there for), and it moves in sync with the player to maintain the illusion. TERRAIN. This stuff is ripped shamelessly from Mark Sibly's XFighter demo, and was written by Mark (Hi, Mark!). Again, it checks to make sure that three files are present: the heightmap, the terrain texture, and a "detail" texture that gets tiled across the terrain to give the larger texture map the impression of more detail than actually exists. There's an automatic terrain rotation in there to keep the terrain texture aligned with the skybox's lighting -- if you have the sun facing shadows it looks pretty silly. ;) You need terrains set to full-bright mode (EntityFX 1) unless you have a particularly dark night and a flickering torch to light your way -- they're too large to light properly with a normal light, and if you turn Ambient light up, you can wind up losing a lot of other nice effects. Like the skybox, the terrain loader will check to make sure that all terrain bitmaps are present, and will not create a terrain if any are missing (again, useful if you want to preview a skybox without the terrain). HAZE. It's amazing how much difference a properly colored haze makes. If you have a sunset scene, but your fog is a midday blue, it's going to look downright dumb. Experiment with the colors you use for CameraCLS and fog until you're satisfied; don't just pick blue and say 'good enough.' CUSTOMIZATION. To make it a semi-useful tool, I've made it easy to pass a single value to the world creation routines and have the program load up both the terrain and the skybox, if they exist, and if they follow the naming convention I described above. Just change the value of WORLD$ in the user definable section. You can also change the values of fog and your camera CLS color by changing the values of the HAZE type fields. And that's pretty much it -- you should be able to do a seriously nice-looking 3D environment with Blitz using nothing more than Bryce, an image editor and a bit of creativity. I hope this has helped at least someone work out how to do this; if you have any questions, spot any mistakes I've made, or have more ideas along these lines, feel free to email me: morduun@hotmail.com. 
 
 
 For a printable copy of this article, please click HERE. 
 This site is Copyright© 2000-2004, BlitzCoder. All rights reserved.   |