Blitzmax OpenB3D Roapmap

Started by markcwm, June 23, 2017, 23:43:28

Previous topic - Next topic

GW

I think you'll need to use a Delegate

angros47

Those commands need a callback function.

This should be a tutorial on how to call them: http://andyrushton.co.uk/csharp-calling-c-functions-csharp-callbacks/

markcwm

#17
Hello,

Last time I posted I had Assimp 3.2 with 64-bit and streams, but if anyone builds with TDM GCC 5.1 they'll find 3DS files won't load but all other models are fine, so I decided rather than expect users to upgrade to at least GCC 5.4 I should provide native model loaders. This decision was also because I couldn't incorporate Spinduluz's zipstream C++ code as it needed too modern C++ features. So I've got pretty solid native 3DS and B3D loaders but animation doesn't work as I have to figure that out yet! I'll also add an MD2 loader but not X because there isn't a binary loader for it and 3DS has hierarchy animation, B3D has boned animation and MD2 has vertex morphing which covers all 3 animation types. When I get these 3 formats with animation done that covers what Spinduluz did so I'll probably update the library after that. I also "nominated" a new b3d texture flag bit (4096) for streams and updated LoadTexture to support it.

@Angros, I have added Spinduluz's DDS support to the library, I suggest you add this as it's good for anyone porting code from a DX engine. The native 3DS loader is from Warner although I had to fix some issues, I suggest you port it as it can pretransform vertices and loads meshes instead of surfaces. I'm not sure if Openb3d supports hierarchy animation but I think it does, have you any X test models to share as the examples I tried just crashed (try mak_robotic.x - xof 0302txt 0064)! Another question, in the B3D model.cpp code you have a commented bit at 317 that says "***todo*** - load tex after setting values" and I wonder do we need to do anything here, it seems not to be necessary? Thanks.

angros47

#18
If with hierarchy animation you mean an animation involving child entities being moved and rotated, forming a complex structure, this is possible by attaching them to the bones of a bone animation.

The "todo" section is still there since the original work by Simon Harris, I never had any reason to modify it, since the loader seems to work correctly in its current form. It can be removed.

As I stated in the past, adding support for more formats in OpenB3D is something I would prefer to avoid, since it would increase the size and the complexity (and the amount of bugs), without providing a real advantage to the final result (the same result could be achieved by converting the texture to .png or any other supported format).

By the way, I have already decided to created a new library, that I am going to call "OpenB3d Plus", and I am working on it: I came to such a decision because I see that any further improvement to OpenB3D would likely be incompatible with some systems that are currently supported. As you might have noticed, I always tried to add features that could work on every system, even on old systems that relied on fixed function pipeline: CSG, geosphere rendering, marching cubes, particle system. Actually, OpenB3D could work even if VBOs are not supported. Once I compiled a version that required VBO to be enabled, I immediately received a compliant from someone, that the new version didn't work on his system. But at the point OpenB3D is, to add new features I would have to rely mostly on the programmable pipeline, and this would mean leaving some users behind. To avoid that situation, the best solution is to put the new features in a different library, and keeping OpenB3D in its current form.
This doesn't mean OpenB3D won't be updated. Currently, I am adding support for geometry shaders (I forgot to do it in the past), and fixing some bugs. But the new features that I am going to add will likely be in the upcoming new library, not into the core OpenB3D.

The new library is not going to replace OpenB3D, but to complete it; it will be like the GLUT library for OpenGL. It will provide some pre-made shaders for special rendering (bump mapping, interior mapping, fur rendering, glass rendering), perhaps some pre-made post processors (to do), video saving in mpeg format, and 360° video rendering (here is an example: https://www.youtube.com/watch?v=yBZevbHlbKU).

RonTek

Hey angros47, are there any standalone examples besides the demos in the BlitzMax wrapper?

I tried to download the Emscripten build, but only see a Emscripten type of file/library. I have read on the archive forum that you also have Android builds, so how do you test these builds?

angros47

I don't have Android builds, I just stated that they can be done (since WebGL used by in Emscripten is a superset of GLES on Android): at the moment I haven't published Emscripten examples, yet

RonTek

Quote from: angros47 on September 25, 2017, 08:21:28
I don't have Android builds, I just stated that they can be done (since WebGL used by in Emscripten is a superset of GLES on Android): at the moment I haven't published Emscripten examples, yet

Ok got it, thanks.

markcwm

Hello Angros,

well your plan for Openb3d Plus sounds good, I always liked that Openb3d was designed to work on older hardware ie. GL 2.0+. I know GL 2.0/GLSL 1.10 is mostly unusable when it comes to shaders but I'm more interested in having solid basic features than latest tech. I see geometry shaders are a GL 3.2 feature so will these go into Openb3d Plus? Will the new premade shaders be for Openb3d Plus? I like the sound of video rendering/saving, mpeg is a good format.

Thanks for the tip on hierarchy animation, yes I meant child entities rotated. The todo comment is not made by Simon but I see now you just set these extra values (blend, etc) after LoadTexture and he before. I'm surprised you don't want to add it as DDS is a very common texture format, it supports compression, mipmaps and cubemaps and the code by Spinduluz appears to work perfectly. It appears you removed support for mipmaps in Openb3d and I wonder why.


angros47

#23
Mipmapped textures are supported in OpenB3D. If you look at LoadAnimTexture, a mipmap is created automatically (either using GLUT, or native functions). I don't understand why you say that I removed support for them. Currently, textures are all loaded by the same loader; to keep the structure simple, a second loader can be used, but I would rather to have it in a separate library. If you are going to wrap the second library, as well, for you the fact that the loader is in the second library would not make any difference.

About geometry shaders: actually, they are created using glCreateShader, that is available on GL 2.0, and is used to create vertex and fragment shaders; it has just a different parameter passed, to create geometry shader. So, it is a small change that does not break compatibility, as long as a compatible shader is loaded. Loading a geometry shader will fail on a system with a lower version of OpenGl (but currently, this operation is not possible anyway, so it is not an issue). Instead, the new premade shaders will be for OpenB3D plus; I needed geometry shaders to be able to create a simple fur shader.

markcwm

Yes I saw gluBuild2DMipmaps in LoadAnimTexture but didn't look it up, Minib3d uses glTexImage2D in a mip_level loop and TTexture has a no_mipmaps field not found in Openb3d so I assumed you had changed it to a single mipmap level. Actually I need to add mipmap support to my BMX LoadTexture function as I use pixmaps when there is a progressive jpg. Thanks for clarifying that.

RonTek

Some basic feature suggestions guys, if I might add..


Texture shadows
Full exact command list with Blitz3D
Optimized collisions
Built-in or plugin physics
Proper normal mapping with directional lighting
More post process and material shader examples


OpenB3D is really close with Blitz3D and easy to use. Keep it up! :)


