Can I edit an object mesh in BGE using python? it seems its possible using GLSL shaders; but i've no idea about that.

Please guide me or give me a example using GLSL.


  • It seems, the bmesh module is not accessible in BGE.

If you're certain you want to use GLSL, know that it doesn't read like other programming languages.

It's more like the programming language R, in that you can give it data, and it just does specified transformations for you; without what you would normally expect to be in a loop.

If I were to attempt it, I'd start with something easier, like Love2D

Then, once you have an understanding of how to write a GLSL shader,
export an InterQuakeModel from Blender, and use it with Love3D

That just seems like an easy playground to 'tink around with 'em.
After you know what you're doing, then put those GLSL scripts in BGE.

  • $\begingroup$ thanks for your complete answer. i just want to cut a sphere in BGE. and after some research realized that using geometry shaders will work; but that creates some kind of artifact and dont affects to physic engine. $\endgroup$ – Fadavi Dec 26 '17 at 17:13

GLSL isn't easy, especially if you have no idea about it.
It would be far easier to use Python to edit a mesh in Blender.


  • $\begingroup$ thanks again. bmesh module is usable/accessible is BGE? $\endgroup$ – Fadavi Dec 26 '17 at 17:15
  • $\begingroup$ BGE allows python scripts. You just have to import bmesh at the beginning of your script, like any other module you use. $\endgroup$ – Doyousketch2 Dec 26 '17 at 17:47
  • $\begingroup$ I know, but bmesh cannot handle BGE objects, and only support bpy objects (not sure, is it true?); If its possible, please give me code sample about using bmesh and bge together. thanks a lot. :) $\endgroup$ – Fadavi Dec 26 '17 at 18:26
  • $\begingroup$ Oh that could be. I may have read that half-a-doz years ago when bmesh was new. I assumed they could by now. I know bmesh makes a copy of the data, then you have to push back any changes to the original model. If they don't allow that in the BGE, then I'd pre-make a few variations of your model, then flip between 'em as needed. $\endgroup$ – Doyousketch2 Dec 26 '17 at 19:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.