How to use b3d in blender?

rgh
Member
Posts: 46
Joined: Fri Oct 07, 2016 13:32

How to use b3d in blender?

by rgh » Post

What's currently the best way to import b3d files into Blender?

Looking at a previous post here, I've found:

https://raw.githubusercontent.com/minet ... DExport.py

which exports as b3d from Blender, but what about importing into Blender?

This discussion:

https://www.blender.org/forum/viewtopic.php?t=26311

suggests converting to some intermediate format using tools based on the assimp library. I've tried both the 'Open 3D Model Viewer' v1.0 and an older program assimp_viewer.exe, but neither seem to be able to open b3d files, or at any rate, not the ones that ship with minetest.

What's the current way to do this?

I've never used 3d model files before, so I may be overlooking something obvious :)

User avatar
pithy
Member
Posts: 251
Joined: Wed Apr 13, 2016 17:34
GitHub: pithydon

Re: How to use b3d in blender?

by pithy » Post

assimp only works with one of the models in mobs redo.

User avatar
twoelk
Member
Posts: 1391
Joined: Fri Apr 19, 2013 16:19
GitHub: twoelk
IRC: twoelk
In-game: twoelk
Location: northern Germany

Re: How to use b3d in blender?

by twoelk » Post

This page might help: http://wiki.minetest.net/Using_Blender
It seems to suggest to use an older version of Blender.

rgh
Member
Posts: 46
Joined: Fri Oct 07, 2016 13:32

Re: How to use b3d in blender?

by rgh » Post

pithy wrote:assimp only works with one of the models in mobs redo.
Thanks pithy.

Using the models that come with mobs redo, I can open the *.x files in 'Open 3D Model Viewer' and from there save in .3ds or .ply formats, either of which I can then open in blender.

However, I still can't open the .b3d files, 'Open 3D Model Viewer' giving an 'Bad texture id' error.

User avatar
ExeterDad
Member
Posts: 1717
Joined: Sun Jun 01, 2014 20:00
In-game: ExeterDad
Location: New Hampshire U.S.A

Re: How to use b3d in blender?

by ExeterDad » Post

It's been way too long since I've used Blender, so much could of changed. But I remember not being able to import b3d files. I did much research and tried many approaches without success.

rgh
Member
Posts: 46
Joined: Fri Oct 07, 2016 13:32

Re: How to use b3d in blender?

by rgh » Post

Thanks ExeterDad, surely they must be editable in something! It would seem odd for the minetest community to adopt a file format with no associated tooling.

Another thing I tried was to look at www.blitzbasic.com, supposing that company to be the creator of the original file format.

There are a couple of freely downloadable tools there, although they don't seem to know anything about b3d.

User avatar
ExeterDad
Member
Posts: 1717
Joined: Sun Jun 01, 2014 20:00
In-game: ExeterDad
Location: New Hampshire U.S.A

Re: How to use b3d in blender?

by ExeterDad » Post

Thinking back I was able to convert to .obj with a Windows program (using Wine on my Linux box - Painful). Then Blender would easily import. But the showstopper was .obj doesn't support bones, animations and such. Since our voxel looking models are far from complex, it was just easier to build from scratch, rather then sort out all the vertices and rig the things.

rgh
Member
Posts: 46
Joined: Fri Oct 07, 2016 13:32

Re: How to use b3d in blender?

by rgh » Post

yep.. seems like a lot of trouble. Probably not worth it just to see what a few chickens look like.

Guess I'll just play with the other formats.

toby109tt
Member
Posts: 649
Joined: Sun May 29, 2016 23:42
In-game: toby

Re: How to use b3d in blender?

by toby109tt » Post

hey hallo i have been looking for a way to get this working and nothing worked but i found ithis http://www.meshconvert.com/ i used .b3d to .dae and it works so yyyyyyyyaaaaaaaaaayyyyyyyyyyyy

note that i used super tux kart models but mt models shuld be the same

User avatar
Tcll
Member
Posts: 70
Joined: Thu Jul 25, 2019 21:43
GitHub: Tcll
IRC: Tcll Tcll5850 DarkPikachu
In-game: Tcll
Location: The Gates of Darkness.

Re: How to use b3d in blender?

by Tcll » Post

I don't mean to necropost...
but I'm wondering if there's a spec sheet post or wiki anywhere on this format...
I'm working on a program designed to convert between model formats using very simple scripts, and would like to work on a script for the format :)

if there's not a spec sheet, I can get away with RE-ing the blender script, but still, would be nice to know about to save me that work :)

I can't seem to find anything by searching, I think DDG and Searx just don't like me or something :P

