November 21, 2018, 04:59:08 PM

Author Topic: What happened to the 3DS loader in OpenB3D?  (Read 413 times)

Offline Kippykip

  • Jr. Member
  • **
  • Posts: 73
    • Kippykip Forums!
What happened to the 3DS loader in OpenB3D?
« on: July 10, 2018, 03:40:06 PM »
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!):


Here's how 3DS models looked on the old version (excuse the image resolution, I took that screenshot in fullscreen a while back):


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)

Offline Kippykip

  • Jr. Member
  • **
  • Posts: 73
    • Kippykip Forums!
Re: What happened to the 3DS loader in OpenB3D?
« Reply #1 on: July 10, 2018, 06:00:35 PM »
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

Code: [Select]
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

Offline markcwm

  • Sr. Member
  • ****
  • Posts: 298
Re: What happened to the 3DS loader in OpenB3D?
« Reply #2 on: July 11, 2018, 11:55:12 PM »
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.

Offline Kippykip

  • Jr. Member
  • **
  • Posts: 73
    • Kippykip Forums!
Re: What happened to the 3DS loader in OpenB3D?
« Reply #3 on: July 12, 2018, 03:02:52 AM »
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!


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:

Offline peteswansen

  • Jr. Member
  • **
  • Posts: 43
Re: What happened to the 3DS loader in OpenB3D?
« Reply #4 on: July 12, 2018, 06:20:48 PM »
interesting images.... are you scaling the textures to fit the model? What pixel size are the texture images?

Offline Kippykip

  • Jr. Member
  • **
  • Posts: 73
    • Kippykip Forums!
Re: What happened to the 3DS loader in OpenB3D?
« Reply #5 on: July 12, 2018, 06:40:46 PM »
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.