kivy for 3d rendering

488 views
Skip to first unread message

Camille Viot

unread,
Aug 17, 2014, 1:49:56 PM8/17/14
to kivy-...@googlegroups.com
Hi,

I'm playing with kivy to do some 3d stuff with open dynamics engine and assimp. Using the python bindings of those two libs I have successfully created a program that can use both. By the way, would it be easy to port those libs to other platform (windows, android & ios) ? I'm currently working under Ubuntu.

Anyway, I wonder how we are supposed to do 3d rendering inside kivy. I saw the 3d rendering sample but it is not enough to get me started. So my questions are :
1-Is there more documentation for 3d rendering inside kivy ?
2-What's the best way to manage a scene graph inside kivy ?
3-How do you set different shaders for different objects ?
4-How do you access shaders variables (uniform) from the python scripts ?

Especially for 4, I have loaded a model with assimp with a texture but for a reason that I don't understand my texture seems to be loaded on the texture unit 1 and not 0 and I am not able to change that behaviour.

Thanks,



Alexander Taylor

unread,
Aug 17, 2014, 4:25:06 PM8/17/14
to kivy-...@googlegroups.com
1) Not really, it's not part of core kivy (at least not right now) so although our backend supports it fine thre hasn't been  a focus on documenting it. There have been a few different people making avenues with it recently, so maybe there will be more direct support soon.

You could check out kskrypnik's kivy3 projlect on github (+ his other examples) for the beginnings of a 3d framework with kivy.

2) I don't know, the nskrypnik stuff is probably a good start for proper support.

3) If you want to work with the kivy api, each wRenderContext (or Fbo) can have its own shaders, and the graphics tree may be made up of multiple nested fbos. If you're doing something like replacing a widget canvas with a Rendercontext as some of our examples do, the answer is to have nested widgets with one per shader.

4) I don't know - if there's a normal opengl way, you probably want to call that (you can find kivy's bindings in the kivy graphics code). You can set the variables by simply indexing the RenderContext, e.g. rendercontex['someuniform'] = something'.

Camille Viot

unread,
Aug 18, 2014, 10:12:50 AM8/18/14
to kivy-...@googlegroups.com
Thanks for the answer.

I've looked at nskrypnik's projects but I didn't find any answer. Texture loading is managed by kivy and I have hard times finding out where each texture will end up (precisely, on what texture unit). Moreover, the way kivy manage its own shader doesn't seem to play well for 3d rendering.

For now, unless someone can show me an example of 3D scene with multiple meshes and multiple textures by mesh and where each mesh with has it own shader, I will go back to more basic stuff (raw opengl and python).

I hope we will get more advanced 3D stuff with kivy soon.


ZenCODE

unread,
Aug 19, 2014, 5:21:07 PM8/19/14
to kivy-...@googlegroups.com
Hi Camille

Has similar questions, and oly kindly posted and example here: http://bazaar.launchpad.net/~oly/python-examples/trunk/files/head:/python-examples/kivy/kivy_with_opengl_multi_mesh/

Hope that helps? ;-)
Reply all
Reply to author
Forward
0 new messages