Using Obj2Blb With Wine

Author Topic: Using Obj2Blb With Wine  (Read 4212 times)

Is it possible to use Badspot or General's Obj2Blb converter with Wine?

I don't see why not. I didn't have an obj file to test on but the exe executes initially just fine with wine.

rexana@tiny:~/Downloads$ wine blbConverter.exe
argv[0] = Z:\home\rexana\Downloads\blbConverter.exe
usage: dxf2blb.exe [input file]
rexana@tiny:~/Downloads$

I installed Wine and I have Wine Stable in my applications but it says the command doesn't exist in Terminal. Also when I try to open blbConverter.exe with Wine, it shows that the application opens, but then it doesn't do anything and it just closes if you click anywhere.

Did you install wine ftom your distro's default repository? If so I'd just uninstall it and follow the install instructions for your distro on https://winehq.org

Okay, I got that working. So how do I get the blb converter to actually convert a file?
Code: [Select]
cd Desktop
wine blbConverter.exe
dxf2blb.exe Desktop/Old Stuff/Jes00 Models/Models/Woodplanks.obj
?

EDIT: Got it to turn the object file into a blb but the collision didn't work and it made the brick way smaller than the model.

Anyone mind trying it not through Wine to see if it's my model or Wine that's the problem?

DOUBLE EDIT: It looks like General's Obj2Blb doesn't work with Wine.

TRIPLE EDIT: General's converter does work, I just can't see the documentation. If someone would be kind enough to screenshot it or something, that'd be great.

QUAD EDIT: General's converter works better than Badspot's. It's still way smaller than the model for some reason, but the collision works right now. I still don't really know how General's works because I can't see the documentation.
« Last Edit: July 21, 2019, 03:44:04 PM by jes00 »

Also, how do I know how wide to make my model?
« Last Edit: July 21, 2019, 07:09:48 PM by jes00 »

Okay, I've got most it figured out. I would appreciate some screenshots or something of General's Obj2Blb documentation though.

Also, how do I know how wide to make my model?
In blender I usually make a bounds box first to get the general size of what my model needs to be, the blockland units to scale in blender are x0.5 y0.5 z0.6 for a typical 1x1 brick, x0.5 y0.5 z0.2 for a 1x1 plate brick. Basically just multiply the numbers by how big you want your brick to be, like if I wanted a 4x4 cube I'd do x2 y2 z2.

Okay, I've got most it figured out. I would appreciate some screenshots or something of General's Obj2Blb documentation though.
Code: [Select]
Obj2Blb Converter
V4.0.0.2
By General (Blockland ID: 4878)



Documentation
Written by Tophius (Blockland ID: 3200) and General (Blockland ID: 4878)

Preface
This converter was tested alongside .obj files exported by Blender 249, and as such, this documentation was written with that program in mind. If you are using a different modelling program, be aware that some of this information might not translate correctly.

Using the converter
Usage of the converter is very easy. Simply drag your .obj file into the .exe, wait for the program to run, and the resulting .blb file should be created within the converter's working directory.

Modifications
The converter supports installation of mods for customization. To install a mod, simply create a folder in the same directory as the executable and name it "Obj2Blb Mods", then drag any scripts (".gml" files) or other necessary content related to the mod into the folder. Likewise, to uninstall a mod, just remove the scripts from the folder.
Note: Scripts will not be executed if inside a directory in the folder or do not have the extension ".gml".
If you need further help on installing mods, or wish to see application source code to create a mod, send General an e-mail at "gensoft@hotmail.co.uk".

Brick size
Automatically, the converter generates a bounding box for the brick based on the location of the furthest vertex from the centre in order cover all the quads. You can however override this default assignment by creating a box of a certain size and grouping it as “BOUNDS”, the converter will then use the size of this shape to set the bounds for the brick. The centre of the bounding box must be at point (0,0,0) on the axis in the modelling program otherwise the size of the bounds will be treated as the length from point (0,0,0) to the furtherst vertex from the centre multiplied by two.
That being said it is also worth noting that you are able to place just a single vertex or a plane a distance from the centre of the brick and group it as “BOUNDS”, the converter will create a box based on the distance of this vertex.