User avatar
sirrobzeroone
Member
Posts: 191
Joined: Mon Jul 16, 2018 07:56

Re: How to use b3d in blender?

by sirrobzeroone » Post

Something like this?

https://github.com/blitz-research/blitz3d

Not sure if this helpful, but I managed to convert a .x to milkshape format then import to blender you can do something similiar b3d to milkshape then import that to blender (i did that for making sheep icon etc for mobs animal)- few notes here on what I did:

viewtopic.php?f=11&t=9917&start=1700#p347251
Last edited by sirrobzeroone on Fri Aug 02, 2019 10:29, edited 1 time in total.

User avatar
sirrobzeroone
Member
Posts: 191
Joined: Mon Jul 16, 2018 07:56

Re: How to use b3d in blender?

by sirrobzeroone » Post

opps double post - sry

User avatar
Tcll
Member
Posts: 70
Joined: Thu Jul 25, 2019 21:43
GitHub: Tcll
IRC: Tcll Tcll5850 DarkPikachu
In-game: Tcll
Location: The Gates of Darkness.

Re: How to use b3d in blender?

by Tcll » Post

sirrobzeroone wrote:Something like this?

https://github.com/blitz-research/blitz3d

Not sure if this helpful, but I managed to convert a .x to milkshape format then import to blender you can do something similiar b3d to milkshape then import that to blender (i did that for making sheep icon etc for mobs animal)- few notes here on what I did:

viewtopic.php?f=11&t=9917&start=1700#p347251
if you mean like program comparison, yes and no
don't believe blitz3D is also a library that can be integrated into other programs. ;)
in respect though, what makes my program a "program" is simply a plugin that gives my API a viewer :P

otherwise, no, I'm looking for something like this for the b3d format:
https://web.archive.org/web/20170323160 ... blend.html
had to use the wayback machine because the current page doesn't exist anymore... u.u

User avatar
Tcll
Member
Posts: 70
Joined: Thu Jul 25, 2019 21:43
GitHub: Tcll
IRC: Tcll Tcll5850 DarkPikachu
In-game: Tcll
Location: The Gates of Darkness.

Re: How to use b3d in blender?

by Tcll » Post

just want to mention
I've reverse-engineered the script, and as a python programmer, I want to say I'm disgusted and appalled.
I don't mean to throw shame on the developer, cause you can tell from the code they were a noob and probably didn't know anything about optimization...

but what's appalling is the fact this code is at least as old as 2009, and nothing's been done to improve it
in fact what's worse is every exporter I've seen in numerous languages during my research of the format makes little change to this same code, surely someone had to've at least had the idea to improve it...
and to add to that, I can't seem to find any engine that makes use of the b3d nodes named "CAMS", "AMBI", and "LIGS", though I think it's pretty obvious why minetest doesn't seem to use them :smirk:

I'm currently working on my own exporter, specifically for minetest, as nothing takes into account the various texture and material flags and enums minetest uses...
plus I'm learning the format as I'm working on a mod that'll allow you to "compile" in-game models from an LUA sandbox
I find it funny I seem to already know more about the format than it's creators, which is shameful if so >:/

here, have some candy:

Code: Select all

tex flags
 00000000000000011111111111111111
-00000000000000000000000000000001 (0x00001:1)     - default (unknown)
 00000000000000000000000000000010 (0x00002:2)     - alpha map
 00000000000000000000000000000100 (0x00004:4)     - alpha masked
-00000000000000000000000000001000 (0x00008:8)     - mip-map
-00000000000000000000000000010000 (0x00010:16)    - clamp u
-00000000000000000000000000100000 (0x00020:32)    - clamp v
 00000000000000000000000001000000 (0x00040:64)    - spherical env
 00000000000000000000000010000000 (0x00080:128)   - cubic env
 -------------unknown------------
 00000000000000010000000000000000 (0x10000:65536) - UV 2

tex blend
-0: replace
-1: decal
-2: modulate
-3: add
-4: combine RGB
 5: combine modulate
not too sure I understand UV2 very well as blender's UV layers make up glMultiTexCoord2f(GL_TEXTURE0 through GL_TEXTURE8, ...), which seem to be applied if I understand the codes/format well enough...
but that aside, anything marked with - doesn't appear to be used/read in minetest irrlicht
I could be wrong though, please correct me if I missed anything

I'm still currently working on RE-ing material Fx and Blend information, so that's why it's not included

EDIT:
btw, yes I will be posting the addon on GitLab once it's ready

