Page MenuHome

Integrate the gameengine with the depsgraph

Authored by Dalai Felinto (dfelinto) on Apr 29 2017, 2:39 AM.



This commit is not working entirely, the objects transformation is not taken into account.
Note: The BGE needs a lot of work to build with core profile. This commit is simply to have it use the new visibility control.

This is what D2623 tried to do.

Diff Detail

rB Blender
Build Status
Buildable 616
Build 616: arc lint + arc unit

Event Timeline


, all objects look to be in the center, without transformations applied to it.

Oh thanks very much @Dalai Felinto (dfelinto)! I close the other revision. Actually last time I tried to find why in GLSL texture mode, the matrix is incorrect but I didn't found the reason for now.

Porteries Tristan (panzergame) added inline comments.

Should we not use these two lines in any cases to convert all the scene even the one libloaded ?
Also is it normal to use the same depgraph for all the scenes in conversion ? (Indeed KX_BlenderSceneConverter is not per scene but shared, in UPBGE we replace it by KX_BlenderConverter and use KX_BlenderSceneConverter per scene).


Can we pass a visible bool argument to replace this check ? Currently it add the physics controller of hidden objects too.

About the problems with objects matrix in GLSL in textured mode, it's because of the modifs in gpu_shader_vertex.glsl. This: restores the object matrix in bge

About the problems with objects matrix in GLSL in textured mode, it's because of the modifs in gpu_shader_vertex.glsl. This: restores the object matrix in bge

Although this would technically work, it would be a step back into using core profile. What we need is to bind the matrices before drawing the BGE shaders (gpuBindMatrices). @Mike Erwin (merwin) would that be an one-line fix somewhere in the BGE code?

Hi, I spent some time to find a way to update matrices, but finally just something like that: (end of the patch in RAS_ListRasterizer) seems to work. Maybe there are some ways to makes it more elegant :P ... It was just to update bug report. Thanks @Dalai Felinto (dfelinto) for your advice about gpuBindMatrices and @Mike Erwin (merwin) for your comment about ShaderInterface on upbge github.

Ulysse Martin (youle) added a comment.EditedMay 6 2017, 2:00 PM

Restored lighting with a temp hack: (lines 143/144 -> In gpu_material_bind, there was a problem to update lamp because of that: if (!lamp->hide && (lamp->lay & viewlay)) .

@Porteries Tristan (panzergame) proposed:

"pass scene->layer in RAS_OpenGLLight"

I replied:

No because my fix fixes 2 things:

  1. gpu_material_bind
  2. Something in BlenderDataConversion:

if (blenderscene->lay & ob->lay)
to add the light to the scene lightlist.

@Porteries Tristan (panzergame) told me that this check (if (blenderscene->lay & ob->lay)) in BlenderDataConversion had been removed in UPBGE

hello, I tried to restore a part of layers system but I don't know if this is ok: . However I'm not 100% sure this is like that it has to work.

But I did 2 tests and it seems to ~work:

test file 1: a file created in 2.8:
test file 2: (a file which was created with BF blender 2.78) BUT the ground seems not enlightened

To make it work you have to apply the patch in my previous comment + the patch in the comment.

@Dalai Felinto (dfelinto): If you have a moment, can you tell me what do you think about that? Thanks!

restore overlay scenes and I guess background scenes too.

Complete patch: (for overlay scenes I just added :

blenderscene->depsgraph = m_depsgraph;
DEG_scene_relations_rebuild(m_maggie, blenderscene);

in ConvertScene)

Disable text drawing (3D and 2D) waiting for refactor, fix a crash, minor stuffs...

I noticed two things:

  • Crash at blenderplayer exit (I'll see later if this can be fixed)
  • bgl.glClipPlane disappeared from bgl module (So water demo from Martinsh doesn't work anymore. I don't know if this is deprecated thing)

Well, I think I won't continue the stuff further. There are some .blend which work, other not, but it's not necessarly because of something in gameengine folder.

With this stuff, we can see the main (But I surely forgot other important things) problems we'll have when we'll merge upbge (if BF is ok that we merge upbge).

If we could commit that, it would be cool to have a "reference commit" in blender2.8 git log. Like that, as I have now a set of files which work and that I ~know what works and what doesn't work, and if something is broken again, we could know that "at this reference commit", this was working and that after it was not working anymore. Thanks!

I add a note here. To make upbge merge easier, we'd maybe need to revert in a first time.
The patch here works in last blender2.8 when we revert this commit and build WITH_GL_PROFILE_COMPAT and WITH_LEGACY_OPENGL in cmake. 15/05/2017

@Jorge Bernal (lordloki), I forgot to add you as suscriber if you want to follow.

@everyone: We have a compilable 2.8 branch, but not fully working yet.