Implementing BGFX as a driver...

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Implementing BGFX as a driver...

Post by christianclavet »

Hi,

I've been using Irrlicht for a long time, and it's been the best engine to learn from. I'm trying to learn other engine now and they are quite difficult compared to Irrlicht. The only thing that incite me to look for something else is the rendering features (still no instancing, no working deferred system and shadowing that's too slow), little rendering problems so far (mostly issues with shaders and transparency). I really like how Irrlicht is structured, and how easy it is for me to use it.

From what I understand now, I would fit in the high level programming. Tried to grasp stuff to do low level engine programming (tried to patch myself Irrlicht for instancing and failed) and it's too hard for me. I'm a hobbyist programmer and would not like to go that deep in engine programming.

I've just stumbled on this "Cross Platform Rendering library" as BGFX (https://github.com/bkaradzic/bgfx). Contrary to Irrlicht, it's not an engine at all, but handle the low level stuff for the rendering, you can support a lot of rendering backend from a single lib, including theses ones, DirectX (up to DX12), OpenGL (3.x), Metal, GLES (3.x), and Vulkan.

I was wondering if somebody with low level engine programming experience could "plug" this inside a driver inside Irrlicht? (Like BGFX driver with backend selection (if available)).

Since there are few developers on Irrlicht, this should give a temporary solution to implement new rendering technologies into Irrlicht, before devs, are implementing their native solution. (Vulkan, metal, DX12, GL 3.x etc.) For I, this is too low level for me. If I would be able to do it myself, I would have proposed it instead. I know there is still work on FVF and other improvement to the engine...

I would love seeing this in Irrlicht if this were to be implemented...

On another note, I was also looking to have components into Irrlicht but found out that is was already done! It's just named differently: Animators! With them you can add features to any node not just animate them. It was there since a long time and just figured this recently. This should be added in the list of the current features of Irrlicht! It would not do everything that components could do but almost all.
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Implementing BGFX as a driver...

Post by Mel »

It would be as easy, or as hard, as grabbing your IVideoDriver and related interfaces (IGPU, ITexture, IMaterialRenderer and so on...) and implementing each of the required methods to work over that API and compile it into Irrlicht, if everything goes fine, your only concern should be BGFX being well written.

But i wouldn't recomend it with the new Low Level APIs (DX12, VULKAN and METAL) Their working philosophy is radically diferent from the old ones, so unifiying their utility under a single frontend feels like you're dropping some of their advantages.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
AReichl
Posts: 268
Joined: Wed Jul 13, 2011 2:34 pm

Re: Implementing BGFX as a driver...

Post by AReichl »

Hi christianclavet, my question is out of topic, but ...

I saw you on the Urho3D forum, so you have some experience with it ( i only compiled the library and samples and played around with the scripts a little bit ).
Let's ignore the rendering features for now ( Irrlicht will have more features in the future ) - what about CREATING a agame with Urho3D or Irrlicht. Is Urho3D
THAT much more powerfull ( e.g. the scenegraph, nodes, components, build-in event handling, ... ) that it's worth investing the time to learn everything, or
would it be easier to take Irrlicht, IrrKlang, IrrBullet and so on and combine everything the ways you need it ( good C++ programming knowledge assumed ).

I ask because i am still looking for a way to implement my visionary space game. I need my own coordinate system ( found no way to do it in Urho3D or Unity
but relatively easy in Irrlicht ), my own physics ( same here ) and so on.
I am not so much interested in a "detailed" answer but more in your "feeling" about other engines compared to Irrlicht.

With the animators you are right - components are a little overestimated and "overused".
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Re: Implementing BGFX as a driver...

Post by christianclavet »

Hi, AReichl!

I have about the same experience as you, I build it, and applied some feature patches to it (GUI system).

Urho 3D is much more powerful than Irrlicht, a strenght that might also be a weakness in certain cases. This lib is a complete game engine, sound, rendering, physic, gui, etc.
That might sound good and for some it is, but you have a ton of more things to check for and the sound/physic lib used might not the one you would have liked to use. Also this one is much harder to use than Irrlicht, checked the command set and I still feel really intimidated.

With Irrlicht, you can build your engine with the component you want. If the rendering tech could be improved, I'd be very happy.

Also their GUI system is kinda broken, if you plan to use a GUI in you project, it's preferable that you use an ADDON (Hopefully they have people that made them). Even if Irrlicht GUI is slow compared to others it's really easy to tweak, and I was able to create all the GUI I needed from the base classes without too much hassle.

For BGFX: I've read on the their site, that the renderers seem optimized for each but I don't know what kind of optimizations except that the rendering is using multi threading, and something about caching of batches and draw calls.

It might not as fast as a native solution, but we would gain the features much faster. The developer said he will use much of the stuff done on DX12 and will try to apply them to Vulkan.

