Discussion: OpenGL/GLSL and BGE

I have recently been making some mods for Minecraft and learned that I could make OpenGL shaders (GLSL) for it. It uses OpenGL 3.1, so I learned some OpenGL and made some GLSL shaders and it looks fantastic. Blender is still stuck with OpenGL 2.1 and it looks terrible in most cases. The only ways to make it look better is to fake certain things, and the performance is horrific on AMD/ATI graphic cards with some shaders (or at least in my experience). The Harmony project has been doing a fine job trying to make the game engine better regarding shaders and especially lighting and shadows, but why not just change the entire render engine? It would be a tough job, but the results would be incredible and the future of blender’s game engine would be phenomenal. Imagine an OpenGL 4.1 Blender 3D: It would give UDK and Unity a run for their money.

Is Blender ever going to move out of the “prehistoric OpenGL” ages?

BTW: I know that graphics don’t mean everything to a game, and I completely agree, gameplay is far more importand, but would you rather have a game with ok graphics and great gameplay, or a game with photo-realistic graphics and great gameplay?
Same thing applies to Blender: vast possibilities, but limited by OpenGL 2.1’s graphics.

My choice: ok graphics and great gameplay

I prefer to spend my time at gameplay and usability rather than ages on so-called “photo-realistic” graphics. You have to keep in mind you need to make EVERYTHING like that.

It is really hard to make virtual objects look like that. You need an awful lot of time just for one object. Now multiply that with the amount of objects in your game.

Making the games environment looking like covered by shiny slime or hiding design mistakes with a bloom shader creates no photo-realistic image. More worse if most of the game is poorly designed while a small part looks like captured from a commercial add.

Better create something new or something abstract. Be an artist.
Let the game companies spend their time and money on “realistic looking” environment. They have the resources to do so. You can be entertained by the finished game.

For a “photo-realistic” look I can do a walk outside. No game can beat that look ;).

Just my opinion

BTW: I do not even have GLSL support. I’m not disturbed by that :smiley:

@Monster
Your points here certainly hold true. In most cases, the liklihood is that no-one will likely reach the point of having a completed game. However, Should we avoid life insurance because we believe we are unlikely to die under eligibility?
I think the BGE needs a serious overhaul, but it looks to be nearing the point whereby it loses its identity as the BGE because it would be so different (though by keeping a similar api that’s not so true).

You don’t use GLSL shading?! In most games, it is important to focus on the gameplay, for that is as much a part of the game as the graphics. But why do people enjoy and buy new games? Their stories and gameplay often don’t change, such as Modern Warfare series, but their graphics do. Graphics are arguably of equal importance to gameplay.
Without GLSL shading, you have a more limited scope for development in visual effects, so you’re more likely to focus on gameplay. however, at the end of the day, the game is more limited graphically. I love GLSL, i don’t find it that limited, with an exception of reflection maps. But in all, I think the entire community has to understand the interactions and trade-offs between Visuals and Gameplay dynamics.

However:
@Hamstaq
OpenGL doesn’t make graphics better. Bad texturing is still bad, and good texturing doesn’t change.
OpenGL standards typically do two things:
1)Add more features
2)Improve existing features

However, by improving features you may improve performance… Which is beneficial. In general, the BGE needs to look closer at how the rendering stage is completed, rather than how rendering itself is done (e.g object batching).
Work needs to be done, but it will extend far beyond just the OpenGL version. At some stage, i probably will devise a post which will be used as the home for GE overhauling, if ever undertaken by someone other than myself.

To me, there’s more issues than OpenGL rendering that’s holding the BGE back from giving the UDK and Unity a run for their money. Mainly, controlling the number of render batches as well as faster bone-animated armature playback (though I’m not experienced on this, and Moguri already did work on this front).

However, it seems to me that the BGE’s already somewhat poised to be a better engine, what with mokazon and martinsh’s Candy Branch combined with Moguri and Kupoman’s Harmony Branch being actively worked on, combined with the ease of use of the BGE itself.

