Jump to content
  • Animated Textures on Models

    • Cirevam
    • Written By Cirevam
    • Published
    • Comments 7 comments

    Animated textures (aka "sequenced textures") on models are possible now. It's simple to do but is limited by animations. This video will show you the basics. You can grab the blinking raiders patch here.

     

     

    Guide Transcript

    Hello Rock Raiders. Today I'm going to show you a new kind of mod available in Lego Rock Raiders: sequenced textures. This is something that was previously locked out of the Rock Raiders modding community due to modern versions of Lightwave not exporting the necessary information to make the textures work. Big thanks to @Yellowkey for pointing me to the bits that needed to be edited in order to make this possible.

     

    What are sequenced textures? They are simply animated textures, and the game uses them to great effect already. You can see them in smoke effects and a few particles, but they're not used much beyond that. They can be potentially used on almost any sort of object, but there are a few requirements. I'll go over those before diving into the details.

     

    The following conditions must be met in order for a model to support a sequenced texture:

     

    1. The texture files must end with numbers, usually starting with 0000 and increasing by one for each frame, though it is possible to use three numbers and not start with all zeros.
    2. The model must be directly included in an animation file.
    3. The model's texture definitions must specify the texture as sequenced.


    The first condition is evident where sequences textures are already used. You can look in the World\Shared folder and find textures like Adst001 and ssss0000. These are textures used for various smoke and steam effects, and each file represents one frame of animation. The game automatically finds the beginning and end of each set of images like this, so you do not have to define anything besides the name of the first file.

     

    The second condition is trickier since it's not obvious just by looking at an object. I say "object" instead of "model" here as some objects, like vehicles and monsters, are created using several models that are combined in an animation file. Other objects like crystals, ore, and electric fences are not contained in animation files and cannot use sequenced textures. This also extends to vehicle wheels and upgradeable parts like drills, as they are added on top of the vehicle within the game. They do not exist in the actual animation file. It's possible to check this yourself by opening the animation file, or LWS file, in Notepad and look for the model. If it's defined in the animation, it's ready to accept sequenced textures.

     

    Lastly, the model must specify that its textures are sequenced. This part requires a bit of work, as the only known legal method of inserting this information requires a hex editor. The other method involves flying to Denmark and retrieving the source code from LEGO's vault, which might only be possible if you're a member of the Alpha Team. Luckily, we've identified the values that you need to edit, and it's not hard once you know what to change. This is a mod that anybody can do.

     

    Here I have two models opened side by side in a hex editor. I personally use XVI32, but any hex editor should work. Do you notice some of the differences already? There are four values you have to change. The first three are quite subtle: FORM, which is four bytes long and reflects the total length of the file; SURF, which is also four bytes long and reflects the length of the surface for the texture; and TIMG, which is two bytes long and reflects the length of the file path for the texture's first file. You also have to change the file path to include the text " (sequence)" at the end, and that includes the space in front. This is what tells the game to start animating the texture. You can't stop at that change, as the model will be considered invalid if you do not adjust the lengths in FORM, SURF, and TIMG. All lengths are defined in hexadecimal, so you must either convert them to decimal, add 11, then convert back to hexadecimal, or directly add 0x0B to each number. Note that you must add multiples of this number to FORM for each sequenced texture in the model, as it reflects the entire file length. We are editing two textures in this example, so you must add 22 or 0x16 to FORM. The Windows calculator has a programmer mode which allows you to switch between the two types with a single click. This may be the easiest if you are not familiar with hexadecimal.

     

    Be careful when changing the numbers in the file. Remember that each letter on the right is represented by two hex numbers on the left. If your calculator shows a three digit number, like 1A3, you must add a leading zero when typing it in. Thus 1A3 becomes 01A3. Also remember to overwrite the existing numbers instead of adding new ones in place, or the file will be considered invalid. And always ALWAYS backup your files before doing changes like this.

     

    Alright, we're done. Let's see what it looks like in-game. This model has two planes, with the left plane counting from zero to 24, and the right plane counting from zero to three. The framerate is defined by the global timer, which runs at 25 frames per second. I've slowed the game time down so you can see how the numbers get out of sync with each other, but they always change to the next frame on each tick of the global timer. Please note how the right plane resets to zero early at times. This is because the texture sequence starts over when the animation loops. This leads to odd effects, such as here, where the minifigs only blink when they're doing something other than standing. The standing animation is zero frames long, and the blinking texture is 41 frames long. The blinking does not start until frame 27, so any animation that is not at least that long will not blink.

    • Like 2
    IntermediateDIFFICULTY
    2752READS

    Featured Guides

    Newest Guides