Collision
Like for the bounding box, if you do not define a custom collision box for the brick then the converter will automatically create a collision box the size of the brick's bounding box. To create collision boxes for the brick, all you have to do is add single or multiple boxes and group them each individually as “COL”, “COL2” etc. The shape will be treated as collision no matter the group name as long as the phrase “COL” exists in the name.
It is important to know that if you wish to create multiple collision boxes you cannot include each box as part of the same group; this is because the converter will treat them as one big box. You therefore have to give each box a unique name.

Placement grid
The converter automatically generates a placement grid for the brick upon conversion. However, since the converter cannot accurately produce a placement grid without being manually fed information, the automatically generated grid is only truly useful if the brick were a cuboid.
Likewise, the converter allows you to create a placement grid for the brick within your modelling program. All you have to do is create a box and group it “GRIDU” / “GRIDB”/ “GRIDD”/ “GRIDX” where GRIDU, GRIDB, GRIDD and GRIDX indicate that a brick can be place above, above and below, below or cannot be placed respectively. Any areas not covered by a grid box will be treated as an empty area (“-“). You are able to add more than one grid box if you please.
You must be sure NOT to join two or more boxes as part of the same group as this will lead the converter to believe that both boxes are one large box. If you need to group a box that has the same name as another group, you can add characters before or after “GRID(U/B/D/X)” in the name. For example “GRIDU2” etc.
Note: Due to the nature of the manual grid generating system, applying too many grid boxes on a brick with very large bounds can result in over a minute of grid writing time. If converter takes long to generate and the application is labelled as non-responsive, please wait patiently as it has not crashed.

Coverage
Although the converter does handle aspects of these sections of the .blb file well enough that it should function in-game, they are not optimal. Some manual labour will be required in order to refine the brick to an acceptable quality. For reference, this aspect is dependent on the “bounding box” of your model, so anything created by the converter would only truly be completely useful if your brick were a simple cuboid.
It is also worth mentioning that if one quad should cover an entire side of the bounding box, that then the respective side will be set to cover adjacent faces within the coverage section.

Quad sorting
You are able to manually define to which quad group faces in your model belong to within your modelling program. All you have to do is group chosen faces in your model as “Q L” where “L” is either T, B, N, E, S, W or O standing for Top, Bottom, North, East, South, West and Omni respectively. When converting, these faces will be sorted as the groups you have stated.
If you do not state a group, quads will automatically be grouped by the converter based on information from both the “bounding box” as well as the faces themselves. Faces close to the side edges of the bounding box will automatically be sorted as either: north, east, south or west, depending on what side they are close to. Faces assigned with a “TOP” texture will be automatically sorted as a top quad regardless of its position and faces with a “BOTTOMLOOP” or “BOTTOMEDGE” texture as a bottom quad respectively. Faces left over will be sorted as omni quads.
Note: If you wish to sort quads on a group also using colour, you can place the quad sorting command before or after the colour command in the group.

Textures
Textures within the .blb file are defined by the material assigned to the respective face in Blender. Recognized material names include: TOP, BOTTOMLOOP, BOTTOMEDGE, RAMP, SIDE and PRINT. If the face is not assigned a material or if the material name is not one of the above, the face is automatically applied the “SIDE” texture.

Vertex position
The vertex position is copied exactly as it appears in Blender / the .obj file, with the exception that the z axis is scaled by the converter in order to fit Blockland's own scale. As a tip, a 1x1 brick is exactly the same size as the default Blender cubed scaled down by a factor of 0.5, and then scaled on the z axis by 1.2.
Note: scaling faces by a negative value in order to mirror them causes the vertex order to flip as well, thus appearing inversed in-game. To remedy this: press “Ctrl-A”, and choose “Scale and Rotation to ObData”.