The issues that you raise are true, though - a later OpenGL version would give more functionality. However, even if the BGE used OpenGL 4.1, the core functionality of using these new features would still need to be added in, so upgrading to a later OpenGL wouldn’t do anything out of the box (but I don’t know much about this subject). It would still require developers to actually add in the new features and make them work well with the BGE. Maybe it’d pay off in the long run, but it’s not as if the BGE’s completely outdated as of now.

EDIT: I think that GameKit’s model could be a good path for the BGE - a standalone game engine that’s not a modeler that works with blend files. The upside is that any and all work is done on only the game engine, so commits happen much faster and the engine gets upgraded much more quickly. Also, there’s no work done that could harm the BGE in any way, unlike how developers can mess up the BGE by changing Blender (unintentionally, of course).

However, this separate program would segment the workflow between modeling and game-creating much more and make it more difficult to deal with, essentially turning the BGE into just a normal game engine, which isn’t good at all.

I think that the BGE should stay where it is in relation to Blender, but it needs to be more actively worked on and maintained. The only thing that can really pull people to want to work more on the BGE would be to see more commercial and interesting games made with the BGE, really.

As already mentioned, simply switching the BGE over to OpenGL 3.x or 4.x would not instantly make games better. The newer versions of OpenGL might have some features that can make games run faster on video cards that support them, but in general, the OpenGL version does not necessarily indicate the graphics quality of a game. The biggest contributing factor to how nice a game looks is the talent of the artists working on the game, not the engine itself.

Furthermore, rewriting the rasterizer to use OpenGL 4.x core, would mean rewriting a lot of code, including the GLSL material generation provided by Blender. Also, having an OpenGL 4 rasterizer would mean only people with shader model 5 cards could use the BGE, which would be the same as having an engine that supports only DirectX 11 hardware. Seeing as we can’t even guarantee users are using at least OpenGL 2 compatible software, OpenGL 4 would severely limit the BGE’s audience.

And one last thing, a lot of core functionality found in OpenGL versions can be found as extensions in earlier versions, so you don’t necessarily need to be running an OpenGL 3 rasterizer in order to take advantage of some OpenGL 3 features. :wink:

Cheers,
Moguri

As people have been saying, the OpenGL version actually means very little. Most of the features of new OpenGL versions have been available as extensions before they were made “core”. Therefore, rather then simply saying we need to use a higher (and less supported) version of OpenGL), it would be more beneficial to provide specific examples of deficiency in the BGE.

EDIT: Looks like Moguri beat me to the post :stuck_out_tongue:

Ah, you beat me to it. :slight_smile:

*EDIT - Kupoman too … I should really check for new posts before submitting.

Exactly.

We should avoid life insurance in general, because there are better ways to plan for financially stressful eventualities.

Also, beyond that narrow focus, we should probably try to address the inefficiencies in our overall social structure, where families are in such precocious financial conditions, and the death of one individual can have utterly devastating effects on their family.

One must always ask: “Why do I need this?” and “Is my need a symptom of a greater problem that needs to be solved?”.

Haha, Goran, i love how you took my analogy and focused the entireity of your response upon it :slight_smile:
A better analogy would be this;
Should we not build buildings to be earthquake proof because there hasn’t been an earthquake in living memory…?

We should do a survey to establish the overall geological stability of the given area.

If the area is geologically stable, then there is no need to waste effort and materials on reinforcing simple structures to withstand a 9.0 on the Richter scale.

… You want to try a different analogy? :slight_smile:

Haha, indeed i would, but i’m too tired to do so at present :wink:
what i mean to say in english is that just because few people do so, having extra performance and features to allow complex games is only a bonus, and should be striven for.

what needs to happen, before anything else, is we need to get a dedicated team of developers for the BGE, and have them improve the current game engine as is some, and one it’s in a good place, we can start looking towards the future.

The current OpenGl is fine,and the artists can create graphics that looks just like comercial games but that means low performance.
The problem is the actuall render system that won’t allow us to use multiple lights and dynamic shadows ,which really it would increase graphics quality a lot.
A large variety of 2d filters are available and they look pretty fine but only if we use a small number of samples which decreases quality,and still slow on older GPU’s.
But as we all know, Stokes are working on a new render system that would change then way we set up lighting in our games.

This is an example of old game graphics. Directx7 and not using shaders. I still think its great.


Visit my site for more images.

Gameplay is the most important in making game.