User Feedback

Recommended Comments

I had a weird issue where the file was invalid because there was an extra 00 after the path for the texture, which Lightwave had exported there by default - pre-edit, this caused Lightwave to try to load a texture just called ".", but didn't cause any issues otherwise; after doing all the texture stuff, it just caused the file to be corrupted. It worked once I removed it and snipped a byte off the surface length, but I don't know how it got there in the first place or why it only had an issue with it once the sequence tag was added. Every textured model I've processed has had this "." issue and I don't know if it's something I'm doing wrong or what, but if it's gonna cause issues like this then that's not good.

Share this comment


Link to comment
Share on other sites

I get the same thing with every single one of my custom models that load textures. It's interesting that it broke for you, since this method works fine for custom models. The numbered squares in the video are indeed custom. Which version of Lightwave do you use for models? I use 9. Maybe there's a difference in the exporter plugins.

Share this comment


Link to comment
Share on other sites

In your video it only showed you had 00 after the texture path, mine has 00 00 is what I meant. I wouldn't think something that minor could cause a problem, but it seemed to change something. I'm using LW8.0 for everything. I guess the "." thing is irrelevant then if you get it too, except it also went away for me when I snipped the stuff that caused the model to not be corrupted with the animated texture. The model in question I'm texturing is also made from scratch, sorry if that wasn't clear.

Share this comment


Link to comment
Share on other sites

Okay, I got that working the lazy way by just deleting 11 characters from the file path (sorry lmao), but I think I might have found another situation where animated textures don't work. I made a low-poly version of a model with animated textures, and linked up the HP version in the AE file in the mediumpoly {} and highpoly{} sections. The HP linkup works in-game, but the textures aren't animated on it, only on the LP model in top view. The polygons that display the textures are exactly the same, the changes made to the textures are the same - in fact, this same model worked when I had it as the default instead of its LP version. But apparently, unless I'm doing something wrong that I'm not noticing, HP/MP/Camera1/Camera2 versions of models are treated the same way as mounted upgrade models in regards to animated textures.

Share this comment


Link to comment
Share on other sites

That makes sense. Cyrem was having issues getting the blinking raider head to work right, and the LODs were part of the issue. Raiders are the only things that use HP/MP models, right? The HP raider mod fixes that and the rest of the game is hopefully not a problem.

Share this comment


Link to comment
Share on other sites

32 minutes ago, Cirevam said:

Raiders are the only things that use HP/MP models, right? The HP raider mod fixes that and the rest of the game is hopefully not a problem.

No pretty much all the vehicles besides the Small Digger and Granite Grinder have MP models, though most don't have HP models causing it to jump back to LP when you get close in eye view, and I think the Tunnel Transport's might be backwards somehow. I think the Loader Dozer's are important in eye view so you can see through the bucket. The Rock Monster has VLP and HP versions of all its parts, and the Ice Monster does for its icicles. I don't think any of the buildings do. The Lava Monster supposedly does but I can't tell any difference.


With that issue I was having last night, I ended up just making the surfaces with the animated textures their own models and attaching it to the model with the HP and LP modes through the LWS. With the original models though, it's probably not worth it.

Share this comment


Link to comment
Share on other sites



Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.