Skip to content

Beta Editing 3D Models

Deijin27 edited this page Sep 5, 2022 · 7 revisions

Outdated guide, see https://github.com/Deijin27/RanseiLink/wiki/Map-Editing-Guide


This guide shows you how to edit a battle map model using RanseiLink-Console-5.0-Beta

I will export, modify, and reinsert the aurora map for this guide.

It will help a lot if you have a basic understanding of how blender works.

Using RanseiLink Console

This is just one way to use the console app. In command prompt.

Go to the folder containing the exe. Type cmd into the top bar and hit enter, this will open a command prompt in this directory.

Then to run a command type in the console RanseiLink.Console <the command>. e.g.

image

1. With whatever tool you like, extract the map PAC file.

You could use the console command:

nds extract file "rom.nds" "graphics/ikusa_map/MAP00_00.pac"

Here I use nitro explorer 2b

2. Unpack the pac archive file

pac unpack "MAP00_00.pac"

See the files

  • nsbmd = model and materials
  • nsbtx = texture and palette
  • nsbta = texture uv animation. not present in all
  • nsbtp = texture pattern animation. not present in all
  • nsbma = material animation. not present in all

3. Extract model and textures

Extract by providing the folder containing the nsbmd, nsbtx etc.

nsbmd extract "c:\path\to\folder\containing\files"

See the extracted model (obj), material library (mtl), and textures (pngs):

4. Import into blender

The way you import into and export from blender is important, follow these steps carefully.

Launch blender and delete the default objects to have a clear scene:

You can open the obj in blender File > Import > Wavefront (.obj):

Screenshot (34)

THE SETTINGS ARE VERY IMPORTANT:

Loaded correctly the scene should look like this.

View the textures on the texture paint tab:

image

The model is quite big, so it will likely look clipped. You can increase the clipping distance with View and turn on the sidebar, then on the View tab of the sidebar, increase the clip end.

image

5. Edit the model

I will show you some basic edits, but it is beyond the scope of this tutorial to properly teach you 3D modelling.

Editing textures

Edit the textures as you wish, keep in mind you have palette count limits. ATM the importer uses 256 color palettes for everything, and only supports full-transparency, not semi-transparency. This is not set in stone however.

The command simplify palette <imagePath> <maxColors> may help you simplify the image.

Adding an object

I will add a simple cube for this example.

Hit Shift+A and select cube to add a cube

Screenshot (39)

It will appear in the scene collection on the right. You can rename it, but remember there is a 16 character limit on names. Scale the cube up using the scale tool. I have named it "polygon17", scaled it up, and moved it to above the water.

image

On the texture paint tab, you should select the cube object, and see in the bottom right it has no material yet. Click "new" to add a material.

image

Click new and it creates a new material. Rename the material if you like, making sure to stay within the 16 character limit. You can edit diffuse, ambient, specular color, and alpha.

In the material info, by "Base Color" click the yellow dot and select "Image texture".

Now you can choose an image from your file system, but we are going to click to create a new image

Because of how texture width and height are stored, a dimension can only have values: 8, 16, 32, 64, 128, 256, 512, 1024.

I will create a 64x64 texture for the cube. The name must be less than 13 characters because the palettes are stored as <texture_name>_pl so we have 3 less than the normal 16 length name limit.

Then edit the texture. It has the cube UV map, but you can create a more complex shape and unwrap the UV, but this is just general 3D modelling knowledge that you will need to learn. For now, this is what I have, a cube with a smiley face:

image

Make sure to save the image Image > Save, then we can export the model.

6. Export the model

File > Export > Wavefront (.obj)

The settings are once again very important. The file name is relevant , make this the name of the map, for me MAP00_00; this is used inside of the nsbmd file, and while I havent tested it yet, it may not work unless it matches the name of the map. At the very least, the 16 character (excluding file extension) name limit applies here too.

You should see the obj and mtl files appear. The textures will be wherever those files were located originally, and wherever you saved your custom textures too. Be caseful moving the obj file around, since these may be relative paths. You can easily open the mtl file in a text editor and see, and change if necessary.

7. Generate the nsbmd and nsbtx

Run command

nsbmd generate "C:\Users\Mia\Desktop\MAP00_00.obj"

You will see the files appear in a folder next to the obj.

8. Recreate PAC

The folder should be set up as it is before. For now leave out animations (unless you've only added to an existing model without changing names, then the same nsbta and nsbtp files should work. I will try to make custom texture swap and scroll animations possible in time.

pac pack "c:\path\to\folder"

The command uses file order, and auto detects the file extensions to decide how to create the pac, so they need to be correct.

9. Reinsert the PAC into the rom

Reinsert with tool of your choice, or use command:

nds insert file "rom.nds" "graphics/ikusa_map/MAP00_00.pac" "c:\new\pac\file.pac"

10. Hope it worked

Closing notes

The height at which pokemon are placed is stored in the pslm files, these are what you currently edit on the map page. It would of course be extremely tedious to do this manually, so I will in addition to allowing manual tweaking, write some code to automatically generate the height map for you when you import a map model.