Jump to content

[WIP] Blender Bsp Importer


Recommended Posts

Hello folks,

 

I've been writing this importer for some time now and I think now is the time you can test this too. It's written for Blender 2.81. Older Blender versions are not supported because of incompatibilities in the material system. You need to unpack all your data to some directory because the plugin can't read pk3 files.

 

Discord:

Blendiant Task Force

 

Download:

GitHub

Download the import_ja_bsp_plugin.zip under Assets and install like every other Blender plugin. Copy your unpacked basefolder location into the preferences of the plugin after activating it and you are good to go. You will find a import -> JA BSP (.bsp) entry in your menu.

Start importing your .bsp and go grab a coffee, it's pretty slow right now, this will be fixed when I have some more time.

 

Known Bugs:

- portals don't work

- transparent shaders don't look like in the game (not really fixable I think)

- some rgbGens aren't implemented

- some tcMods aren't implemented

- skyportals aren't implemented

- fog is not implemented

- animmaps aren't implemented

- tcGen environment is not outputting the same reflection vector as the game

- potentially load order of the shader files is wrong (maybe someone could check that for me? ? )

- only one imported map at the same time is working properly

- system console still prints some debug info that is not needed for a user

 

Pictures:

 

spacer.png

spacer.png

spacer.png

Link to comment

An exporter is not planned, but some other useful features. More info about that will follow soon.

 

I wrote a Noesis plugin and some blender plugin some time ago to do something very similar, but I wasn't satisfied with it, so I started writing this. It involved some nasty stuff like decompiling the bsp file to get the enitity infos into the old plugin and this was very annoying.

TheWhitePhoenix likes this
Link to comment
  • 3 months later...
  • 2 months later...

Upcoming new Features in the next update

Blender 2.83 support

Light baking in Blender:

Spoiler

 

- Baking of lightmaps, vertex colors and lightgrid

- Changing lightmap texture coordinates

- Patching bsp files directly, no other software needed

 

 

 

Entity modding:

Spoiler

 

- Currently only JKA Singleplayer support

- Patching bsp files directly, no other software needed

oSvYSeQ.jpg

 

MD3 Import:

Spoiler

 

- Lighting preview

- no animation support

F4spBDd.jpg

 

MD3 Export:

Spoiler

 

- No need to triangulate models before exporting

- No need to manually split seams at uv boarders

- Material assignment via Blender material names

- Custom normal support

- Objects with more than one material are supported

SsUZmJ6.jpg

FVliryp.jpg

 

If somebody is interested in testing:

Current development branch
https://github.com/SomaZ/Blender_BSP_Importer/tree/ent-lighting-modding

Link to comment
34 minutes ago, Aldro Koon said:

@SomaZ

As someone clueless: Is there any reason for using this when it comes to mapping? Can we actually entity mod through this? And even decompile maps or am I missing something?

I myself have done something similar to this (via Noesis) and it's useful because textures stay aligned when the map is converted to a model. For collision, you can simply decompile the map and convert most of the textures to physics clip. At least, that's what I do.

The only real problem I've found with this is that the lighting is a little bit messed up in some places, mostly on the floors.

Link to comment
3 hours ago, Aldro Koon said:

@SomaZ

As someone clueless: Is there any reason for using this when it comes to mapping? Can we actually entity mod through this? And even decompile maps or am I missing something?

This is mainly a tool to fix things you can never get right in radiant. Sometimes vertex normals end up not beeing smoothed or you simply pull your hair out trying to get some nice lighting. (Vertex normals are used for "phong" shading, so you can actually force faces to be smooth in my plugin after compiling a map)

So basically you can use this to beautify your maps afterwards. You don't need to decompile the map or else. Just patch the bsp file directly with this addon.

Yes, we can actually entity mod through this. This is basically unfinished, but it already works like a charm. I think only rotating stuff is unfinished actually, rest should be fine. Also, just patch the bsp file directly with the addon. No need for another software.

No, this can't decompile maps into .map.

FFA3 with some new baked lightmaps for the gl2 renderer

Spoiler

PcnvrC6.jpg

mupDqWf.jpg

TFPNHZD.jpg

7sRh4gd.jpg

43pzrNN.jpg

Very simple enitity mod of mp/Duel1, added two misc_model_statics

Spoiler

AqjPdWU.png

 

3 hours ago, Droidy365 said:

I myself have done something similar to this (via Noesis) and it's useful because textures stay aligned when the map is converted to a model. For collision, you can simply decompile the map and convert most of the textures to physics clip. At least, that's what I do.

The only real problem I've found with this is that the lighting is a little bit messed up in some places, mostly on the floors.