UV Coordinates
UV Coordinates are borrowed directly from the UV data in the .obj file, which in turn is affected by what you do in the “UV/Image Editor”. It is recommended that you use the default brick textures edited to appear as a solid colour rather than with transparency, as it is easier to work with.
TOP textures must be UV mapped in a specific way in order to appear properly in-game (so that they remain facing the same direction). To do this, ensure that the darkest side of the top texture faces up along the y-axis (green), while the second darkest side faces down along the x-axis (red), in the opposite direction to the axis arrow. It is also important that you do not perform any scale operations within the UV Editor while mapping the top textures.
Note: The image you use in the UV Editor to map to your face does not affect the texture as it appeas in-game.
This program comes with a series of edited brick textures to help in UV mapping. To export these textures, simply press the “E” button before closing this window.

Normals
Again, normals appear in-game exactly as they are defined within the .obj. It is important to note that in Blender, in order to achieve a partial smooth-shade effect, that you make use of the “edgesplit” modifiers just as you would if you were to export a model for use in-game as a .dts. It is not necessary to apply the modifier before export as Blender's .obj exporter allows you to choose to do that during the export process.

Colours
Bricks converted with the program can currently only be coloured on a per-face basis, meaning that having different-coloured vertices on one face is not currently possible. Face colours are defined by named groups within the .obj file. The name of the group must be “C R G B A” where R/G/B/A are values between -1 and 1. It is important to note that if you do not have enough space in the group name for setting a colour, values of "0.#" where # is a number can be written as ".#", this optimises space.
For more information on how to export .obj groups in Blender, please look at the “Blender .obj exporter” section.
Note: If you wish to set colour on a group also using quad sorting, you can place the colour command before or after the quad sorting command in the group.

Blender .obj exporter
When attempting to export your Blender model as an .obj, you are presented with a GUI and multiple export options to choose from. The “Context” row simply decides what part of your model should be exported. You can use “Selection only” to export only specific parts of your model, or you may choose “All Scenes” to export everything. “Animation” is not needed.
In “Output Options”, be sure to disable “Rotate X90” or your brick will appear sideways. Also, you may wish to apply any modifiers you may have for export with “Apply Modifiers”. Ignore “Copy Images”.
Be sure that “Materials”, ”UVs”, “Normals” and “HQ” are all enabled before export. You should leave “Edges” and “Triangulate” disabled.
For grouping, you may either choose “Polygroups”, “Objects” or “Groups”. “Polygroups” relies on the vertex groups assigned within Blender, while the other two rely on the Blender objects themselves, and are each handled similarly by the converter.
“Keep Vert Order” has no effect on the result of the .blb brick upon conversion.

Thank you. It works pretty good now.

« Last Edit: July 22, 2019, 09:41:19 AM by jes00 »

Looks good! And no problem, happy to help.

