Personal tools

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - arisian

Pages: [1]
Coding / mouse control of battlescape camera rotation
« on: April 16, 2010, 05:11:06 pm »
I've implemented a quick-and-dirty version of mouse-based camera control for the battlescape.  If you hold down the middle mouse button and drag, it will control camera pan/tilt (in the way common to many other 3D games).

I've attached the patch, but I'm not sure the patch should go into the trunk in its current form; right now, there's no way to turn the feature on/off, control the speed of rotation, re-bind the control, etc. except to change the source code.  It may also be brittle; I haven't tested it extensively, and I don't know if it will introduce any undesirable interactions with existing code.  If people want to play with the patch and give me feedback, though, that would be great.  In particular, thoughts about how this feature should actually behave, and how (or if) the user should be able to control it from the in-game options menus (ie. speed, binding, etc.).

Artwork / New Feature: "Glow" textures
« on: April 12, 2010, 04:23:57 pm »
I figured I'd post this over here, rather than in the coding forum, since it's really more of an art question.

I'm planning on introducing the ability to have real-time glow/bloom effects in the battlescape, similar to what I've done for the geoscape (see screenshot).  The coding I can handle, but before that code is useful, it will require some decisions about how to use it with the artwork.

There are essentially two different ways that we can do glow.  The first is to do HDR (high-dynamic-range) rendering, in which case things will "glow" when they're brighter than the maximum brightness that can actually be displayed by your monitor (ie. if the value for the red channel is greater than 255, the "extra" red will spill over into neighboring pixels on the display).  This is how things work in the newer Halflife2 games, for example (though they do some other more complicated things as well, like adjusting the centering of the visible-dynamic-range on the fly).  New art wouldn't be required immediately, but this would wind up changing the appearance of things that were already in the game.  Given that the current textures weren't designed for HDR, this could create some issues that would require fixing textures and/or lighting to get things looking right again.

The other option is to do glow in a style that has come to be known as "Tron" style glow, since it was pioneered by the game Tron 2.0.  The idea here is that you can associate an optional extra texture with a model, much like you would a normal-map, which specifies what regions of the model should glow (along with color and intensity).  This wouldn't change the look of the game initially, but would require new art to define what should be changed and what should be left the same.

My personal preference is for the second option, at least initially (I may implement them both eventually), because it allows a much greater degree of artistic control, and I think it will fit well with the atmosphere of the game.  Having the "bright green" portions of UFOs glow, for example, seems like a natural extension of the current artistic style.  It would probably even be possible to have simple animations in which the glow-texture was varied over time, allowing things like pulsing or other fun visual effects.

The caveat, however, is that this would require new art.  Any model that didn't have an associated "glow" texture simply wouldn't glow.  This would mean that glow textures could be added slowly; the game wouldn't break because they weren't there, but new textures would have to be created before the new effects actually appeared in game.


So, the 2D geoscape has these nice lights that show up on the "night" portion of the globe.  They're nice for several reasons, ranging from "it's pretty" to "it improves immersion" to "it marks the population centers" to "it helps you figure out where stuff is in the dark" (helping to counteract the issues with low ambient lighting).

The method used for the 2D geoscape isn't directly applicable to the 3D version, but I took a look at it this afternoon and it's fairly straightforward to render the lights as emissive sources, which makes them glow nicely at night.  The only trouble with this is that they don't "turn off" during the day, though they're a lot less obvious during the day because of the lower contrast with the background.

I've attached a diff (based on the current trunk; it's the output of `svn diff` run in src/client/ ) of the simple changes I made; I make no claim that my little hack is the best way to implement this feature, but it was the quickest way for me to get nightlights.  I've also attached the image that I used as an emissive light texture; it's basically just a thresholded version of the standard nightime geoscape texture.

If someone who's actually familiar with the overall code structure wants to add this feature properly (eg. as an option in the menu, or as a selectable "overlay" like the nation borders or radar overlays, etc.) feel free to use it; if the devs don't think this feature is something they want, that's fine too, I'll just keep it around for my personal use.

Pages: [1]