Lighting works perfectly fine with this addon, when you put some effort in reworking the lightmap texture coordinates manually. You can save them back into the bsp to get no light leaks.

 

Whoops, forgot to repeat the best thing about this. You can patch the vertex colors and the lightgrid too. Means, you can light everything in blender. Older approaches could only bake lightmaps. Vertex colors are used when a surface doesnt have a lightmap. In the vanilla game, there are lots of vertex lit surfaces. The lightgrid is used to light players. So, now you can rework the lighting completely in blender and not just make it better. Guess I should show off some drastic light changes like, yavin at night or something like that. ?

Droidy365 and Lancelot like this
Link to comment
  • 6 months later...
On 1/30/2021 at 8:43 AM, RepJunkieJr said:

I was hoping I could get some help here. I made a directory, extracted the contents of a map pk3, and imported the bsp, but I'm getting zero textures. The textures are extracted as well, but nevertheless I'm getting nothing here. Can I get a hand?

Ah sorry. I missed your message. Hm, hard to tell whats wrong, simply because this version of the addon is very outdated (note to myself: make a new release on GitHub). You can get the latest version when you download the current code from GitHub. You need to repack it into another zip file though. Extract everything, and pack the "import_bsp" folder into another zip file. You can install the new zip file afterwards. You might need to restart blender after you installed it. The only Blender versions working with the latest code are Blender 2.83 to 2.91. If you still run into problems, you can always join the discord server I linked in the first post for quick help.
 

On 1/30/2021 at 5:15 PM, tinny said:

This is really cool!  Noob mapping/modeling question, will this allow blender to be used for mapping?  I really thought blender could only be used as a model importer/exporter.  Didn't know an entire map could be treated as one.

It could be used for mapping to some extend, but its complicated. For beeing able to write bsp files from scratch, I'd need to write some nasty things like collision mesh generation and visibility computation.

DarthValeria likes this
Link to comment
  • 2 months later...

Hey. So just an update. I was able to get it to import the bsp data. It created shaders for each texture in Blender, but it did not actually make any efforts to retrieve them and set them to the shaders, forcing me to do it manually. I run 2.81 and I can't exactly update to 2.83 due to addons that I can't go without, and I already have three different installations of Blender in different versions, so getting 2.83 is not ideal. It's a hell of a grind, but in the end, with the work I'm making, I think it's worth it.

DarthValeria likes this
Link to comment
6 hours ago, RepJunkieJr said:

Hey. So just an update. I was able to get it to import the bsp data. It created shaders for each texture in Blender, but it did not actually make any efforts to retrieve them and set them to the shaders, forcing me to do it manually. I run 2.81 and I can't exactly update to 2.83 due to addons that I can't go without, and I already have three different installations of Blender in different versions, so getting 2.83 is not ideal. It's a hell of a grind, but in the end, with the work I'm making, I think it's worth it.

I'm sorry, but 2.81 simply won't be supported anymore. It had some bads in the material system and they finally fixed them in 2.83. It would be a huge task to support older versions, or more precise it would clutter the code so its not very readable anymore. And that's not very nice to work with. 2.83 is in fact the most ideal version of blender right now as its the long term support version of 2.8. When 2.93 arrives, this will be the new ideal version to work with.

Link to comment
  • 6 months later...
On 10/30/2021 at 8:32 AM, TheVoxyn said:

Any chance you're going to release that 2.83 version soon? I'm getting the same problem RepJunkieJr has.

Hey! Currently refactoring the whole addon to be easier to maintain and also adding some new features like pk3 support. Target version of the new version will be Blender 3.0, though I'd like to keep it 2.93 compatible. You can get the latest working wip verision (Blender 2.83 - 2.93) on our discord. Link is in the first post.

Direct download link (Blender 2.83-2.93):
Latest release with current code from Github

OCD2, Srethem and DarthValeria like this
Link to comment
  • 1 year later...

I just uploaded a working version of the addon for Blender 3.3. This is a patched up version which still doesnt have pk3 support.

 

https://github.com/SomaZ/Blender_BSP_Importer/releases/tag/v0.9.633

 

@Tchefuncte Bonaparte If you are used to the old md3 exporter, you can name the materials directly. The md3shader custom property is not used in this addon. You also dont need to split the model anymore, the exporter will take care of it. Triangulation is also taken care of by the exporter.

 

Install guide is found here (but use the version I linked above):
https://trello.com/c/aMEbgAXC

You all can now also use this tutorial instead

 

Edited by SomaZ
Approved JKHub tutorial
Link to comment

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
×
×
  • Create New...