Jump to content
Official BF Editor Forums
Sign in to follow this  
Spatchman

Animated Uv's

Recommended Posts

In 2142 there are many staticobjects which have a bundledmesh attached to give many of the pretty effects you may see in the game. Like the consoles in the titan have a really nice transparent computer screen with animated uv's, the toll station has animated uv's on the stop signs. There are lots of examples kicking around. Basically it's lots of tiny animated UV's on a flat object. It looks hellishly complicated to do but it is the icing on the cake. Like the pretty screens you see when flying the gunship.

screen534.jpg

Maybe you can't see it in the picture but a lot of the stuff on the screen either scrolls or blinks.

Console_01.jpg

This shows the wireframe. It's like for some bits they cut out lots of tiny little pieces so that they move at different speeds or directions.

Console_02.jpg

I imported the model and applied the texture to it to try and work out how you'd texture something like this but that made it even more confusing. When you edit uvw it's like you are looking at the uv's from the side, so you basically see a flat line. You can reorientate it with the uv,uw,vw button but it still doesn't seem to match the texture.

Has anyone ever tried this? I havn't done animated tank tracks or anything like that yet but would you use those same BF2 tools? They seem to apply where it is going around an object but would I use them on a completely flat surface like these screens? I have searched for how you would generally do this in 3dsmax but didn't really find anything relevant.

Edited by Spatchman

Share this post


Link to post
Share on other sites

Well a clue is that it's a lot more straightforward than you may think. It must be as I did a basic looking screen last night in a relatively short space of time whilst watching junk on the internet. I will put together a basic tutorial with pictures if there is interest. Bit busy till this evening though.

screen542.jpg

screen541.jpg

I made a little Aperture Science logo in the bottom left, this looks like it's spinning round like a big loading icon and the words pulse red quickly from the centre.

Share this post


Link to post
Share on other sites

2142 uses something called simpleuvtranslation. I think this may be one of the few things 2142 does which bf2 doesn't. There is a simple line of code associated with it in the tweak file for controlling the speed and direction. Basically, this makes the UV scroll continuously over the texture.

This technique only seems to work on a material which is exported as alpha||. Going by one example, the titan console, it has two materials. The first one is the actual desk part which is not animated or transparent and the second material which is the screen itself which uses transparency (alpha||) and is animated.

This is the location of the model I am talking about. If you don't have it already, get bfmeshview. It rocks.

...\mods\bf2142\Objects\Vehicles\eu_titan\meshes\eu_console3.bundledmesh

This is the location of the texture which it uses for the screen. You need to have a good look at this texture, in particular the alpha because that is where all the action happens.

...\mods\bf2142\Objects\Vehicles\eu_titan\textures\eu_console3_alpha.dds

Animated_UV_Tutorial_04.jpg