I no longer use GitHub for any of my code as they became evil when they partnered with Microsoft
(if you don't understand what's so bad, wait till Microsoft starts claiming ownership over, and/or dictating what's allowed on GitHub)
^ they already did this with your applications on Win8 in 2012, and the fundamental functionality for this still exists in Win10 despite being inactive.

User avatar
FreeLikeGNU
Member
Posts: 226
Joined: Tue Oct 28, 2014 02:50
GitHub: FreeLikeGNU
IRC: freelikegnu
In-game: FreeLikeGNU

Re: How to use b3d in blender?

by FreeLikeGNU » Post

Tcll wrote:
Mon Aug 03, 2020 18:05
'm currently working on my own exporter, specifically for minetest, as nothing takes into account the various texture and material flags and enums minetest uses...
looking forward to this! Could I make a request that it export *only* the visible "collections" (used to be called layers) ?

many thanks!

User avatar
Tcll
Member
Posts: 70
Joined: Thu Jul 25, 2019 21:43
GitHub: Tcll
IRC: Tcll Tcll5850 DarkPikachu
In-game: Tcll
Location: The Gates of Darkness.

Re: How to use b3d in blender?

by Tcll » Post

FreeLikeGNU wrote:
Tue Aug 04, 2020 23:31
*only* the visible "collections" (used to be called layers) ?
uuuuh just so my autistic brain doesn't confuse things, you're talking about the UV layers right??
or is this in reference to blender's bpy Collection objects??

and by "visible" do you mean as in not hidden by H??
cause sure, I can do that :)

but if it's something like hidden by a transparent image, that I can't do
at least not without resource-hogging code to scan the image pixels :P

EDIT: sorry for my confusion... too many things called "layers" in 3D terminology :P

btw just to note, I can't run Blender 2.8 because the Void Linux kernel I'm running my primary with has a bad internal library,
and the Blender devs don't want to release an appimage to work around issues like mine.
so I'm stuck on 2.79 for now I'm afraid...

EDIT2: oh wait a second, I know what you're talking about
basically what used to be the the 20 buttons on the 3D view header

so basically you want me to only export what's on the active layers/collections
I could probably make a toggle or drop-down for that on the export settings :)
my script already exports context.selected_objects if you have that enabled, much like the old script ;)

User avatar
FreeLikeGNU
Member
Posts: 226
Joined: Tue Oct 28, 2014 02:50
GitHub: FreeLikeGNU
IRC: freelikegnu
In-game: FreeLikeGNU

Re: How to use b3d in blender?

by FreeLikeGNU » Post

Tcll wrote:
Tue Aug 04, 2020 23:39
FreeLikeGNU wrote:
Tue Aug 04, 2020 23:31
*only* the visible "collections" (used to be called layers) ?
you're talking about the UV layers right??
or is this in reference to blender's bpy Collection objects??

and by "visible" do you mean as in not hidden by H??
cause sure, I can do that :)
In 2.79, objects can be assigned to "layers" so for instance I have a witch model object on one layer, armature on another layer, hair styles and hats on other layers, armor on yet another layer. I would like to keep all the 3D assets for the witch and accessories in one .blend but be able to export the .b3d files (like body and armature layers in one .b3d file). In blender 2.8+ these are called collections.

Another solution (that is even better still) would just export actively selected objects. I think one of the earlier b3d exporters had this option.

Exporting only whats visible would also work if that is the easiest and most compatible between 2.79 and 2.8+ too.

User avatar
FreeLikeGNU
Member
Posts: 226
Joined: Tue Oct 28, 2014 02:50
GitHub: FreeLikeGNU
IRC: freelikegnu
In-game: FreeLikeGNU

Re: How to use b3d in blender?

by FreeLikeGNU » Post

Tcll wrote:
Tue Aug 04, 2020 23:39

my script already exports context.selected_objects if you have that enabled, much like the old script ;)
That's fine! Thank you for your work!

User avatar
Tcll
Member
Posts: 70
Joined: Thu Jul 25, 2019 21:43
GitHub: Tcll
IRC: Tcll Tcll5850 DarkPikachu
In-game: Tcll
Location: The Gates of Darkness.

Re: How to use b3d in blender?

by Tcll » Post

yeah, I'm doing my best to maintain the options of the script linked above
there was also a newer 2.8 script that also had an importer (which I have as well), but from looking at the code, it appears a lot of those options were removed...
unless I'm just blind, again, I can't run 2.8 to verify x.x

but yeah I can easily make a drop-down menu for that option :)
it'll just be layers for now, which I hope will be okay (hopefully 2.8 bpy has backwards compatibility for it)

