SyntaxBomb - Indie Coders

Languages & Coding => BlitzMax / BlitzMax NG => MiniB3D => Topic started by: Kippykip on July 10, 2018, 15:40:06

Title: What happened to the 3DS loader in OpenB3D?
Post by: Kippykip on July 10, 2018, 15:40:06
I haven't updated my OpenB3D module in a while, so I updated it today however now in my project, the 3DS models no longer load correctly.
I use the 3DS filetype in my project as it's easy to make maps for it in Sketchup, It's missing collisions and has the wrong textures, and isn't rotated correctly. (Also it looks like I can't parent/use hideentity and stuff on it either)

Here's what Google Sketchup 3DS models look on the latest OpenB3D (I used HideEntity on the collision and visual model too for this test!):
(https://i.imgur.com/0x09etL.png)

Here's how 3DS models looked on the old version (excuse the image resolution, I took that screenshot in fullscreen a while back):
(https://i.imgur.com/fZlVAlW.png)

Anyone know what happened? Is there a new function I need to use for 3DS models?
EDIT: I should note the previous version of OpenB3D I was using used files dated back to 13/02/2018 (DD-MM-YYYY)
Title: Re: What happened to the 3DS loader in OpenB3D?
Post by: Kippykip on July 10, 2018, 18:00:35
Yep, there's now options to load stuff via the library etc.
You just have to add a:
MeshLoader("library")

Before you load any meshes.
I had to dig through the code and commits to find this mention

Rem
bbdoc: Set mesh loaders to use (default is streamed)
about: Set meshid to "bb" or "bmx" for Blitzmax streamed meshes, use "cpp", "lib" or "open" for
Openb3d library meshes (only loads local files).
End Rem
Function MeshLoader( meshid:String )
Select meshid.ToLower()
Case "bb", "bmx", "bmax", "max", "blitzmax"
TGlobal.Mesh_Loader=1
Case "cpp", "c++", "lib", "library", "open", "openb3d"
TGlobal.Mesh_Loader=2
EndSelect
End Function
Title: Re: What happened to the 3DS loader in OpenB3D?
Post by: markcwm on July 11, 2018, 23:55:12
Hi Kippy,

yes I've worked on the Bmx 3ds loader and made some improvements, I added the B3D command LoaderMatrix to reorient models, the default for 3ds is the y/z axis swapped, which results in a 90d rotation, if you use: LoaderMatrix "3ds", 1,0,0, 0,1,0, 0,0,-1 it should orient correctly, I never tested any levels just some models with multiple meshes so never noticed this, anyway good the library loader works.

Another thing I did to the Bmx loader was reverse face winding order, so textures aren't back-to-front.
Title: Re: What happened to the 3DS loader in OpenB3D?
Post by: Kippykip on July 12, 2018, 03:02:52
Yeah I see you've been busy! :D
I especially love how alpha textures are drawn properly now! As in older versions, objects with alpha textures would appear behind where it should appear in front ect.
The collisions seem to work properly too now!
This is awesome! Here's a window man test I made!
(https://i.imgur.com/auOxOwa.png)

There were some new minor oddities I noticed though such as a scythe weapon model I use in my project that used to required the masked flag no longer needs the flag, however when there's a sprite in camera view, it draws the scythe with black instead of transparent like the old way.
It can be easily fixed by giving every single texture the alpha flag anyways, but if I did that on the old OpenB3D the entire map would be drawn wrong. Now everything looks perfect! :-*

Although I also noticed fully black bits (0,0,0) on textures as they're loaded from the 3DS library loader seems to draw the black pixels as transparent, so I just edited the PNG files so the black pixels have (0,0,1) instead and that sorted it.
Here's what it looked like though:
(https://i.imgur.com/wjKm0S1.png)
Title: Re: What happened to the 3DS loader in OpenB3D?
Post by: peteswansen on July 12, 2018, 18:20:48
interesting images.... are you scaling the textures to fit the model? What pixel size are the texture images?
Title: Re: What happened to the 3DS loader in OpenB3D?
Post by: Kippykip on July 12, 2018, 18:40:46
Quote from: peteswansen on July 12, 2018, 18:20:48
interesting images.... are you scaling the textures to fit the model? What pixel size are the texture images?
All the map textures are 64x64 or 64x128 as they're just ripped from Doom ;). I try to keep all my texture sizes on models and stuff by ^8 and then UV map it later on.