Vortex - Open Source 3D engine - v1.2 released!

Monkey Forums/User Modules/Vortex - Open Source 3D engine - v1.2 released!

JaviCervera(Posted 2015) [#1]
Hello everyone!

I have been playing with OpenGL ES 2 on Monkey lately, and I have decided to release a small 3D engine I have written for you to use. It is distributed under the terms of the Zlib license, and you can find the project on Github:

https://github.com/JaviCervera/vortex

You should clone the repository onto <MonkeyFolder>/modules_ext, or download as a zip file and put the vortex folder on that same location. You should select Help -> Rebuild Help afterwards, and the documentation should be available in your modules help.

It is very simple, you can get a glimpse of what it does by checking the README on the Github page. If people is interested, I will improve it. Bug reports and pull requests are welcome.

Here is a link to the engine tests running in HTML5:

https://dl.dropboxusercontent.com/u/502828/vortex_tests/index.html

EDIT: I have released an update to my 3D graphics library for Monkey, Vortex. You can go straight to this release and download the binaries:

https://github.com/JaviCervera/vortex/releases/tag/v1.1

The list of changes:
- Now Vortex supports changing handedness. To do that, you can write this at the beginning of your program:

Import vortex.src.handedness
#VORTEX_HANDEDNESS=Mode

Where Mode can be one of:
VORTEX_LH: Left handed coordinate system (the default now)
VORTEX_RH_Y: Right handed coordinate system, with Y as up vector
VORTEX_RH_Z: Right handed coordinate system, with Z as up vector (the default in previous versions of Vortex)

Left handed system uses clockwise order for rotations and triangle winding, and maps textures from the top left to the bottom right.
Right handed systems use counter clockwise order for rotations and triangle winding, and maps textures from the bottom left to the top right.

- Possibility to switch the vertical axis of screen coordinates for 2D. Now the default is that Y increases downwards (opposite from previous versions). To select the screen coordinates mode, write this at the beginning of your program:

Import vortex.src.config
#VORTEX_SCREENCOORDS=Mode

Where Mode can be one of:
VORTEX_YDOWN: Y goes down (default)
VORTEX_YUP: Y goes up (the default in previous versions of Vortex)

- Added procedural API. Despite differences in implementation on the Object Oriented layer, the procedural API should offer the same functions as a future implementation of Vortex in C++

- Added Vortex_GetAPIVersion and Vortex_GetShadingVersion

- Support for JSON meshes and fonts replaced by XML versions

- Meshtool replaced by Irrlicht-based version

- Fonttool and meshtool are now build from a .bat file (requires TDM-GCC-32 on Windows)

- Removed animation sequences from the engine. Now animations are a simple linear of keyframes, and you decide the first and last frame for the animation. This helps keeping Vortex a bit simpler, and it is not hard to add sequence support on a higher level engine

- Several bug fixes


EDIT 2: New update! Here's the link to the release: https://github.com/JaviCervera/vortex/tree/v1.2

The list of changes:
I have separated the project into two different brances: vortex1 (the default) will have non-API breaking changes, while vortex2 will use a different API and much improved features. This release contains the last commmits I added to Vortex1, which do not add any big new features, but a few fixes and small improvements:

- Added fog support through the Viewer_SetFog function.
- Improved font spacing.
- Changed fonttool to export glyph data as properties in XML file (reduces file size of generated fonts).
- Export_shaders (the tool that generates the shader code constants from the glsl files) has been ported from BlitzMax to Monkey.
- Updated structure so a mesh has a linear array of bones instead of a tree (does not need recursion to iterate through all bones).
- Bone's default matrix has been renamed to pose matrix, and defines a global transform (relative to model matrix, not to parent's pose matrix)
- Bone's current matrix has been renamed to anim matrix, and contains a global transform to animate the bone for some specific frame.
- The bone's anim matrix has been moved to the Drawable class, which contains an array of matrices, one for each bone in its mesh.
- To animate a drawable, before calling Drawable_Draw, you must call Drawable_Animate now.

I am not attaching binary files this time, so you'll have to build yourself. The meshtool has not been updated, so the binary from version 1.1 will work, but fonttool has been updated, so you will need to build it (on Windows, you should install a recent version of the compiler TDM-GCC).


Enjoy!