I'm getting an error with this object and I'm not sure why.
Code: [Select]
******-MacBook-Pro:~ ******$ cd Desktop
******-MacBook-Pro:Desktop ******$ wine Obj2Blb.exe MysteryBox.obj
/BuildRoot/Library/Caches/com.apple.xbs/Sources/AppleFSCompression/AppleFSCompression-96.200.3/Common/ChunkCompression.cpp:49: Error: unsupported compressor 8
/BuildRoot/Library/Caches/com.apple.xbs/Sources/AppleFSCompression/AppleFSCompression-96.200.3/Libraries/CompressData/CompressData.c:353: Error: Unknown compression scheme encountered for file '/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/Exceptions.plist'
/BuildRoot/Library/Caches/com.apple.xbs/Sources/AppleFSCompression/AppleFSCompression-96.200.3/Common/ChunkCompression.cpp:49: Error: unsupported compressor 8
/BuildRoot/Library/Caches/com.apple.xbs/Sources/AppleFSCompression/AppleFSCompression-96.200.3/Libraries/CompressData/CompressData.c:353: Error: Unknown compression scheme encountered for file '/System/Library/CoreServices/CoreTypes.bundle/Contents/Library/AppExceptions.bundle/Exceptions.plist'
/BuildRoot/Library/Caches/com.apple.xbs/Sources/AppleFSCompression/AppleFSCompression-96.200.3/Common/ChunkCompression.cpp:49: Error: unsupported compressor 8
/BuildRoot/Library/Caches/com.apple.xbs/Sources/AppleFSCompression/AppleFSCompression-96.200.3/Libraries/CompressData/CompressData.c:353: Error: Unknown compression scheme encountered for file '/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/Exceptions.plist'
/BuildRoot/Library/Caches/com.apple.xbs/Sources/AppleFSCompression/AppleFSCompression-96.200.3/Common/ChunkCompression.cpp:49: Error: unsupported compressor 8
/BuildRoot/Library/Caches/com.apple.xbs/Sources/AppleFSCompression/AppleFSCompression-96.200.3/Libraries/CompressData/CompressData.c:353: Error: Unknown compression scheme encountered for file '/System/Library/CoreServices/CoreTypes.bundle/Contents/Library/AppExceptions.bundle/Exceptions.plist'
/BuildRoot/Library/Caches/com.apple.xbs/Sources/AppleFSCompression/AppleFSCompression-96.200.3/Common/ChunkCompression.cpp:49: Error: unsupported compressor 8
/BuildRoot/Library/Caches/com.apple.xbs/Sources/AppleFSCompression/AppleFSCompression-96.200.3/Libraries/CompressData/CompressData.c:353: Error: Unknown compression scheme encountered for file '/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/Exceptions.plist'
/BuildRoot/Library/Caches/com.apple.xbs/Sources/AppleFSCompression/AppleFSCompression-96.200.3/Common/ChunkCompression.cpp:49: Error: unsupported compressor 8
/BuildRoot/Library/Caches/com.apple.xbs/Sources/AppleFSCompression/AppleFSCompression-96.200.3/Libraries/CompressData/CompressData.c:353: Error: Unknown compression scheme encountered for file '/System/Library/CoreServices/CoreTypes.bundle/Contents/Library/AppExceptions.bundle/Exceptions.plist'
0009:fixme:thread:GetThreadUILanguage : stub, returning default language.
0009:fixme:nls:GetThreadPreferredUILanguages 00000038, 0x32d784, 0x0 0x32d7ac
0009:fixme:nls:get_dummy_preferred_ui_language (0x38 0x32d784 0x0 0x32d7ac) returning a dummy value (current locale)
0009:fixme:nls:GetThreadPreferredUILanguages 00000038, 0x32d784, 0xbda680 0x32d7ac
0009:fixme:nls:get_dummy_preferred_ui_language (0x38 0x32d784 0xbda680 0x32d7ac) returning a dummy value (current locale)
0009:fixme:dwmapi:DwmEnableMMCSS (1) stub
0009:fixme:win:EnumDisplayDevicesW ((null),0,0x32f820,0x00000000), stub!
0024:fixme:appbar:handle_appbarmessage SHAppBarMessage(ABM_GETTASKBARPOS, hwnd=0x0): stub
0024:fixme:appbar:handle_appbarmessage SHAppBarMessage(ABM_GETTASKBARPOS, hwnd=0x0): stub
0009:fixme:winsock:set_dont_fragment IP_DONTFRAGMENT for IPv4 not supported in this platform
002a:fixme:d3d:state_linepattern_w Setting line patterns is not supported in OpenGL core contexts.
002a:fixme:d3d_shader:print_glsl_info_log Info log received from GLSL shader #5:
002a:fixme:d3d_shader:print_glsl_info_log     WARNING: Output of vertex shader 'ffp_varying_texcoord' not read by fragment shader
« Last Edit: July 22, 2019, 03:44:25 PM by jes00 »

Can you post the obj? or blend
« Last Edit: July 22, 2019, 03:44:33 PM by RallyBlock »

Can you post the obj?
It works if I triangulate faces, even though the documentation says not to. I'm assuming I have some faces that the converter can't handle or something?

Most likely, each face can only have 4 verts(corners/edges) or less
« Last Edit: July 22, 2019, 04:00:51 PM by RallyBlock »

How do you group a single face? It seems to me like you can only put objects in groups. Should I just make what I want it's own object and then put that in a group?
« Last Edit: July 22, 2019, 05:48:42 PM by jes00 »