Below are some pictures of
c_yinnkeep.mdl with texture variations to make him look a little more interesting and unique. He's a non-dynamic model with TGA (not PLT) textures, supermodeled into
a_ba.mdl for his animations. He's one of about 50 stock NPC appearances in the Toolset and if you've seen him once you've probably seen him 10,000 times. Like the rest of the NPC appearances, he gets used again and again along with the rest of them to populate towns, cities, etc. And he and they always look exactly the same.
But as I said, I've made some texture variations to help him look a bit more unique. How many different models would it take to get this number of variations in-game?
What if I said that you were looking at just
one model? One model which randomizes itself, or more accurately, randomizes certain details which make us believe it is unique. And all without using dynamic parts, creating extra models or spending time editing 2DA files.
How it's done and why it works: Emitters can have animated textures on them. Animated textures are stored as individual frames, one after the other, on a big sheet called a "sprite sheet". Here's an
example of a sprite sheet. Normally, the grid of frames in a sprite sheet are played one after the other to give the illusion of one continuous movement of a thing, like the red smoke in my example.
But that's not the only way a sprite sheet can be used. One can also put
different images in each one of the grid frames and set up the emitter in such a way as to cause it to pick just a single frame's texture from a sprite sheet and use that without displaying others:
A random texture picker!Using the random texture as a decal to overlay a model's main texture gives the illusion of variation- especially when a given model contains more than one random texture picking emitter. With this method, certain models like NPC's, horde creatures or placeables can be made to look more unique without the overhead of actually using entirely different textures for each variation and all the extra models that go with it.
Here is an image showing a randomly generated inkeep and the sprite sheets which act as the pool of potential textures:
Some decal emitters were used more than once. There are 4 freckle emitters, for instance, one for each quadrant of his face. Each freckle emitter has a 25% chance of displaying. As you can see, we hit the payoff on two of the freckle emitters this time.
This method is best used in these circumstances:* Any time you have a bunch of the same model around and you don't want them to all look the same
* Any time you'd like for texture changes to give the impression of a more dynamic world.
Limitations:* Limited to a flat plane
* Different players in the same world see different variations on the same objects
* Can only be used to benefit in certain circumstances. Using in the wrong circumstance can confuse players.
* Model will randomize itself on creation
or if it is unloaded then reloaded by the engine, such as walking out of range and then back into range of the object- about 35-45 meters. Or exiting and then re-entering the same area.
Also, since animated textures must be in TGA format (and so, uncompressed), we need to be careful not to make our sprite sheets too large or they'll eat up an unreasonable amount of memory. On the flip side, working
for us is the fact that NWN will cache textures which have already been loaded by another model so the graphics memory "cost" of loading an uncompressed TGA will drop the more models on the screen draw from the same texture file. Like getting a discount for buying in bulk.
Introduction to the effect in the Toolset:Download
this archive and uncompress it into your override directory. Go into the toolset, search for and select an Armoire and while holding down shift, start placing them. You should wind up with something that looks like this:
In the upper left hand corner of that picture you can see the sprite sheet used as the texture pool. Really simple stuff, when it comes right down to it. Instead of those four numbers, it could just as easily be different flowers. Or sheets of paper on a mage's worktable or a store clerk's counter.
It could also be attached to a model like our innkeep for instance. Along with his example textures, one could also add random tattoos, patches to indicate worn clothing, rings, beltbuckles or anything else which is eye-catching and substantially changes how the model is perceived by the players. Typical horde creatures like skeletons or kobolds could be randomized like this as well, breaking up the cookie-cutter look of a lot of encounters.
How to set up the emitter assembly in G/Max:Our emitter assembly is composed of 3 things: A Dummy node and an Emitter and a helper Plane which will be attached to it. The Plane acts as a proxy for the virtual emitter surface and when we're happy with the size of the helper Plane (which usually has one frame from our sprite sheet applied to it), we just copy the information into the Emitter so it has the same size.
First let's go over the settings we'll need to put on our emitter after creating it. Here is the emitter rollout with the changes one needs to make from a default emitter to achieve this effect, using the data from the 0-3 button demo in the toolset. I've sliced it into 3 and put the pieces side by side so it doesn't take up so much space:
1. Update type Single - The emitter will pick just a single image on creation.
2. Billboard to Local Z - The image will retain the orientation it had when it was created.
3. Start Color - We need to make the start color white or at least light so that we can see our texture. If the Start Color is black (as it is by default), our decal is going to be black as well, which looks awful. I like to set my white somewhere between 250 & 255, which is the max.
4. Size X & Size Y - This is the size of the virtual emitter plane we're using to target the texture onto. It's in meters, not centimeters as you'd expect. We find the right size for the virtual emitter plane by using the helper plane, then plug in whatever size the helper plane wound up being into these slots. So if your helper plane winds up being 5.6cm on a side, then you'd plug 0.056 into each of those two spots to get an emitter plane which was the same size.
5. Birthrate & Life Expectancy - We need at least one particle to be born so we put 1 under birthrate. Because the Update style is set to Single (no. 1, above) it will only generate one particle. By setting Life Expectancy to -1.0, the particle/decal will last as long as the model it's created from.
6. Texture - This is the texture name for our TGA sprite sheet, without the extension.
7. Grid X & Y - The number of frames we have along the X plane and Y plane in our sprite sheet.
8. Last Frame & Random Playback - Last Frame is the number of the highest frame to play or choose from. The first frame is frame 0, so the fourth frame would be frame 3. This means all frames on our sprite sheet are fair game. Random Playback, when selected, will randomly pick a frame from the pool of frames, as defined by First Frame and Last Frame.
If we're going to be attaching this emitter to the surface of a moving object, like the goatee on our innkeep, we also need to put a check next to Inherit. After all, we don't want our inkeeper's goatee to fly off his face when he bows or laughs. This prevents that from happening.
Next, create a Dummy and a Plane. To make the emitter assembly just attach the emitter and the Plane to the Dummy node. Then, while the emitter is selected, press ALT-A (Align) and click on the Dummy node. Align the emitter with the Dummy node by checking
these settings and then hitting Apply. Select the Plane, press ALT-A again and select the Dummy again, using the same Alignment settings we did for the emitter. Finish it off by copying an individual frame from your sprite sheet onto the plane. When you're done it should look something like
this.
I just make one from scratch and then keep cloning it in the scene as I need it, making sure to clone the full assembly. If I'm moving a new assembly close to where an existing one is, with the assembly's Dummy node selected I just hit ALT-A, select the Dummy of the node I want to movie it to and then along with
these settings I also tick X, Y and Z under "Align Orientation (Local)" to help speed the positioning process up. When you're happy with where the assembly is, just unattach the helper Plane from the Dummy node and attach the Dummy node to the geometry it will be overlaying the texture of. Here's an example of what my face looks like
in Max.
Anyway, the concept itself is pretty simple. It doesn't take a GIMP/Photoshop or GMax pro to do it, either. Finding the most appropriate place for this effect probably requires the most thought of all.
For instance, I've taken this concept to the extremes with a self-randomizing cloud. It's made up of dozens of emitters which randomly select from a range within a default
cloud sprite sheet. By changing the range (First Frame & Last Frame in point 8, above, on the Emitter settings rollout) I can either make very wispy clouds (first third), very dense clouds (last third) or clouds which have both dense bits and puffy wisps by selecting a range in the middle. The sprite sheet I used for a proof-of-concept was very large (1024x1024) and so the recording is choppy, but you can see the result of a few "randomized medium cloud" placeables
here. Downloadable
here, just unpack to override directory and place an Armoire.
In my free time recently I've been playing around with NWN as an old side-scrolling dungeon crawl type game. By using this effect for decals on dungeon walls, I'm hoping to break up the "sameness" of a level without having to resort to creating and destroying any more placeables than I have to. I'm interested to see what other uses people can think up for the effect.
'>
Modifié par OldTimeRadio, 24 juin 2011 - 06:14 .