I can't update my linux kernel to fix 2.8 as my primary currently has no internet for reasons (slowly building a secure VLAN/HV router for it and other machines)

EDIT:
looks like context.visible_objects does exactly what you want ;)
and if I'm not mistaken, should be compatible with 2.8

EDIT2:
dang, was actually hoping to have a first release (just a massive code shrink) out by today...
buuuuuut apparently I screwed something up with the root node generation and it writes a blank node containing the first node
(tested an original export with my export of the same model, and my b3d is bigger currently)

man whatever this convoluted code is doing, obviously I didn't read it quite right...
but at least for some good news, the rest of the sub-data looks in tact compared to the original export :)
and for even more good news, the added option works ;)
Image
^ not sure how well you can see behind the menu, but it says "Export specified objects:" if you can't make it out.

but anyways, don't hold your breath, but hopefully I'll be able to fix that problem today :P

btw, another little treat I added
if you don't overwrite, it renames the export to *.001.b3d (002, 003, etc (unlimited))
similar to how blender exports *.blend.001 on save, except 001 is the current file rather than the backup ;)

EDIT3: just to update
while I did fix the previous issues with my test model where it exports almost the same (missing 19 bytes of EoF padding)
apparently I've uncovered a bunch of other issues and need to make more test models...

I may just have to rework all of my TODO cases if I can't get my code functioning exactly like the original code
(basically, that means completely overhauling the code and properly parsing blender objects before exporting passively)

as I say with Minetest compared to Minecraft
you can't improve it if you can't replace it ;)

so yeah, my script might either be a short or long bit before it's put up on GitLab, depending on the tests
Attachments
Screenshot_2020-08-05_13-22-56.png
(12.59 KiB) Not downloaded yet

User avatar
Tcll
Member
Posts: 70
Joined: Thu Jul 25, 2019 21:43
GitHub: Tcll
IRC: Tcll Tcll5850 DarkPikachu
In-game: Tcll
Location: The Gates of Darkness.

Re: How to use b3d in blender?

by Tcll » Post

does anyone have a working model with multiple mesh objects,
or have anything that actually exports lights/cameras for some other project??

I've just finished looking through all the mods I use, and all of the models I've looked at are only a single mesh object...

I don't wanna build something custom just to find out it's not actually standard with Blitz 3D (the problem with poor documentation)
B3D seems to be another one of those fun weird formats like MD5, or PMX...
or the HAL Labs HSD Archive format with less support and reinvented standards. :P

EDIT: if not, I could probably try to see what happens with Brawl Pikachu :P
that's like the only brawl character I have a model for anymore... lol (thanks Western Digital for building cruddy HDDs that blow their head amps)
but down to it's basics, it's only 5 mesh objects with 1 texture each, so B3D shouldn't have a problem with it. ;)
(TEVs aren't handled by DAE conversion, so the smash eyes-don't glow like they should, but that's beside the point)

EDIT2:
okay I've just decided to overhaul everything since I've roughly figured out how this format works, and I already hate this format
it's the second worst format next to raw triangles where instead of storing individual vectors and indexing those per vertex
nooooo, instead it just stores the whole vertex (vector data and all) and indexes those per triangle... talk about a waste of data space >.<
why?
because if you have 2 vertices that use different textures for 2 different triangles, you have duplicate vectors with only different UVs

if you're uneducated about 3D as most are, a vertex is simply a single intersection point between 2 or more triangles
like the corner of a cube for example, which is an intersection between 3-6 triangles

what's my argument?
if you have a cube with the same texture on all faces, the B3D format will have 8 vertices total for that mesh
but if just one of those faces has a different texture, that mesh will have 12 vertices

what's the difference when it comes to data size?
well, it's dynamic really, but at most 1 vertex is (3*4)+(3*4)+(4*4)+(8*(2*4)) or 104 bytes
but on average for 1 texture (UV) and no vertex color, that's only 32 bytes (2 lines in a hex editor)

why I'm concerned is because that's (8 or 12) * 32 or (256 or 384) bytes for only the vertices of 1 cube
if you sort that into 12 triangles (B3D doesn't support 6 quads), it gets a bit confusing as it's per brush, but for the simplest single-textured setup that's about
400 bytes

where something more traditionally indexed (like IQM) would be... bigger than I thought for a cube...
448 bytes for the smallest single-textured cube possible... 8 positions, 8 normals, 14 UVs, and 6 quads
520 bytes for the same thing with triangles
why 14 UVs?

Code: Select all

      11   12


1     2     5     7     9


3     4     6     8    10


      13   14
it seems bigger now because it's only a cube, but when you get into more complex models (Brawl Pikachu), it's actually quite small as you're not writing duplicate data.
overall though it really doesn't matter much, but I still hate it for being inefficient :P

EDIT3:
HA HAHA
I guess this is why the good model formats are removed in Minetest-Irrlicht
B3D actually penalizes you by exponentially increasing the filesize for complex models, so the crude joke is to keep models small and cubular.
if that's the case then here's a friendly MS Sam: Thanks I hate it... if so :D

EDIT4:
yep, I was right, B3D is a horrible format -_-*
just tried testing my DarkPikachu model edit from my Minecraft-CustomSteve works...

for just the 3 meshes I exported, the B3D is a preposterous 4.5 MiB (4709497 B)
vs the original (minor TEV edit, extra ~100 bytes) 5 mesh BRMDL/MDL0 at only 170.2 KiB (174276 B)
or heck, how bout the entire FitPikachu00.PAC archive at only 1.1 MiB (1205152 B)

TFW "exponential" is more than just an exaggeration -_-*

and no, my addon doesn't work yet, this is the original addon, nothing is fudged

but tbh, I'm kinda making a big deal over nothing as the engine is probably proper and optimizes things to take much less VRAM than ~4MiB for a single model of ~4000 polygons...
at least I hope so anyways >_>

EDIT5:
just for those of you who may have noticed the vertex math had changed and were wondering what's up...
typically most traditional formats will have some sort of weight index within the vertex
but as I started actually going through the code I realized the weight code there only builds the vertex_groups array and doesn't actually write to the file

instead what B3D does is store the groups within the bones, which is still perfectly valid, just not done as often.
for example, Collada DAE is another format that does this ;)

so yeah, just correcting a mistake is all :)

