10-08-2015, 03:27 PM
This add-on optimizes all my Mario Kart 8 model rips to be perfectly displayed in Blender.
OBJ/MTL or DAE imports are not perfect when importing them into Blender. I could fix it, but that would break the files in some other stupid programs. So I kept it at a compatible, but more ugly minimum. Specifically, OBJ/MTL imports have separate texture slots for alpha and color, resulting in a dirty border on alpha-transparent textures. Also, some textures are mapped incorrectly (mostly it's normal to diffuse slots for shaded objects like water). Just look at these horrible gray borders around leafs and the weird water normal texture:
My script fixes all this, and after importing the OBJ or DAE files with it, applying all the additional effects of normal, specular and emissive maps, it looks like this:
No more g( r )ay borders on the leafs, detailled sand and stone patterns and additional effects as soon as you render. Of course, the water turned transparent; but that's correct, as it's shaded in-game and the normal map is surely wrong as a diffuse texture!
My script fixes all this, and after importing the OBJ or DAE files with it, applying all the additional effects of normal, specular and emissive maps, it looks like this:
No more g( r )ay borders on the leafs, detailled sand and stone patterns and additional effects as soon as you render. Of course, the water turned transparent; but that's correct, as it's shaded in-game and the normal map is surely wrong as a diffuse texture!
The add-on is installed in a typical Blender way. This means:
- Download my addon zip file here: http://ray.syroot.com/vg/rayobjdae/io_sc...objdae.zip
- Go to your Blender installation directory, into the folders "<version>\scripts\addons".
- Into there, extract my addon (so that the two python code files will be placed inside a "<version>\scripts\addons\io_scene_rayobjdae" folder).
- Start Blender, and go to File > User Preferences.
- Switch to the "Add-ons" tab, and from the categories on the left side, select "Import-Export", or just search for "Ray"
- Tick the left box of the "Import-Export: Optimized OBJ/DAE import for Ray Koopa Rips" plugin row to enable it.
- Click "Save User Settings" to have it enabled every time you start Blender now.
- Instead of using File > Import > Collada (.dae) or Wavefront (.obj), use "OBJ/DAE Model Rip (.obj;.dae)".
- Browse to my downloaded rip OBJ or DAE file and double click it. The script will do its stuff after the default Blender importer imported it. If you want to see it in action (or get an error), watch the console.
There are also some interesting options in the import dialog, but you don't normally have to touch them:
- Optimize Textures: Unticking this will keep the buggy texture slots and not recreate them from scratch.
- Remove DAE shininess: When importing a DAE, Blender sets an ugly high shininess on everything, this resets it back to 0.
- Force Version: Some textures, like the ones of trophies, come in different versions, recognizable from their filename. E.g., a trophy has a version "1" for gold, "2" for silver and "3" for bronze. Normally, the version mentioned in the OBJ file is used (mostly "1" for gold in my rips), but you can override it here to load the version "2" or "3", or whatever exists. Here's a quickly imported silver fire flower trophy, just by typing "2" there:
- This is guaranteed to work on rips by me. If you try it on other rips, the results may not be complete or erroneous, depending on how the others ripped their models. It's important texture files are in the same folder as the model file (not sure if my new add-on even handles textures in other folders).
- It does not load the *_Add, *_Alp, *_Trm or *_Mtl textures, as I don't know how to apply them (and what they are exactly). Please share information on how to apply them in Blender if you know about it!
- Since my rips do not include the bake texture coordinate layers, this script cannot add it back (even if the baked textures are included in the rips). The layers just created a horrible outcome for must cheap model editing programs, and I wasn't 100% sure on how to correctly apply it anyway, so I left it out.
- Some textures have a buggy transparency, depending on how (in)correctly TexConv2 converted them. That would have to be fixed in the texture image manually which I try to do in my rips, but I might have missed some spots. If you find a buggy texture, just remove the alpha channel out of the affected textures (SNES Donut Plains 3 for example had a weirdly striped road at first).
- It also doesn't fix the wrong repetition setting of textures as it can't know those settings (e.g. eye pupil overlays correctly would not repeat, Lakitu Referee's body would wrap-repeat...).
- 18.05.2016 - 1.1.0
- Now reusing already loaded textures instead of loading them multiple times.
- "Force Version" is disabled in the import dialog if "Optimize Textures" is unchecked, as it cannot be handled without that.
- When no texture name could be parsed, the texture slots are left as they are instead of discarding them.
- Smaller performance and code style optimizations.
- Now reusing already loaded textures instead of loading them multiple times.
- 17.05.2016 - 1.0.0
- Initial add-on release
- Initial add-on release
WTFPL. Do what you want with my add-on code, even using it as a base for your own add-ons; I don't care. Just play nice!