When you look at the alpha imagine the texture scrolling continuously in one direction (it's the actual uv which scrolls not the texture itself but just imagine it moving). This texture is designed to scroll left/right. You can see some gradients, pulses and solid lines. Gradients will cause the colour of the RGB layer to fade in or out, pulses can make it flash, a solid line will give you a consistent, always visible section you can use because you don't necessarily want everything flashing unless you are making a merry-go-round.

The alpha channel of the texture controls how transparent it is, the RGB is literally just the colour which will show through. As you may have read elsewhere, the alpha channel of the texture is greyscale.

Black=Transparent, Grey=visible and White=opaque.

I'm not sure at which value of grey the effect changes from transparent to opaque but it does.

Now let's actually fire up max.

Set up your materials. I've created a multi/sub-object just in case I want to add more textures later.

The first material is the actual .dds file located in your mod (or 2142 in this case). This is the material I will be exporting with. Remember this MUST be named alpha||(technique). I just called mine alpha||alpha and it seems to export how I want it.

The second material is just the alpha channel on its own in the form of a .bmp. I won't be exporting using this, just switching to it for reference on the model to give an idea of which bits will be transparent or visible.

Animated_UV_Tutorial_03.jpg

Now imagine you are using photoshop. With photoshop, you work in layers (different pictures plastered over the top of each other). In 3dsMAX, Imagine a flat plane is your first "layer". This can be the screen background. To add more stuff to it, do as you would in photoshop, plaster another "layer"(flat plane) over the top of it. This next layer can be text, a bargraph, or whatever shapes or information you want displayed on your "screen". The trick I have found is to keep these "layers" as seperate objects and don't attach them to your background screen until you are ready to export and even when you do it is advisable to make copies of these seperate parts. That way you can always come back later and re-use these parts easily. Once they are joined together it can be awkward seperating them again. You don't have to weld them or do anything fancy, just attach them to one another. Also, this will work on any model, not just a flat plane but let's keep it simple in this case.

To follow what DICE did...

Create your screen. Decide on a shape you are happy with. To get the kind of faded glow look which the titan console has they inset the screen to give a band round the outside which will be more visible or a thicker blue colour. They inset it again to give a medium range where it fades out almost completely in the centre. That gives you your background.

Animated_UV_Tutorial_05.jpg

It's worth applying a planarmap the same size as your texture sheet as this keeps the shells the same relative size to each other, even if we stretch or scale them later, it's better to start off this way. So for this texture that's 512x256 on channel 1.

Animated_UV_Tutorial_06.jpg

Apply an unwrap uvw modifier to channel 1. Bring up the uvw edit window and call upon your alpha layer bitmap. DICE used the dark grey band running just above the centre of the texture for their screen background.

Animated_UV_Tutorial_07.jpg

At this point I break it up into pieces so I can orientate them the same way so that the banding effect is the same and equal all the way round.

Animated_UV_Tutorial_08.jpg

Animated_UV_Tutorial_09.jpg

Animated_UV_Tutorial_10.jpg

This may be a little fiddly to get just right, it's best to get it exported when possible so you can see the transparency in meshview or see the whole thing working in game. That way you can easily go back and shuffle the uvw shells around until you get the effect you want.

Now lets create another "layer". Maybe some text.

Animated_UV_Tutorial_11.jpg

Let's make this part flash. Apply an unwrap uvw modifier to channel 1, drag the shells over to the left and shrink them down as one so they fit within the first "pulse". You can actually shrink it down to one spot, this will make the whole thing work consistently, if you stretch it it will sort of fade in from one side of the text to the other. It all depends what effect you are trying to achieve.

Animated_UV_Tutorial_12.jpg

Animated_UV_Tutorial_13.jpg

Animated_UV_Tutorial_14.jpg

Keep adding layers like this until you are happy with what you have.

When you are ready to export, make a copy of these different "layers"(meshes) and dump them in a another 3dsMAX layer. Take your finished items, attach them to one another, make sure you have the correct material assigned. Use the BF2 tools and create a staticmesh heirarchy using the tool. Rename your root_staticmesh_ to root_bundledmesh. You can just use the bundledmesh tool but it gives you unnecessary helpers for what we are doing here. I'm just exporting a visible mesh, no need for cols here, you'd probably build the cols based on whatever staticmesh you were attaching it to.

Create your tweak file. Just copy the titan console tweak and rename it for your model. Remove the istitaninterior code unless you are using it in a titan.

GeometryTemplate.simpleUVTranslation controls the speed and direction of movement. The two figures are easy enough to understand. x/y. Negative values will reverse the direction, using both values will make it move diagonally.

Here's a hint, setting the value at 1 will make the uv do a complete pass of the texture once per second(regardless of texture size). 0.1 is ten seconds.

Not sure about GeometryTemplate.hasAdditiveAlpha, it may make it look more glossy or something.

Get it in game and sit there salivating at the thing of beauty you have just created!

<object width="425" height="279"><embed src="http://media.xfire.com/swf/embedplayer.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="279" flashvars="videoid=4862bd"></embed></object>

http://www.xfire.com/video/4862bd/

Hope that helps and is clear enough.

Edited by Spatchman

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×