the typical approach though is to do it from the vertices as modern OpenGL uses vertex arrays for up to 4 weight indices/values per vertex-entry ;)
although legacy OpenGL might still benefit a little from bone weights (don't do this, nobody games on Pentium III CPUs anymore, not even me)

cronvel
Member
Posts: 41
Joined: Fri Jan 11, 2019 16:50
GitHub: cronvel

Re: How to use b3d in blender?

by cronvel » Post

As of 2020 and Blender 2.8x, what is the working B3D exporter for Minetest?

I've tried those listed on the Minetest wiki with skinsdb's mod character model, but as soon as I modify the geometry, the exporter crashes with the iconic Python running gag (a Python stacktrace with no hint or explanation... I wonder if a Python coder that catch exception exists at all).

Also the official Minetest B3D exporter found on Github doesn't work on Blender 2.8x.

User avatar
Tcll
Member
Posts: 70
Joined: Thu Jul 25, 2019 21:43
GitHub: Tcll
IRC: Tcll Tcll5850 DarkPikachu
In-game: Tcll
Location: The Gates of Darkness.

Re: How to use b3d in blender?

by Tcll » Post

sorry about my lack of activity, I've been dealing with life issues over these past few months and haven't been able to work on much...

as of current, my exporter still is not yet functional (been improving the code and broke stuff in the process)

I still use the original 2.79 script above and that exports fine enough for basic use, but I do intend to finish my exporter whenever life decides to throw me a bone and give me some free time. ;)

I'd offer to help in finding the exception, but unfortunately I can't run 2.8 on any of my machines as nothing's powerful enough...
(I could on my primary if blender included whatever lib my system broke that causes 2.8 to run at 0.5 FPS)
^ or if I can manage to actually set up secure network namespaces and intrusion prevention on my linux-router to allow me to upgrade my primary's kernel and patch the broken lib.

cronvel
Member
Posts: 41
Joined: Fri Jan 11, 2019 16:50
GitHub: cronvel

Re: How to use b3d in blender?

by cronvel » Post

Damn, so we are tied with a file format without anything but deprecated exporter? :/

User avatar
Nathan.S
Member
Posts: 1034
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21
Location: Bigsby Texas
Contact:

Re: How to use b3d in blender?

by Nathan.S » Post

Last I used it this worked perfectly fine with Blender 2.8.
https://github.com/GreenXenith/io_scene_b3d
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course

cronvel
Member
Posts: 41
Joined: Fri Jan 11, 2019 16:50
GitHub: cronvel

Re: How to use b3d in blender?

by cronvel » Post

I found out that you have to unselect everything before exporting to avoid the Python stack trace.

Like: leave Modeling workspace, go to the Shader workspace, click out of the model, then export.

But still, it's extremely bugged. Sometime I lost all animations (in Minetest) for no reason at all...

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest