Ben1138 / Unity-SWBF2-Import

Import Star Wars Battlefront 2 (2005) Maps and Models into Unity
GNU General Public License v3.0
23 stars 6 forks source link

*Statement* Wow! #3

Open Shadowfita opened 6 years ago

Shadowfita commented 6 years ago

This is something I have been thinking about attempting for the last couple of weeks and now after a bit of research I've stumbled across this. Amazing work! Have you got any future plans for this? Or was it just a "what the hell lets do it" sort of thing?

Shadowfita commented 6 years ago

I have an actual question now! Haha.

My SWBF2 Mod tools dont seem to have normal maps that the plugin searches for. "Could not find Textures/kam_bldg_antenna_normal" as an example. Is that something wrong with my install or is something extra needed for those textures?

Thanks!

NDRWhun commented 6 years ago

I've made a pull request. It's called Bump Map and it can be normal map. :) You'll see the update soon. I hope :D

Ben1138 commented 6 years ago

@Shadowfita A bit from both. I'm currently working on a C++ version of LibSWBF2 (if I find the time), which should replace the C# version in the long term (with an appropriate wrapper). This warning you're getting can be ignored (and actually be discarded from code). Any texture ending with the given NORMAL_MAP_SUFFIX will be used by Unity's material as normal map if it exists, thats all.

@NDRWhun Battlefront's bump maps consist of one channel, but unity expects normal maps with 3 channels. I batch generated a normal map for every texture with gimp, so this is kind of a leftover from that attempt. I merged you request anyway, feel free to contribute and improve ;)

NDRWhun commented 6 years ago

I'm trying to understand the importer and the layer files. I don't know why some objects are missing. Zero editor can load maps like Coruscant properly, but in the importer it's messed up :/ I'll try to improve.

Shadowfita commented 6 years ago

@NDRWhun I noticed that too. I'll be focusing on terrain things first (loading textures, fixing clipping through objects) and was planning on looking at that afterwards. Let me know how you go.

NDRWhun commented 6 years ago

Maybe I should check out the placement coords in the parser. Maybe a simple thing :D If you export models one by one and import it to the engine you will face the same issue.

Ben1138 commented 6 years ago

@NDRWhun The .wld and .lyr file parser is just a huge regular expression, which was just the quick and dirty way to get the information I wanted. So it's not perfect at all (might be the cause of this).

NDRWhun commented 6 years ago

@Ben1138 I'll try to adjust it. Not shure how to start yet. Maybe I should use some third party program to reverse the Zero editor wld/lyr infos. That would be the best way. But I cannot reverse it as I wanted. It's hard. Maybe with hexeditor. It's a good practice for me :D

Ben1138 commented 6 years ago

@NDRWhun The best thing would be a proper parser/interpreter. But I wont integrate this in the old C# version, but in the C++ version when it's hitting a useable state. IIRC the .wld and .lyr files just consist of lua functions. So integrating lua in LibSWBF2 would be a good idea anyway since all scripts are written in lua.

@NDRWhun and @Shadowfita I really appreciate your participation guys! You would help the progression alot if you guys could help porting LibSWBF2 to C++ first. There are some problems with the C# implementation anyway that I want to eradicate, besides speed.

NDRWhun commented 6 years ago

I'm doing my best. But I have to learn programming and understanding things. It's a lot different than FreePascal.. :'D I've learnt that a long time ago on a very very basic level. But in Unity it needs a C# wrapper?

Ben1138 commented 6 years ago

@NDRWhun a .NET wrapper (in C#) is part of the new LibSWBF2 :)

Shadowfita commented 6 years ago

@Ben1138 I'm certainly happy to help out where I can but I'm not very confident in C++. Might be a good learning opportunity though! Is there any way I can contact you outside of this? Discord etc?

Ben1138 commented 6 years ago

I created a discord group, so we can meet there: https://discord.com/invite/nNUapcU

Fallenleader commented 5 years ago

Discord link has expired, and I would really like to communicate with you. I personally have a single request of adding in the option to import the terrain as a mesh rather than a native Unity terrain. Unity terrain does no support "cave" like edging, which makes maps like Geonosis break in specific areas where the terrain is gouged in or cut in game, however they handle it. I tried ticking the option "terrain cut" which I would have thought would do what I am after, but it changed nothing unfortunately. I am working on a project right now where your tool is a literal godsend.

Shadowfita commented 5 years ago

@Fallenleader your name looks super familiar! I swear I know you from somewhere. Here's a link (hope Ben doesnt mind) https://discord.gg/GnPN65e . Yes we spoke about that and had the exact same idea but Ben is focusing on moving his library to C++ before doing any major changes like that as far as I am aware. We spoke about the possibility of the library that already exists to convert terrain to mesh.

Fallenleader commented 5 years ago

I will parrot this comment in the discord, but the issue with going BF2 -> terrain -> mesh using Unity's option is it will not resolve cutouts and holes if the source (BF2) has such. Going directly from BF2 -> mesh can be made to preserve anything that isn't preserved as a terrain, including texture references (as currently they have to be repainted) and cut/deformed polys for props (currently unsupported by Unity terrain). You might recognize me once I share pictures of my progress of my own project in the discord.