3D engine download

BlitzMax Forums/OpenGL Module/3D engine download

Warner(Posted 2011) [#1]
An alpha version of my 3d engine is now on googlecode. If you want to try it: the download contains a module and some samples.

Download here:

-Uses Ints instead of Short for triangle indices
-Abstracted GL functions, makes it easier to port.
-ROAM Terrain
-Loads B3D files with up to 8 bones.
-You can manually add bones
-Manual animation functions (SetAnimKey/AddAnimSeq)

I wrote the engine for a specific project: a 3d editor.
For this editor, I need to use Picking as well. It is not included yet,
but I will work on that. Other functions (ie. 2d overlays) will be
included if I need them.
If you need something, you could try to make a request. I'll look into
it, but I cannot promise I'll get to it. It is a rather large project
and it's due september.
The project should be easy enough to expand though. You could look into
the minib3d source, it uses the same rendering techniques.
The engine was built to be backwards compatible down to openGL 1.1, maybe
even 1.0. It was also written with portability in mind. The openGL layer
is placed in a single module, with more or less abstract wrapper functions.
An earlier version, I ported to DX9, as a test. With a bit of patching,
that took me two days.
All code is free to use, with certain limitations, that are covered in
the readme.txt file.
')Hopefully it all works as it should, and you can find a good use for it as well.
I appreciate any feedback: especially on if and how it performs. And bugs reports offcourse.

Last edited show_time('2011-05-10 17:08:43')

jkrankie(Posted 2011) [#2]
Cool, i'll take a look!


kfprimm(Posted 2011) [#3]
Mmm, a ROAM implementation.

Mind if I integrate into my engine?

Warner(Posted 2011) [#4]
I won't mind, but it is not my code. It was written by Mark Duchaineau. The code is under MIT license. You can find the download here:
That links comes from this page:
Besides the download, it offers a lot of information.

outsider(Posted 2011) [#5]
@kfprimm: I'm trying your engine, but I have: Compile Error: Can't find interface for module 'sys87.newton'

What is that sys87.newton?

Warner(Posted 2011) [#6]
Let's not use my thread to discuss that.

outsider(Posted 2011) [#7]

AdamRedwoods(Posted 2011) [#8]
Clean code, very nice. Quite expandable.

A couple random thoughts:

I didn't see alpha sorting, do you not need it for this or did you find that it was not needed? Or maybe you're doing it during a position/alpha state change.

I remember you discussing some performance problems, were you able to figure those out? I am curious because I wonder about BlitzMax's speed when calling other type methods, and you are calling quite a few in a loop during surface renders. Just curious as to how well Bmax optimizes those things compared to inlining code-- it may be negligible, I don't know.

Very nice job.

Last edited show_time('2011-04-26 18:23:37')

kfprimm(Posted 2011) [#9]
outsider, check your email.

Warner(Posted 2011) [#10]
After that thread, I ported the engine to DX9. That really increased the speed on my computer. So, I've decided to accept the speed issues as being specific to my videocard. It just seems to emulate openGL. For instance, the most rendering time was consumed by glClear. The same program than runs about 50-60 fps in openGL, runs on 90-100 fps in DX9. Any testruns I've done on other PC's were much faster.

The most optimisation I did when I wrote the math functions. I've eliminated the Matrix, Quaternion and Vector Types, and replaced them with Float arrays. I've also tried to avoid calling a function that calls a function. So if two matrices are multiplied in another Math function, I inlined the multiplication.

As far as using Type Methods, I think TEntity, TCamera and TMesh etc. should be Types. I'm convinced that there is a bit overhead for using them, but the advantages outweight the losses.

Thanks for your feedback, and for the alpha ordering suggestion. I haven't built in alpha blending, but I'll put it on my to-do list.

jkrankie(Posted 2011) [#11]
Will you be adding lights?


Warner(Posted 2011) [#12]
There is one directional light included. It is however disabled.
In Graphics->TOpenGL.bmx, search for "light disable". Two lines are commented out. If you uncomment them, a directional light should be there.
Next update, I'll include the lights from minib3d.

jkrankie(Posted 2011) [#13]
Cool, looking forward to it!


Warner(Posted 2011) [#14]
Updated v0.0.2 alpha, with lights and alphablending.

Warner(Posted 2011) [#15]
Updated v0.0.3 alpha, with CameraPick, picking for terrains

Difference(Posted 2011) [#16]
Looking very interesting!

I'm trying to compile, but get a compile error in

roamstep4d.c > line 66 #include <gl/gl.h>

"No such file or directory."

I'm on Mac, Snow Leopard, XCode Version 3.2.5, BlitzMax 1.42, GCC 4.2.1

Other openGl stuff compiles fine it seems.

jkrankie(Posted 2011) [#17]
It's #include<Opengl/gl.h> on Macs.


Difference(Posted 2011) [#18]
Thanks jkrankie, that did it. :-)

Everything looks good, except maybe

DebugLog:Error: could not find texture '../data/nskinbr.jpg'
DebugLog:Error: could not find texture '../data/nskingr.jpg'
DebugLog:Error: could not find texture '../data/nskinwh.jpg'
DebugLog:Error: could not find texture '../data/nskinrd.jpg'

on the mesh sample. (don't know if that's intentional)

Warner(Posted 2011) [#19]
Partly: the ninja model has other skins (brown/green/white/red versions). I didn't supply them with the examples. You could download them from the original site here: http://www.psionic3d.co.uk/?page_id=25
I will fix the Mac error in the next update. There is another issue concerning terrain frustum culling. The temp. fix is mentioned on the googlepage. I'm working on fixing it properly.

Warner(Posted 2011) [#20]
Updated to v.0.0.6 alpha. It includes an adaptation of the 'bird demo' and a .b3d version of the original blitz3d 'castle1.x' model.

*(Posted 2011) [#21]

Warner(Posted 2011) [#22]

Wip: spheremaps, texture scaling, support for PMK B3D files. Currently I'm trying to implement 3ds matrix support.

jkrankie(Posted 2011) [#23]
Wow, this is coming along nicely! Do you have any ideal list/set of features in mind?


Warner(Posted 2011) [#24]
Thanks! At this point, I'm trying to support loading both .b3d files and .3ds files as much as I can. After that, I don't have much of a plan. I would like to implement cubemaps, maybe sprites. Can't think of too much else. If you have suggestions, please tell me. Maybe I'm overlooking something very important? I'm mainly looking into minib3d and blitz3d for ideas.
I was going for a leightweight engine with support for openGL 1.0 and up, that is portable - in the sense that all openGL related commands are kept in a separate include file, so they could in theory be replaced with another library in the future, if needed.

Kryzon(Posted 2011) [#25]
Nice going with the screens =)
It's easier said then done, but... here are my suggestions:

- Support the B3D format fully; while MiniB3D only reads KEYS chunks for bones, it is imperative to have your loader read this chunk type for the other kind of nodes as well: meshes and pivots.
- MiniB3D doesn't support bone scaling, which can be a useful feature and is available to the B3D format anyway.
- Allow for infinite bones to be in a B3D file. In other words, not limiting the total to 8.
- Make a generic particle class that is single-surface.
- Incorporate a tried-and-true physics engine; something like Bullet, Newton, ODE, PhysX or Tokamak. Any of them comes with report-only collisions (for triggers and such), and lightning fast ray-casting.
- Include a shader framework supporting GLSL and\or cgFX as an optional, advanced module.

That's all I can think of for now. Best of luck with development.

Warner(Posted 2011) [#26]
Thanks for the suggestions. They seem fair enough, I'll see what I can do.
As for that first point: bone scaling is possible. The loader allready loads keychunks for any type of object (mesh/bone). Do you know a model that uses this or either bone scaling? I would like to be able to try it out.

The latter, GLSL shaders, could become a real problem, since my videocard does not support shaders. It would be difficult writing something and not being able to test it.

Last edited show_time('2011-05-14 03:23:46')

Kryzon(Posted 2011) [#27]
I don't know of any model that uses these, but I can sure make one: FeatureTest.B3D

Inside the scene you'll see:
- A box named "Big Box", with vertex colors and a vertex-colored brush. This mesh is animated (a noise animation, it'll appear to be shaking), to test the KEYS support for non-bone nodes.

- A dummy\pivot named "Animated Helper". It's the animated pivot, to also put to test the support of KEYS for non-bone nodes.

- A second box named "Small Box" that is parented to the "Animated Helper". If the dummy animates properly you should see this "Small Box" animating as well since it inherits the animation. This "Small Box" is brushed with a FullBright FX brush.

- A cylinder named "Skinned Mesh", which is a mesh skinned with 10 bones. This cylinder has a brush with ADD blending, and this cylinder has its top part without smoothing groups (so the top polygons should look a bit flat-shaded - perhaps the ADD blending makes this difficult to see).

- Another mesh named "Name" just for the sake of control.

I tested it with Blitz3D and all the features worked as mentioned.

Warner(Posted 2011) [#28]
That is very nice of you, thanks! I tested the model, and it seems to animate: The cube moves in a sine like curve and spins, as if being thrown across the model space, and the cylinder curls up, then resets.
Brush fx are not supported, so both shapes are white. Vertex colors are supported and show.
When I load the model in blitz3d (1.105), only the small cube moves, the cylinder is just static. Also: the "Big Box" doesn't seem to move. I could find no KEYS tag for it.

With lights enabled, it shows the smoothing group:

Last edited show_time('2011-05-14 18:37:22')

Kryzon(Posted 2011) [#29]
Oopsy... you're totally right. I added the animation to the "Big Box" but forgot to update the download file. Here it is: FeatureTest2.B3D

About the skinned mesh: in Blitz3D, skinned meshes need to be animated exclusively to work, as they possess an 'ANIM' chunk themselves.
This means doing this:
Animate Scene,3 ;Animate the scene-root, which animates all nodes until additional ANIM chunks are met in the hierarchy.
Animate FindChild(Scene,"Skinned Mesh"),3 ;Animate this skinned node and all nodes it parents.
')With this the cylinder should animate in Blitz3D.

and the cylinder curls up, then resets.

Perhaps this should be looked further. In Blitz3D, playing the cylinder with a "one-shot" animation (type 3) leaves the scene stopped at frame 100 (with the cylinder totally curled).
If your engine leaves the scene at frame 0.0 after the animation ends then you might be traversing one extra frame at the end, or at least resetting the current frame.

Last edited show_time('2011-05-14 19:21:34')

Kryzon(Posted 2011) [#30]
Okay, just did a weird tentacle thingy that slithers and scales by pure bone animation: BoneScale.B3D

Has a mesh named "Tentacle", with normals but no vertex-colors and no brushes.
Has 8 bones, and the root bone animates in the scale from 100% to 0.0% (making the tentacle shrink to oblivion).
The tentacle starts up in the air.

KronosUK(Posted 2011) [#31]
Any thoughts about adding shadows?

Warner(Posted 2011) [#32]
Thanks Kryzon, it all seems to work properly now. Your models are a great help. I've added additive blending, and improved the z-ordering somewhat. I've added better support for brush colors vs. surface colors and some of the brush fx. Finally, I noticed I forgot to flip the normals on b3d meshes.
The tentacle model is very nice. And funny. The bone scaling works.

KronosUK, about shadows, thoughts indeed: I have considered it, and it boils down to the same question: how? I have no idea. I'm working with openGL 1.5 and only a limited amount of time (and brain capacity). Creating shadows seem to be difficult -mathwise, and as I understand, they require processor intensive calculations. I expect in the future, that shadows are part of the hardware accelleration. Maybe they are allready available, via shaders? I don't know. If shaders could provide shadows, perhaps that would be an option. However, it would go against one of the starting points of the project: overall compatibility.

Kryzon(Posted 2011) [#33]
I'm sure a basic shadow mapping would go a long way.
Here you can see it done only through fixed-function, without using any shaders: http://www.paulsprojects.net/tutorials/smt/smt.html

The demo shows it very nicely, and comes with the .EXE and C++ source.

Warner(Posted 2011) [#34]
Hmm, I don't like to admit it, but my videocard doesn't seem to support it. I see just a basic scene without shadows. The docs mention ARB_depth_texture and ARB_shadow, so I suppose I don't have them. When I get to it, I will have a closer look.

AdamRedwoods(Posted 2011) [#35]
Isn't there a semi-shadow implementation in the extended miniB3D?

*(Posted 2011) [#36]
Amazing stuff :)

Kryzon(Posted 2011) [#37]
The shadows present in klepto2's MiniB3D Extended are stencil-shadows - or rather an attempt at them because last time I ran the demo they were very slow and had cracks at the edges of shadowed faces (when compared to other stencil shadow demos from nVidia and others).

Shadow maps might be as backward-compatible as stencil ones, but they are good for whatever complexity your scene might have (while shadow volumes don't scale well with highly complex scenes), and have the capability to be filtered in any of the many ways available.

KronosUK(Posted 2011) [#38]
Shadow mapping would almost certainly be quicker even if you were rendering the scene 2-3 times although some care needs to be taken if you have alot of large meshes in your scene.

I've been struggling with shadow maps for my own little engine for ages and getting nowhere. Most demos you see cover a specific area, normally a convenient square which you can clip to, I have no idea what else you would need to do for an unlimited area with a moving camera.

Its the one feature imo that minib3d could really use as pretty much everything else is now covered, eg terrains, shaders etc.

Kleptos shadows are indeed slow and I also noticed "extra" shadow images when I used it.

Markus Rauch(Posted 2011) [#39]

Warner(Posted 2011) [#40]
Well, still working on this. I have spent most of the week trying to figure out the 3ds format. Simple models are fine, but I have trouble reading meshes with hierarchy. Static meshes now work (finally), so currently I'm struggeling with animated 3ds.

Should look like Phineas from Phineas&Ferb.

Kryzon(Posted 2011) [#41]
This exploded mesh problem only happens with the animated ones?

Last edited show_time('2011-05-21 23:03:14')

Warner(Posted 2011) [#42]
Yes, at first I had the same problem with static meshes as well: see the car in #22.

Kryzon(Posted 2011) [#43]
What a mess of a format. No wonder it's dead.

I can only presume the issue is due to coordinate context; try considering the coordinates you read in parent-space, and then try to consider them in world-space just to see if there's any difference (for object positions, not vertices since you seem to be reading them correctly).

Last edited show_time('2011-05-22 19:46:30')

Happy Sammy(Posted 2011) [#44]

*(Posted 2011) [#45]
looks amazing none the less and its come a long way since its started. I wish I had the time to spend coding like I used to :D

AdamRedwoods(Posted 2011) [#46]
lib3DS, if this helps:

Hotshot2005(Posted 2011) [#47]
Looking very good :)

kfprimm(Posted 2011) [#48]
Anyone who is interested in lib3ds,

sys87.lib3ds imports all the constants and functions. I'm going to begin integrating into my engine now.

I'll also begin making a libx module.

Warner(Posted 2011) [#49]
Thanks! I uploaded the latest version, with the improved b3d loading. Also, I included klepto's Newton physics, and the slightly improved 3ds loader. (static hierarcy loads correct now) For now, I continue working on loading 3ds files somewhat more. Also, I noticed, in global space, the pitch seems to be reversed compared to Blitz3d. I would like to change that. Thanks for the lib, Kevin! And thanks for the link, Adam.

Edit: Finally!

Last edited show_time('2011-05-25 05:38:27')

Warner(Posted 2011) [#50]
v0.1.0 - supports loading animated 3ds meshes. One testmodel didn't load properly (anim.rotation keys y/z are swapped and it's axis z negated), but blitz3d didn't load that model correctly, too. I also tried out different methods for swapping the z-axis in an attempt to change the 'pitch' direction, but ended up with simply negating the 'pitch' parameters in TEntity.bmx.

*(Posted 2011) [#51]

Warner(Posted 2011) [#52]
Next update will contain Sprites:

And it can be more easily combined with MaxGUI:

(White area is an HtmlView and black area = Canvas+3D)
I'm now wresteling with PointEntity, it somehow keeps pointing the wrong way..

*(Posted 2011) [#53]
excellent :P


kiami(Posted 2011) [#54]
Great work, stay with OpenGl, use Bullet, don't rush, don't promise, sell what you have produced, not what you wish to produce, otherwise you will lose friends and everything.

matty47(Posted 2011) [#55]
following your progress keenly. On Mac OSX 10.6.6 version works OK however latest version fails with
realpath failed for Physics/inc/libnewton32.a
import "Physics/inc/libnewton32.a"
line in the interface file highlighted.
THe module built OK in IDE. Wrong lib maybe?
I note that there are two other libs in the directory.
?? Thanks

jkrankie(Posted 2011) [#56]
+1 for bullet over newton, although it might not be what you're intending.

How are you doing sprites? you're batching them, right? They're super slow in MiniB3D.


Warner(Posted 2011) [#57]
The other libs are for either Linux or Win32. I can only test this on Windows, because I have no Mac with XCode available. I'm afraid I can't help much.
It is a strange issue, because neither that line, or that file have been changed. I did change the file TPhysics.bmx.
What does that error mean? Does it mean it can't find the file?
In a previous version, a filename case problem was reported, on Linux. I changed the file "phyics.bmx" to "Physics.bmx" to solve this.
Does libnewton32.a exists? Does the file have the correct case? (all lowercase?)
What you could try is to change the line so, that it contains the full path to the file, ie:
import "c:/blitzmax/mod/warner.mod/engine.mod/Physics/inc/libnewton32.a"
Else, I would try removing all the .bmx folders in that area, and do a rebuild.
Again else, I would try a previous version -one that works-, then replace all the folders, except the "Physics" folder and "TRenderer.bmx", with the latest update, and recompile. If it does, replace the file inside the Physics folder one by one to see where it goes wrong.

Well, Sprites are now experimental. I made a class called TSpriteRenderer. That is a mesh that contains a single surface and a list of Sprites. Each sprite is connected to a quad on this surface. When the TSpriteRenderer is rendered, all the quads are updated to where their counterpart Sprite is, with the same rotation as the camera. On my computer, I was able to draw 1200 sprites at 79 fps. (no debug enabled) That doesn't really say anything, really. My videocard is really bad.

I've added a shadowing system. However, it is not very fast, since it renders the scene several times over. If I have time, I'll try and look into another method.

For using shadows, your card must support stencil buffers.

Last edited show_time('2011-06-03 19:23:07')

Happy Sammy(Posted 2011) [#58]
@Warner: Hi, what is your pc configuration?

Warner(Posted 2011) [#59]
There is no type id I can find, but this one looks pretty alike:

*(Posted 2011) [#60]
are they stencil shadows I see ;)

Great stuff Warner :D

Azaratur(Posted 2011) [#61]
Warner do you need some test? I have 4 machine with different type of graphic cards.

Warner(Posted 2011) [#62]
I'd much appreciate that, thanks!

*(Posted 2011) [#63]
The engine falls over with an absolute path error on the import "physics/Inc... I was wondering if there was a fix for this as the files are there but it don't seem to locate them.

I will play around with it and see if I can get it to work

My specs are: osx 10.6.7, 1gb ram, intel 2ghz dual core, blitzmax 1.42

Warner(Posted 2011) [#64]
Both MacOS and Linux seems to give problems when the .a files are placed in a subdirectory. If you move them up to the project's root, and change the line in TRenderer.bmx from
format_code('Import "Physics/inc/libnewton32.a"')
format_code('Import "libnewton32.a"')
The realpath trouble should be gone.

*(Posted 2011) [#65]
Excellent stuff once I changed the paths over it works fine.

One little snag is on the shadow render when the ninja models shadow gets rendered if the shadow is off the screen you get artifacts when its on the screen even as a single pixel its fine.

Warner(Posted 2011) [#66]
Ah, thanks for reporting. I can't reproduce it, but I will look further into the shadow rendering.

matty47(Posted 2011) [#67]
Warner, great to see that you found the problem with Mac OS X. Had nothing to do with 32 versus 64 bit after all. Moving the newton lib fixed the problem for me also. Thanks.

kfprimm(Posted 2011) [#68]
I believe the problem is probably due to case-sensitivity issues. It shouldn't matter what directory you import the library archive from.

Warner(Posted 2011) [#69]
Hmm .. I will take a better look at it, kfprimm.
About the shadow artifacts: it seems that the example is wrong. The "light" is positioned inside the wall. (cube=15x15x15, lightpos=0,15,-15) If you change the light position in the example, the artifacts should be gone, ie:
SetShadowLightPosition( shadow, 0, -45, 45, 1 )

*(Posted 2011) [#70]
Excellent engine, now all I need is a LWO loader and its perfect :)

Hotshot2005(Posted 2011) [#71]
Hey Warner,

You are very good at keeping things going and keep good work up :)

AdamRedwoods(Posted 2011) [#72]

now all I need is a LWO loader

I usually go LWO->OBJ loader. Works for miniB3D, should work the same for this engine.

Warner(Posted 2011) [#73]
For now, you could look into Biturn. It seems to be a very complete 3d converter that includes lwo and b3d. Haven't tested it very intensive. It is on the following page, a bit further down:

Difference(Posted 2011) [#74]
Latest version (warner_0_1_3.zip ) all examples 100% ok on Snow Leopard , Mac Mini, NVIDIA GeForce 9400.

Great work, you seem to have made a really solid engine.

Do you know how it handles itself on low spec (office type) machines yet?

Last edited show_time('2011-06-16 02:34:32')

Difference(Posted 2011) [#75]
I'm missing VertexCoords() for using assimp as a loader for warner.engine

Is there a way to set vertex positions, or can you add that?

Warner(Posted 2011) [#76]
That would be cool. To add VertexCoords, in "engine.bmx", add the following lines, then recompile:
bbdoc: Sets the x,y,z position for a vertex
End Rem
Function VertexCoords( surf:TSurface, index%, x#, y#, z# )
surf.vertices[index*3+0] = x
surf.vertices[index*3+1] = y
surf.vertices[index*3+2] = -z
End Function

Working on RenderToTexture:

Last edited show_time('2011-06-16 09:30:43')

Difference(Posted 2011) [#77]
Looking cool.

I got assimp example working.
I will clean it up and add it to blitzmax-assimp soon.

Kryzon(Posted 2011) [#78]
Looks promising.
Could you tell me if this RenderToTexture uses the hardware-way¹ or the Blitz3D hacky-way² of rendering?

¹Rendering directly to a Framebuffer object with a texture attachment (faster way, requires EXT_FrameBuffer_Object extension support).

²Rendering to the backbuffer and using CopyRect to a texture's buffer (slower way, but can be used as a fallback in systems that don't support framebuffer objects).

Warner(Posted 2011) [#79]
@Difference I didn't realise how handy assimp is. Does it really load all those formats? Looking forward to it.

@Kryzon I copied the MiniB3D BackBufferToTexture:
Method BackBufferToTexture(x%, y%, width%, height%, mipmap%=0)
glBindtexture GL_TEXTURE_2D, name
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, x, GL_height-y-height, width, height, 0)
End Method
So I suppose it is option 2, I realise I should have said "BackBufferToTexture" instead.

Kryzon(Posted 2011) [#80]
From what I know that way is more compatible (glCopyTexImage2D requires at least GL 1.1, according to the online specs, so it's a wide range).

I didn't know of the Assimp library; every game engine deserves one of these.

AdamRedwoods(Posted 2011) [#81]
I (almost) recommend adding both ways. Check for the EXT_FRAMEBUFFER_OBJECT and try rendering to texture that way, fallback is the other. You may find it useful for more robust appllcations (like shadows).

*(Posted 2011) [#82]
I think this should be on a separate forum section like minib3d is?

Difference(Posted 2011) [#83]
I'll get back on assimp-warner soon, but I'm swamped in work right now.

Would anybody (more than one are welcome) be interested in joining the blitzmax-assimp project?
Would you Warner?

Ideally I'd add the interface to assimp and you'd write the blitz side of things.

It's quite solid and loads all those formats, but I've only been using it for static meshes.

Last edited show_time('2011-06-28 02:28:48')

Warner(Posted 2011) [#84]
Hmm .. I don't think I have the time. I have a few weeks off soon. But I would like to use that time to complete the 3d editor that I wanted to use this engine on.

Difference(Posted 2011) [#85]
Ok, the door is always open.
You might still decide your 3D editor needs all those input formats :-)

Warner(Posted 2011) [#86]
Just uploaded a new version 0.1.4. It contains a number of added commands, some fixes again, and I've ported some of the
samples from blitz3d, such as the 'head demo', and 'x fighter'.

BlitzSupport(Posted 2011) [#87]
Wow, this is looking good. Just ran all 0.1.4 demos with no problems, with the exception of the render to texture examples, which don't show any textures for me.

jkrankie(Posted 2011) [#88]
Tried the latest, very cool!

Couple of things: no texture on the little animated guy in the Mesh example (the one with the roman bath i think). Also no texture being rendered in either render 2 texture example.

Shadows are cool, but i guess still a work in progress. I added a shadow caster to the maplet mesh in the physics demo, and set the physics objects to cast shadows. It was super slow, and shadows appeared to be visible through walls etc.

Quick hypothetical question: if i wanted to switch from minib3d to this at some point, how much work would be involved in terms of changing code, given that i'm not doing anything too fancy with minib3d, but there is a lot of code in the project (about 73000 lines).


Warner(Posted 2011) [#89]
Thanks for the feedback, guys. I'll look into it at work tomorrow. One of the machines there gives a similair result.
If you want to convert from minib3d to this engine, there are a few differences. Especially sprites are done completely different, which could be an issue for your projects? Also, collisions and picking are done differently. I have been working on creating wrapper code to simulate the way minib3d handles collisions and picking, but I wasn't able to get it to work still. These routines are in engine.bmx, placed between comments.
So depending on the original code, it might be either very easy, or somewhat more work.

Arska(Posted 2011) [#90]
Any way to export animated model from Blender and use it with Warner engine? I am using Blender-2.57b

Warner(Posted 2011) [#91]
The engine can load .3ds and .b3d models. I don't know Blender very well, but I assume it can save to .3ds? You could try a search for "Blender b3d", there might be an export script for it.
The assimp library mentioned above comes with a convertor. You can convert many formats into others, such as .b3d. Google for assimp, then look on it's website.
Also, biturn -link in #74- can convert models to .b3d.

Arska(Posted 2011) [#92]
Yeah i probably have to convert to .b3d because Blender exports to 3DS, but without animations. :/

Warner(Posted 2011) [#93]
I can really vouch for it -I have not many modeling skills, but there seems to be a b3d exporter for Blender:
I found a working link half down that thread:

Arska(Posted 2011) [#94]
I would use that, but it's outdated and not working anymore. Someone needs to update it for Blender 2.5.

Kryzon(Posted 2011) [#95]
Problem is that the entire Blender API was updated (in much better ways than it was before), so the entire plugin would need to be reprogrammed from scratch.
*Cough* Good thing, 'cause I think it was a mess *Cough*

Do you use 3DS Max?

Last edited show_time('2011-07-06 14:37:35')

Warner(Posted 2011) [#96]
It would be a shame if you couldn't use Blender. How about the assimp viewer? Doesn't it offer any import format that is compatible with Blender? It can convert to .b3d

Arska(Posted 2011) [#97]
Assimp imports Collada (.dae) files with animations and everything. Here is picture:

I am blind or does anyone see where is exporting?

Edit: I exported Makehuman (.mhx) model to Collada (.dae) and tried to import it to Assimp, but what is this?

Last edited show_time('2011-07-06 19:15:03')

Last edited show_time('2011-07-06 19:15:47')

cr(Posted 2011) [#98]
Looked at code in TOpenGL.bmx
thought i'd play around.

'Have a look at the following lines in the following file from mediafire'

LINE 27-28:
LINE 50-87:
LINE 115:
LINE 187:
LINE 937:


Just wanting to know why no one has released a Soil image loader ? " www.lonesock.net/soil.html ",bullet physics and and rapidxml modules for blitzmax.

Why freeimage ?

Warner(Posted 2011) [#99]
@Arska, indeed, I must have misinterpreted the description "Due to its export interface, Assimp serves as general-purpose 3D model converter". I assumed they were speaking of the assimp viewer.
Thanks @cr. It's better. I'll include the fixes in the 'official' version. About the other topic: I wouldn't know why no one did that. But if you really want to discuss that in-depth, I suggest making a post in the "General Topic" forum.

Arska(Posted 2011) [#100]
Any way to get support for Collada? Makes my life lot easier. Or any other ways to get .B3D?

Last edited show_time('2011-07-07 09:57:04')

Warner(Posted 2011) [#101]
Ultimate Unwrap should be able to convert from Collada to b3d. And you could look into the Assimp mod from Difference. I don't know how others create .b3d files. It might be an idea to ask in the "General Help" forum. There might be folks there who know more about modeling (and thus exporting) than me.
Edit: support? Hmm .. I will look into it, but I wouldn't hold my breath. It took me one or two weeks to implement reading animated .3ds files. And Collada seems to be a far more sophisticated format.

Last edited show_time('2011-07-07 10:13:43')

Arska(Posted 2011) [#102]
Just quick question. How do i get entity rotation?

I tried this:
Local rpos:Float[] = player.GetGlobalRotation()
rx = rpos[0] ry = rpos[1] rz = rpos[2]

but it return values which is under 1. For example: 0.94837594.

I need to prevent entity to rotate too much.

Warner(Posted 2011) [#103]
Yes, that function returns a quaternion. Instead, use EntityPitch, EntityYaw and EntityRoll. It might still be tricky to limit it's rotation, because the three degrees of freedom affect each other.

Arska(Posted 2011) [#104]
Engine definetly needs Blitz3D like EntityX, EntityY and EntityZ. I still need to prevent rotation, but i don't know how. :S

Warner(Posted 2011) [#105]
But it has that allready? You can look up the possible functions in "engine.bmx", or use 'rebuild docs'.
I'll post an example of how to limit camera rotation.

outsider(Posted 2011) [#106]

I had a problem with Terrain samples - EXCEPTION_ACCESS_VIOLATION with LoadTerrain function (exactly roam_create(float *heightdata, int size)). I had one of the last Mingw version, now I installed older Mingw 5.1.3 and it works :). Maybe someone else had this problem.

Warner(Posted 2011) [#107]
I had that problem myself. It traced back into the cpp file that creates the terrain. Strangely enough, the problem dissapeared when I recompiled. So hopefully the next update should take solve this issue?
Edit: I have MinGW 5.1.4

Last edited show_time('2011-07-19 08:43:05')

Warner(Posted 2011) [#108]
Sorry to bump, but does that problem dissapear when you add this line to the top of the Terrain example?
format_code('GCSetMode 2')
It might be related to the garbage collection. The terrain uses memory that is alloced by C, rather than Bmax itself.

outsider(Posted 2011) [#109]
I recompiled the mod in later Mingw with GCSetMode 2 but unfortunately it still does not work. When I recompiles with mingw 5.1.3 everything works well with and without GCSetMode 2.

I know it's stupid but it may be Mingw version bug/problem.

Edit: By the way the engine looks really good :)

Last edited show_time('2011-07-20 07:28:55')

Warner(Posted 2011) [#110]
This might be a solution? In roamstep4d.c, the lines 203-209 were in the wrong order:

Should be:

That could be the cause: the "roam" was used before it was created.

outsider(Posted 2011) [#111]
It works :)

Warner(Posted 2011) [#112]
Yes! Finally .. thanks for letting me know.

Warner(Posted 2011) [#113]
v 0.1.5 is now available. It contains a number of fixes, and a few extra commands.

- v 0.15 "physics objects reset to EntityScale 1,1,1" problem, should be fixed now
- number of bones pro surface is increased on demand
- added fixes by cr
- added EntityDistance
- fixed Terrain bug, where C roam struct was used before being created
- added EntityCollided - differs from Blitz3D, see the "Collision" sample that was added
- Note: BackBufferToTexture has not been changed yet. It has been reported that is doesn't work everywhere.

Download link

Edit: This weekend, I'm going on vacation for a couple of weeks. So during that time, I won't be able to give support or answer questions.

Last edited show_time('2011-07-21 07:20:07')

Warner(Posted 2011) [#114]
So erm.. I'm back from my holiday. Just in case someone needs me.

Hezkore(Posted 2011) [#115]
Warner I need you!
I can't seem to find BeginMax2D() in your engine, got anything similar to it? :o

UPDATE: Ok so I found GL_Begin2D() but It's acting very different from MiniB3D.
Using it the same way I do with BeginMax2D() produces some very odd graphical errors. :S

Last edited show_time('2011-09-05 08:45:51')

Warner(Posted 2011) [#116]
Well, indeed, I didn't got GL_Begin2D to work as well as minib3d's BeginMax2D. Could you create a small example that demonstrates the problem?
There might be a quick fix for it.

Edit: The original minib3d BeginMax2D stores a number of states before it starts off the 3d mode. I believe this happens in InitGraphics. Then, when BeginMax2D is called, it restores these states.
And when EndMax2D is called, it again stores these states and reinitializes the 3d settings (frustum etc.)
In my engine, GL_Begin2D just sets a number of states to enable 2d drawing. Then GL_End2D does the opposite. So some of the states needed for certain Max2D functions might not have been set.
I believe that this approach is to blame for any strange-looking 2d output.

Last edited show_time('2011-09-07 11:25:08')

Hezkore(Posted 2011) [#117]
Probably... I haven't gotten around to making an example yet (Very busy >_>)
But basically what happens is that the picture position is off, it's way to the left and up.
Think the alpha is weird too.. not sure. :S

If you've got any updates I'd be happy to be your Ginnie pig!
I'm trying to use your 3D engine is a pretty big framework I've made.

Captain Wicker (crazy hillbilly)(Posted 2012) [#118]
Very Cool :)

Yue(Posted 2012) [#119]
format_code('Building Shadow
Compile Error: Can't find interface for module 'warner.engine'
[C:/Program Files (x86)/BlitzMax/samples/Shadow.bmx;3;1]
Build Error: failed to compile C:/Program Files (x86)/BlitzMax/samples/Shadow.bmx
Process complete')


Jesse(Posted 2012) [#120]
asegurate de poner el "warner.mod" en el "mod" folder de BlitzMax y as un "Build modules" y por ultimo as un "Build" de "Shadow.bmx"

Last edited show_time('2012-02-16 01:47:42')

Yue(Posted 2012) [#121]
creo que debe ser por que trabajo con la 1.38, no esta activado "build modules".... =(

Last edited show_time('2012-02-16 07:51:18')

Warner(Posted 2012) [#122]
You could also try the command line from your BlitzMax install folder:
bmk makemods.

Yue(Posted 2012) [#123]
Hi Warner, I tried but nothing ...

Sorry i'm now.

Jesse(Posted 2012) [#124]
you have to install MinGW(tienes que instalar MinGW):

Last edited show_time('2012-02-16 10:27:13')

Yue(Posted 2012) [#125]
you have to install MinGW(tienes que instalar MinGW):

Gracias ya me pongo a instalar eso...

Edit: lo siento el traductor de google no me colabora mucho en la instalación, .... esto es una pesadilla.

Last edited show_time('2012-02-16 13:49:07')

Jesse(Posted 2012) [#126]
mi español no es muy bueno y no se como se traducen algunos funciones de windows a español. lo que tienes que a ser es instalar MinGW a la carpeta "c:\MinGW". Siguiente abre el "control Panel"(?) Y selecciona "Hardware and Sound"(?) -> "System and Security"(?) -> "System"(?) -> "Advanced System Settings"(?) - > "Environment Variables"(?)

en la sección de arribal pincha "New.."(?) pare el nomber escribe "MinGW" y para el valor escribe "c:\MinGW" y presiona "Ok".

en la sección de abajo busca le entrada "Path"(?),selecciona y pincha la opción para editarla y agrega esto al final ";c:\MinGW\Bin" exacto con el semi-colon al principio y presiona el boton para aceptar.

no estoy seguro si necesitas volver a empezar Windows de nuevo pero por si las dudas as lo.

estas instrucciones son para windows 7. si tienes windows Vista dejame saber y agregare la ultima instrucción.

ojalá esto te sirva.

Last edited show_time('2012-02-16 16:05:57')

Yue(Posted 2012) [#127]
I'am Use windows XP.

See Image step.

Jesse(Posted 2012) [#128]
se ve bien. Funciona?

Last edited show_time('2012-02-16 16:26:26')

Yue(Posted 2012) [#129]
No, it's a shame it does not work ...

Yue(Posted 2012) [#130]
One moment i reset my computer.

Jesse(Posted 2012) [#131]
After you restart, build modules then compile the code.

Last edited show_time('2012-02-16 16:23:54')

Yue(Posted 2012) [#132]
It seems that it will work, since the options of "Build ..." are already active in the menu ... for now is doing the Buil ... then I try to end it works.

Yue(Posted 2012) [#133]
Hey, I want to sincerely thank you for the time you've taken in helping me, really not knowing English hurts me greatly, but I try to do better with Google translator and help from people like you willing to collaborate.

Actually use the version 1.38 and if I see the possibility that the next step is BlitzMax if I have money.

A greeting and thank you very much true.

I'am Happy =)

AntonyWells(Posted 2012) [#134]
One Tip from a 3D guru, "Lighting & Atmospherics"

Try to improve it with more advanced lighting techniques such as Normal Mapping and Parralax Mapping. Then consider soft shadows. Then final area in this regard would be Post Processing.

These features will greatly improve the graphic output.

Yue(Posted 2012) [#135]
Hi, I have a question, do things with this engine for OpenGL, Esti means you can work on other operating systems other than Windows?

Jesse(Posted 2012) [#136]
Yes this engine should work under Windows, Mac, and Linux with Blitzmax.

Yue(Posted 2012) [#137]
Yes this engine should work under Windows, Mac, and Linux with Blitzmax.


Captain Wicker (crazy hillbilly)(Posted 2012) [#138]
Can this and minib3d both be installed at the same time?

kfprimm(Posted 2012) [#139]
Yes. They are in different module scopes so that isn't an issue.

Captain Wicker (crazy hillbilly)(Posted 2012) [#140]
Warner, Do collisions work? How?

Warner(Posted 2012) [#141]
Yes, use UpdateCollision(source:TEntity, target:TList, method, response)
Where source should be the moving Entity, and target should be a TList, containing all static entities that you want to collide with. Method and response are the same as in B3D's Collision command.
The Terrain sample uses this command.

Captain Wicker (crazy hillbilly)(Posted 2012) [#142]
Okay. I was confused when the Collisions(mesh_type, mesh2_type, 2, 2) didn't work for me. Thanks! :D

Duffer(Posted 2013) [#143]
How much support for this Warner B3D now?

How does it compare with say miniB3D, MaxB3D and the Irrlight wrapper for Blitzmax?