Here is a thread about optimisation that I've seen there:
https://github.com/bkaradzic/bgfx/issues/650

Here is the thread about Vulkan:
https://github.com/bkaradzic/bgfx/issues/274
JFT90
Posts: 22
Joined: Sun Jan 03, 2016 6:53 pm

Re: Implementing BGFX as a driver...

Post by JFT90 »

Hi,

I am working on implementing Bgfx as a driver for Irrlicht at the moment.
I am orienting myself on the way the OpenglDriver (inheriting from the NullDriver) + the OpenGLMaterials are build up.
I wrote around 1/4 of the Driver until now - so still some way to go.

Anyone with some Bgfx experience here that wants to help speed up the process?
Irrlicht with bgfx-Driver https://gitlab.com/JFT/Irrlicht_extended (forked from Irrlicht trunk)
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Re: Implementing BGFX as a driver...

Post by christianclavet »

Wow! That's great. Sorry that I can't help, as it too low level for my current programming skills... Hope you can make it work!
JFT90
Posts: 22
Joined: Sun Jan 03, 2016 6:53 pm

Re: Implementing BGFX as a driver...

Post by JFT90 »

Most of the work is done - still missing some materials.
Image
Just need to write some shaderc code (bgfx shader code format - that can be converted to glsl,hlsl,etc.) and put it into headers.
Should be working soon - of course there will be some bugs here and there to fix.
Irrlicht with bgfx-Driver https://gitlab.com/JFT/Irrlicht_extended (forked from Irrlicht trunk)
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Re: Implementing BGFX as a driver...

Post by christianclavet »

Wow! Very cool! Thanks for reporting news about this! Where is the text coming from the Irrlicht gui or the GUI from BGFX?
JFT90
Posts: 22
Joined: Sun Jan 03, 2016 6:53 pm

Re: Implementing BGFX as a driver...

Post by JFT90 »

The text is coming from BGFX. It's part of BGFX's Debug Features:https://bkaradzic.github.io/bgfx/bgfx.h ... E8uint32_t . I decided to turn it on when you compile Irrlicht in Debug mode.
Irrlicht with bgfx-Driver https://gitlab.com/JFT/Irrlicht_extended (forked from Irrlicht trunk)
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Implementing BGFX as a driver...

Post by Mel »

Looks like the abstraction of BGFX is paying its toll! XD
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
JFT90
Posts: 22
Joined: Sun Jan 03, 2016 6:53 pm

Re: Implementing BGFX as a driver...

Post by JFT90 »

Well, I didn't really look at the fps when I finally got the bgfx driver to start.
Also it was also all build in debug and I think buffers were filled and submitted for rendering with invalid shader handles (bgfx catches those - but it costs ^^)
Its all better now!
I've made some progress - Sydney is finally able to show her face with Bgfx :)

So here She is with BGFX:
Image
Comparison with OpenGL:
Image

HardwareMapping was set to Dynamic for the vertices.
Irrlicht with bgfx-Driver https://gitlab.com/JFT/Irrlicht_extended (forked from Irrlicht trunk)
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Re: Implementing BGFX as a driver...

Post by christianclavet »

Wow! Nice work!
JFT90
Posts: 22
Joined: Sun Jan 03, 2016 6:53 pm

Re: Implementing BGFX as a driver...

Post by JFT90 »

Most of the parts needed for our project are working now with bgfx
You can have a look at the bgfx branch of our irrlicht-fork here
https://gitlab.com/JFT/Irrlicht_extended/tree/bgfx
On Linux you can try to compile by running

Code: Select all

sh make-release.sh
inside the main folder.

We didn't implement all the materials/default lighting stuff inside the bgfx-driver
since it is better to handle that if needed with own shaders in a specific project --> use shader materials!
Only materials we implemented until now are Solid and Onetextureblend ( CEGUI needs it^^ )

Next we are cleaning up the code, running shaderc on windows to add the hlsl version of the materials and then the driver should be usable.
Irrlicht with bgfx-Driver https://gitlab.com/JFT/Irrlicht_extended (forked from Irrlicht trunk)
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Re: Implementing BGFX as a driver...

Post by christianclavet »

Hi!

Thanks for posting the repo address!
since it is better to handle that if needed with own shaders in a specific project --> use shader materials!
If we use a shader inside this version of Irrlicht inside a BGFX, will it be working, or miss some details? Have you made an example to launch the BGFX portion of this modified Irrlicht?
only materials we implemented until now are Solid and Onetextureblend ( CEGUI needs it^^ )
If you add CEGUI to the project will it be accessible by others? I would find it interesting to use a GUI more featured than Irrlicht for creating editors...

Thanks for posting this!
Post Reply