You have all proven valid points, but OpenGL 3.1 vs 2.1 has some differences. That was the time ATI and Nvidia’s graphics technology started to grow into what it is today (Nvidia GeForce 8xxx series cards). OpenGL 2.1 is quite a terrible game engine, and yes good graphics can be achieved. The problem is performance and the capabilities.
OpenGL 1.0 - Equivalent of DirectX 6/7 - Low graphics, designed for 32MB graphics or greater
OpenGL 2.0 - Equivalent of DirectX 8 - Low graphics, designed for 128MB graphics or greater
OpenGL 3.0 - Equivalent of DirectX 9 - Good graphics, designed for 256MB graphics or greater
OpenGL 4.0 - Equivalent of DirectX 11 - Great graphics, designed for 512MB graphics or greater (though 1GB is recommended)

Each new version of the graphics requires more resources for better graphics technology. Maybe OpenGL 3.1 should be an option so that lower-end users could still use OGl 2.1?

I’m going to look into the Blender Source and see if I can change the engine’s rasterizer a bit and see what the results are.

Hmm,well yeah. OpenGL would do the job,but the problem is the entire Blender. This could be done only if we would have devs AND if we would separate the GameEngine from Blender,because a newer open gl would change blender core,and since not everyone has opengl 3 bad things could happen. BUT as you said, having two versions would be great.

Again, simply changing the OpenGL version makes no difference (I’ve run the BGE with an OpenGL 4.2 compatibility profile before). You have to actually take advantage of the new features offered in those profiles, which can be done a lot of times through extensions. Is there a specific OpenGL 3.x or 4.x feature you have in mind that you want to take advantage of?

If you want to do some BGE development, I’m certainly not going to stop you. In fact, if you need some help, drop by either the #blendercoders, #gameblender, or #bgecoders IRC channel on freenode and ask me questions (I use the nick Moguri there too) if you have them.

EDIT:
Also, where did you get your information on how OpenGL versions stack up to DirectX versions and their intended purpose? I’m pretty sure there are some inaccuracies. For one, I’m pretty sure OpenGL 2.1 has feature parity with Direct 3D 9, and OpenGL 3 with Direct3D 10.

@BlendingBGE: I completely agree, but perhaps it could actually be better to move the BGE (to have a “Game Engine” version and a “Render Version”). In game development with the BGE, there are so many features in the way of the game engine that are only for the BI render (such as simulations and particles) that it might actually be easier to develop as just a game engine rather than a game engine and render engine, and then could be combined every so often into one program (like harmony will hopefully merge with 2.63 or 2.64).

@Moguri: I completely intend to use the features that newer OpenGL versions support/enable (Much better GLSL). I got the information on how they “stack up” from tons of sources. Yes, OpenGL 2.1 has some of features of D3D9, but not enough to be classed as a “parity”; same with D3D10 (though they are pretty similar in some, perhaps most, areas). Also, where can I find that version of Blender with OpenGL 4.2 compatibility?

All I did was create an OpenGL 4.2 compatibility context, so it didn’t really do anything different. And again, what features in particular do you want to implement? Before adding on too many new features, we really need to address some core issues with the current rasterizer, such as it being single threaded, and pretty poor at batches.

Plus, @Hamstaq:
It’s a good idea, to move the GE to separate it, but there are problems;
At the moment, the GE shares a lot of code with the Blender core.
If you were to separate it there would be two problems:
1)It would require you to provide it with the dependencies (just adding more code)
2)It would become separate from Blender

the second point is the most significant.
Once you remove it from blender, there is no inter-compatibility; if one thing changes in Blender, it breaks the Game Engine. in addition, the game engine as an engine is nothing speicial. It’s weaker than most of it’s counterparts or comparatives.
However, it is great due to its ties with Blender, once it is removed it is weak.

My opinion is that we first need to optimize what we already have,because…well there are a few (more) things to optimize , and after that we can start thinking on newer versions.
With the current BGE we can achieve ‘commercial’ results,but the PERFORMANCE is the problem, so optimizing what we have first and after that newer features.
Just wait for Inferred Lighting, a scene with more than 3 lamps,realtime-soft shadows,and fast 2D filters would look like UDK.