consider bgfx as a renderer backend #1699
chriscamacho
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
@chriscamacho I've been following Also, one of the thinks I like most from |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've been looking at bgfx for use in my own projects, and have come to the conclusion that its actually could be a great fit for raylib.
First its important to understand what bgfx isn't!
its not an engine nor even a lightweight framework. it is solely a render and in the way it abstracts the different render libraries (vulkan, gl, metal, android etc) it can be thought of as a rlgl on steroids. There is not even anyway to load a "mesh" into bgfx - that code is in the example glue and would frankly be better implemented as part of raylib.
bgfx does have a geometry "compiler" that makes a binary file suitable for use by the example code... (this allows for loading of wavefront OBJ files or GLB/TF meshes) looking at the way the compiler works adding additional formats to bgfx's render buffers shouldn't be onerous !
bgfx maintains an auto generated C API making it ideal for use with Raylib
it is possible to build in "amalgamated" mode where just one cpp file needs to be included in your project. Equally it can be built and then statically linked. In either case it does mean that libstdc++ needs to be linked.
This is the only "philosophical" issue I can see, while just like glfw its a dependency, it happens to be a C++ library. But that said it can be happily used from C99 (see https://bedroomcoders.co.uk/using-bgfx-from-c/ )
Before dismissing this out of hand either because its C++ or somehow a dependency, I would strongly urge anyone to try the C examples and see just how simple and powerful it is.
You have all the advantages of an active GLFW window - input etcetera (or any other type of window if you can access native handles) coupled with a very powerful renderer isolating you completely from Vulkan or whatever your backend of choice.
I'd say this is a great and powerful way to bring Raylib to a whole set of modern backends like metal and vulkan, and one that won't really effect the end user. I would have thought that you could either replace rlgl as the renderer or even have bgfx as a backend to rlgl. Either way the changes needed would be entirely transparent to the end user.
Oh speaking of transparency, HDR, PBR, alpha sorting, multiple shadow types you have to see the bgfx examples https://bkaradzic.github.io/bgfx/examples.html but actually running on your hardware
I recommend looking at these samples on a laptop, my 6 year old integrated graphics machine was able to cope quite handsomely with the examples, showing that bgfx isn't just a heavy height renderer suitable only for powerful desktops. I was simply delighted at how well they run!
Additionally there is a real opportunity to make a cross platform material / shader library that can include a number of "effects" like PBR (with or without reflection map) shadows etc, that an end user will be able to utilise without in depth knowledge of the minutia of such effects. Imagine if the end user could simply apply a PBR / shadow volume material to their loaded model...
Beta Was this translation helpful? Give feedback.
All reactions