angros47

QuoteTexture shadows
I might add them, but they would be an alternative, not a replacement for current stencil shadows: in fact, shadow mapping requires a dedicated shader on all the objects receiving the shadow; and since shaders cannot be stacked on the same mesh, this would prevent the usage of any other material on the objects that are supposed to receive the shadow. Stencil shadows don't have this limit... on the other hand, texture shadows are more detailed (for example, a tree can cast a shadow where each leaf can have its own shadow, this is not possible with stencil method). Basically, every shadow technique has advantages and disadvantages.

QuoteFull exact command list with Blitz3D
This is not possible, of course: Blitz3D has many other commands, like the 2D commands, for example, and adding them would require its own library (that would be redundant, since BlitzMax has its own 2d command set). Also, there is a small, but important difference with Blitz3D that will require to modify your software anyway: for rotations, pitch works in reverse, RotateEntity x, 90,0,0 is equivalent to RotateEntity x, -90,0,0 when switching from Blitz3D to OpenB3D: by changing it, all the code already written for OpenB3D would be broken. Also CameraPick works in reverse, row number 0 is at bottom (OpenGL works in that way)
Currently, most features from Blitz3D are supported; unsupported features are animations in .x and .3ds files (but most animated files in Blitz3D were in .B3D format, also 3ds and x models can easily be converted to .B3D), BSP models (very specific, seldom used), and tweening in RenderWorld (I never saw anyone using it in Blitz3D anyway)
Other features, like SetBuffer, are less useful without the 2d library (TextureBuffer, for example, is useful only to use 2d commands on a texture; anyway, if you have a 2d library that can draw on buffers you can use BufferToTex). Also, the solution used to render on texture in Blitz3D (rendering in background, and copying it to textures) is not possible anymore, but is useless, since OpenB3D supports direct rendering to textures with CameraToTex.

Also, since Blitz3D is now available for free, and it's open source, anyone who needs a compatibility of 100% of the code can use it: if someone wants to use OpenB3D, it's to use its more advanced features (shaders, shadows, multiplatform, possibility to use it in different languages); and that would require to modify the code anyway.

QuoteOptimized collisions
Several types of collisions are available. If the collision is against meshes organized in an octree, some optimizations are performed , so only some of the meshes are evaluated. If meshes are not managed in that way, not many automatic optimizations are possible

QuoteBuilt-in or plugin physics
OpenB3D supports built in actions (including Newtonian movements), dynamic collisions, constraints (through Verlet integration), and rigid bodies. So, a quick and simple customized physic engine can be implemented easily. Adding support for external third part libraries would create extra dependencies, with issues due to licensing, and versions, and this is against the design goal I have for OpenB3D.

QuoteProper normal mapping with directional lighting
It can't be easily done with fixed function pipeline, it requires a dedicated shader, so it will be in the Plus add on

QuoteMore post process and material shader examples
Already working on it


ms62

The material of the directx model that I load with Blitz3D is the same as the original in the 3d modeler, but when I load the model with openb3d, it is not. In openb3d, its material is all over the place. Also, in openb3d, loading time is a lot more for models with higher poly.

It is good for openb3d to have an obj loader as this format is supported for all modelers and is great  for moving the model from one app to another.

openb3d b3d loader is good, but which modeler exports to b3d?

Does the md2 loader works? I don't get any error, but I don't see the model.


markcwm

#28
The X loader in Openb3d is incomplete, it's from the BB code archives so is limited to text 0302 and no animation. There are no plans to improve it.

To load OBJ you can use the Assimp library module which supports lots of formats (including X) but no animation yet. Note that 3DS files don't work with MinGW GCC 5.1.

The B3D loader is from Minib3d source, there are lots of B3D exporters mostly plugins for modellers like Blender, Ultimate Unwrap, Milkshape.

The MD2 loader should work fine it's from Minib3d Extended, I haven't really tested it much but it supports vertex interpolation, see the examples/standard folder. It may be you can't see it because the camera's inside it, try ScaleEntity to shrink it down.

The wrapper also has native 3DS and B3D loaders (MD2 is todo and there's no animation yet). This is so streams can be used.

ms62

I forgot that I have Ultimate Unwrap. I will use it for b3d. AC3D exports to md2 also, I have that option. I use one of those two. I don't need animation, the only animation for my spaceship will be its body part which I think I can do by using seperate meshes and rotation. In case of the md2 model, I thought it might be the scale, I will shrink the object more. The good think about x and Blitz3D is that x with only material looks good, and in the early stage of coding you don't need more than that. Thanks, I think I know which way to go.

I forgot to say, I used the NG version of openb3d. I think using NG and its related modules and wrappers is the only way to keep hope that BlitzMax will continue.