ziggy(Posted 2015) [#2]
It's very nice!


therevills(Posted 2015) [#3]
Cool!

In your demos, it'll be nice to move around the scenes :)


JaviCervera(Posted 2015) [#4]
Thanks guys!

I could make some FPS demo with it, but I'd like to find some decent assets pack first to make something that looks good. First, I want to build a 1.0 release that includes a precompiled fonttool and meshtool, and also add documentation for them.

Also, once Monkey2 becomes more mature, it would also be nice to port Vortex to it, which would greatly expand its capabilities (like adding support for Bullet physics).


Snader(Posted 2015) [#5]
Nice work JaviCervera!


CopperCircle(Posted 2015) [#6]
Great work!


JaviCervera(Posted 2015) [#7]
I have uploaded platform-specific releases for version 1.0 which contain prebuilt tools. You can find them here:

https://github.com/JaviCervera/vortex/releases


emar(Posted 2015) [#8]
I put the vortex folder into the monkey/modules directory, but when i run the "tests" it says the identifier "Vortex" is not found.
Am i misplacing the files?Is a declaration missing? ive never had a problem installing modules before


either way this is radical, thank you for all the work! :)


JaviCervera(Posted 2015) [#9]
That's weird, I am not capable of reproducing the problem. Which version of Monkey and which OS are you using?


emar(Posted 2015) [#10]
Whoops im incredibly stupid, i have two different versions of monkey installed and windows was opening the old one

all working now, thanks for a quick reply!


JaviCervera(Posted 2015) [#11]
The free version should be enough AFAIK. Anyway, as a registered user of the Pro version, when I try to download the free version, it takes me to the Pro download page (which is a terrible thing by the way, I should be able to download the free version to try things like this).


emar(Posted 2015) [#12]
<see post below>


emar(Posted 2015) [#13]
I believe i stumbled on a bug in the meshtool......

heres the sphere mesh that came with the test project

{
	"brushes":
	[
		{
			"name": "default",
			"blend": "alpha",
			"base_color": [1,1,1],
			"opacity": 1,
			"shininess": 0.875
		}
	],
	"surfaces":
	[
		{
			"brush": "default",
			"indices":[DELETED FOR POST SPACE] 
			"coords":[DELETED FOR POST SPACE] 
			"normals":[DELETED FOR POST SPACE] 
			}
	]
}


and An OBJ format model put through the converter.....

{
	"brushes":
	[
		{
			"name": "DefaultMaterial",
			"base_color": [0.600000,0.600000,0.600000],
			"blend": "alpha",
			"opacity": 1.0,
			"shininess": 0.000000
		}
	],
	"surfaces":
	[
		{
			"brush": "DefaultMaterial",
			"indices":[DELETED FOR POST SPACE] 
			"coords":[DELETED FOR POST SPACE] 
			"normals":[DELETED FOR POST SPACE] 
			}
--->HERE
}


it regularly misses that closing square bracket at the end(WHERE I WROTE "--->HERE", if i manually add the bracket, any model i try loads and displays just fine

hope this helps :)


JaviCervera(Posted 2015) [#14]
Whoops! Thanks for reporting that. Will check it. If you could send me the .obj file, it would be of great help!


emar(Posted 2015) [#15]
this is the file that was exported from blender...



JaviCervera(Posted 2015) [#16]
Ok, the repository has been updated with a fix for that bug. Thanks for pointing it out.


julesd(Posted 2015) [#17]
How do you use the meshtool?


JaviCervera(Posted 2015) [#18]
You use it from the command line. If you run it without arguments, will get a message with information on how to use it. Basically, you run "meshtool filename", and it will export a file with the same name, but .msh.json extension, which can be loaded in Vortex.

It uses the Assimp library, so you can load any of the model formats supported by this library: http://assimp.sourceforge.net/main_features_formats.html


Sammy(Posted 2015) [#19]
Looks quite interesting. How long did it take you to write?


JaviCervera(Posted 2015) [#20]
About two weeks, but this is not the first 3D engine that I write, and the current feature list is fairly simple.


Sammy(Posted 2015) [#21]
It's certainly does not look like just two weeks work, well done!


julesd(Posted 2015) [#22]
Hey is this engine dead already, or is it still being worked on?


JaviCervera(Posted 2015) [#23]
I am porting it to C++, thinking about making it compatible with Monkey2 and BlitzMax. I will maintain both versions, Monkey and C++, in sync, as long as Monkey1 stays relevant.

One of the advantages is that I can make a visual mesh converter instead of the command line one, using MaxGUI.


julesd(Posted 2015) [#24]
Awesome, and thank you for this.

Making it compatible with Monkey2 I think should be for sure, since it is a
newer language, plus I believe it will be 64 bit as well.


JaviCervera(Posted 2015) [#25]
As I said in a previous post, an upcoming update to the engine won't use the command line meshtool, and will instead have a GUI-based one written in BlitzMax (using the C++ port of Vortex). Here's a quick look at what I am working on (very WIP):




Xaron(Posted 2015) [#26]
This looks awesome! Thanks for publishing! Please keep it going!


JaviCervera(Posted 2015) [#27]
Version 1.1 released!. You can access the Github repository here:

https://github.com/JaviCervera/vortex

Or go straight to this release and download the binaries:

https://github.com/JaviCervera/vortex/releases/tag/v1.1

The list of changes:
- Now Vortex supports changing handedness. To do that, you can write this at the beginning of your program:

Import vortex.src.handedness
#VORTEX_HANDEDNESS=Mode

Where Mode can be one of:
VORTEX_LH: Left handed coordinate system (the default now)
VORTEX_RH_Y: Right handed coordinate system, with Y as up vector
VORTEX_RH_Z: Right handed coordinate system, with Z as up vector (the default in previous versions of Vortex)

Left handed system uses clockwise order for rotations and triangle winding, and maps textures from the top left to the bottom right.
Right handed systems use counter clockwise order for rotations and triangle winding, and maps textures from the bottom left to the top right.

- Possibility to switch the vertical axis of screen coordinates for 2D. Now the default is that Y increases downwards (opposite from previous versions). To select the screen coordinates mode, write this at the beginning of your program:

Import vortex.src.config
#VORTEX_SCREENCOORDS=Mode

Where Mode can be one of:
VORTEX_YDOWN: Y goes down (default)
VORTEX_YUP: Y goes up (the default in previous versions of Vortex)

- Added procedural API. Despite differences in implementation on the Object Oriented layer, the procedural API should offer the same functions as a future implementation of Vortex in C++

- Added Vortex_GetAPIVersion and Vortex_GetShadingVersion

- Support for JSON meshes and fonts replaced by XML versions

- Meshtool replaced by Irrlicht-based version

- Fonttool and meshtool are now build from a .bat file (requires TDM-GCC-32 on Windows)

- Removed animation sequences from the engine. Now animations are a simple linear of keyframes, and you decide the first and last frame for the animation. This helps keeping Vortex a bit simpler, and it is not hard to add sequence support on a higher level engine

- Several bug fixes


Enjoy and Merry Xmas to all of you :)!


Sammy(Posted 2015) [#28]
Well done Javi, hopefully this will be converted to Monkey2 when it's out of beta? A 3D engine would give me a reason to be more interested Monkey2 TBH.


JaviCervera(Posted 2015) [#29]
I already have a C++ version done (although I have not yet ported the changes made in v1.1) that I will make public when Monkey2 is mature enough.


Sammy(Posted 2015) [#30]
Good man, thanks for your hard work here!


GarBenjamin(Posted 2016) [#31]
Just this past weekend I decided to learn OpenGL and write a 3D graphics system in C#.Net using OpenTK. However, if you've already built a 3D rendering and asset loading system for Monkey X then I definitely will check this out this week.

I didn't even realize we could actually write OpenGL inside Monkey X but if I understand your posts correctly we can and that is what you did?


GarBenjamin(Posted 2016) [#32]
It doesn't run at all for me. At least trying the test program doesn't. Blows up on Vortex_Init and commenting that out on the next Vortext_whatever function.
I copied the stuff over to my monkeyX folder then did a module update and help rebuild in Jungle.

I am guessing I didn't put things in the right place or something. This is something I wish folks would do when making modules for Monkey X.

Most of the people who have been using it for years I am sure know the ins and outs but for someone who has just got into it recently such as myself I have no idea what to do with these modules, where to put the files and so forth. Seems to require an almost inner working of the MonkeyX system in a sense to be able to use them. Be really cool if they were just plug n play. Failing that just a simple instructions.txt file that explains what exactly to do with the stuff.

This is not really your fault. I have ran into it with every module I tried to use. Got some to work but cannot remember what I actually did now. lol


Gerry Quinn(Posted 2016) [#33]
By default, you just copy them into the modules_ext folder. See for example Angelfont, which comes with Monkey (maybe that goes in the modules folder, the only difference is that modules_ext is supposed to be for third party modules).

I haven't tried Vortex yet, may take a look at it later.


GarBenjamin(Posted 2016) [#34]
Hey thanks! I didn't even know there was/could be a modules_ext folder. I will check and create it if needed then copy Votex inside and see if that works.


Beaker(Posted 2016) [#35]
Hey. I really like Vortex, but I'm having some issues with black fringing on alpha textures (using HTML5). I'm not sure if this is a premultiplied alpha issue (sounds likely) and I've tried to fix this by fiddling with the blend code in the renderer module. Or is it a shader issue? Any pointers would be appreciated.

Similar minib3d discussion here:
http://www.monkey-x.com/Community/posts.php?topic=5016&page=4


JaviCervera(Posted 2016) [#36]
Hi, Beaker! Looking at the screenshots on the other posts, it looks like the cause is texture filtering. When you have a texture with parts that are completely opaque and parts that are completely transparent, the areas where it changes from one to the other are interpolated, showing pixels that are partially transparent. Disabling filtering when loading these textures should fix the issue. You can do it by specifying FILTER_NONE when loading the texture with Texture_Cache.


Carlo(Posted 2016) [#37]
Help for installer instruction

Thanks

Carlo


Leo Santos(Posted 2016) [#38]
I had never heard of this module until now!
Really cool, you should add it to Monkey's module registry.

Thanks!


JaviCervera(Posted 2016) [#39]
@Carlo:
You must clone the repository in a "vortex" folder inside the "modules_ext" directory of MonkeyX. If you don't want to deal with Git directly, you can also download one of the binary releases and unzip it into that same directory. After that, you have to go to the "Help / Rebuild Help" option menu in the IDE, and documentation for the Vortex module will appear on the docs.

@Leo Santos:
Thank you very much for your interest! I'll contact support to get the module added :)

I have uploaded a new v1.2 release with the latest changes, and have separated the repository into two branches: vortex1 and vortex2. Vortex1 is te default branch, and minor improvements will go there. Vortex2 is a very work-in-progress branch where I will upload much bigger changes that will be part of the second major release. The API is not compatible at all with Monkey1 (is lower level, which will make it easier to add several optimization to the rendering pipeline), and has a bunch of new features, like skinned animations, cube mapping, normal mapping, and more stuff to come.

By now, I recommend to stick with Vortex1, since the API is more unlikely to change, and wait until an official v2.0 is released.


Leo Santos(Posted 2016) [#40]
Played with this a little bit and managed to get a simple cube out of Maya and spinning in Monkey! :-)
What's the best way to export materials and textures? Exporting as .OBJ did not seem to carry any material information, and the converter did not like .FBX. Should I try a different format that works with the converter?

Edit: I got materials working out of Blender. Anyone had success getting it out of Maya? Or maybe there's a better format than .obj? Here's the result from Blender, in all its HTML5 glory: https://dl.dropboxusercontent.com/u/446189/MeshTest/MonkeyGame.html

Thanks!


JaviCervera(Posted 2016) [#41]
Nice! Here's another demo, showcasing the normal & environment mapping that will be available on Vortex2:

https://dl.dropboxusercontent.com/u/502828/vortex2_normal/index.html


outsider(Posted 2016) [#42]
There is some problem

Chrome 50.0.2661.102 m:
"Error: ERROR: too many uniforms"


JaviCervera(Posted 2016) [#43]
Oh, didn't try it with Chrome. It works on Firefox. The uniforms should exceed the available number, which should at least be 1024, but maybe the Chrome implementation of WebGL is not standards-compliant. I will reduce the number of bones supported, so that would get rid of several uniforms.


ImmutableOctet(SKNG)(Posted 2016) [#44]
@JaviCervera: Works here using Opera Developer V39 (Chromium based) as well as Google Chrome 50.0.2661.102 (On Windows 10 x64). Outsider's problem may be related to his graphics drivers, rather than Chrome specifically. Although, if he's on Windows, Chrome uses ANGLE, so you can't blame OpenGL drivers.


JaviCervera(Posted 2016) [#45]
I have found that it is having rendering issues on OS X. Will fix it and upload a new version, although I don't think it is related with the problem Outsider reported.


Landon(Posted 2016) [#46]
This is really really cool. Great job!

Are there any plans for collision detection? or is this strictly a rendering lib?


outsider(Posted 2016) [#47]
@ImmutableOctet(SKNG): Thanks for info, yes, this is posible, cause I have quite old driver on my Clevo p150em, new one doesn't work :/

Any way, good job JaviCervera :)


JaviCervera(Posted 2016) [#48]
Ok, I have uploaded the demo to make it work on OS X, and have reduced the number of uniforms in the shader. It is the same link as before:

https://dl.dropboxusercontent.com/u/502828/vortex2_normal/index.html

Outsider, please check if it works for you now. It works for me on Chrome.


outsider(Posted 2016) [#49]
Unfortunately, still doesn't work, it must be a problem with my graphics drivers.


Landon(Posted 2016) [#50]
yea the error log says

Error: ERROR: too many uniforms


JaviCervera(Posted 2016) [#51]
Well, the shaders should support at least 1024 uniforms, but I seem to have ran into this problem:

https://bocoup.com/weblog/counting-uniforms-in-webgl

Despite of WebGL limit, many browsers on Windows only supports 256 uniform positions, because they implement GL support through ANGLE, translating to DX9 calls, which have this limitation. I'll see what I can do.


Landon(Posted 2016) [#52]
awe gawd microsoft.. just let us have dedicated OpenGL for browsers


ImmutableOctet(SKNG)(Posted 2016) [#53]
@Landon: Don't blame Microsoft for anything here, they didn't even make ANGLE. This is just a problem with the legacy implementation of ANGLE. This means this is a DirectX driver issue on the system's end, or ANGLE is otherwise unable to detect DX 10/11 support. I'm on Windows 10 using Chromium with AMD drivers for crying out loud, and I still don't have any issues.


Landon(Posted 2016) [#54]
ok gotcha, i didn't research it lol (obviously) ;P

Hmm yea i'm running windows 10, AMD Radeon GPU, it's giving me errors.

It's very much possible it's the older Laptop i'm stuck using currently (thanks to my kids :/) is not compatible with the min req directx for this.

by old i mean Moore's law has recycled a few times already old.


Carlo(Posted 2016) [#55]
the pc works
but in the mac 10.11.4 not works
Please help :)

Carlo


Carlo(Posted 2016) [#56]
the demo link work on Mac OS X


Ok, I have uploaded the demo to make it work on OS X, and have reduced the number of uniforms in the shader. It is the same link as before:
https://dl.dropboxusercontent.com/u/502828/vortex2_normal/index.html
Outsider, please check if it works for you now. It works for me on Chrome.


consty(Posted 2016) [#57]
Sincerely, there is no other alternative than Chrome. Especially if you really like the one-process-per-tab feature.


outsider(Posted 2016) [#58]
My apologies for the late response.

Unfortunately, still: Error: ERROR: too many uniforms

My video card: AMD Radeon HD 7970M switchable to Intel HD 4000, but Chrome is forced to use Radeon


Xaron(Posted 2016) [#59]
Looks pretty nice. Is that something that is still in development?


JaviCervera(Posted 2016) [#60]
There is a "vortex2" branch in the repository to to take a look at the in development 2.0 version, although API might change before the final 2.0. It contains things like normal and cube mapping, and skeletal animation. Progress is ongoing, but slow, since there are not many users and it's a hobby project. If Monkey2 gains any momentum, I will port this to it.


Xaron(Posted 2016) [#61]
Nice! I think about to move Unity back to the trash bin where it belongs to...


Ratchet(Posted 2016) [#62]
Is it possible to use mojo2 and vortex in the same project? I got a mojo2 app and want to display at least a mesh and rotate it.


JaviCervera(Posted 2016) [#63]
I haven't tried to combine Mojo + Vortex graphics. I only use Mojo for input / audio, etc, but it is likely to have issues.


Soap(Posted 2016) [#64]
It would be handy to have a version which can be used to draw meshes on top of a mojo/mojo2 scene.


Ratchet(Posted 2016) [#65]
I absolutely agree to Soap, that would be fantastic.


MikeHart(Posted 2016) [#66]
Do models still have to be converted to be used with Vortex?


JaviCervera(Posted 2016) [#67]
Ok, I'll take a look into it, and before I make the 2.0 reléase official, I'll make it compatible with Mojo2.

@MikeHart: Yes, you still need to export them with the command line tool. I might write a mesh viewer with the ability to export Vortex meshes tho, since I think it would be handy.


MikeHart(Posted 2016) [#68]
Why not load them directly? Why is the conversion needed?


JaviCervera(Posted 2016) [#69]
Because writing Monkey loaders for the most common 3D file formats is a lot of work, and I want to focus on other things. So I wrote a command line app in C++ that loads the most common formats and exports them to Vortex' native XML format.


MikeHart(Posted 2016) [#70]
ok, thanks for the clarification.