Hello! I’m working on a tool that allows an end user to customize an HDA without ever opening Houdini and then export an FBX. Think Houdini Engine, but it could be used for a proprietary engine, Blender, or anything not supported by Houdini Engine. I have a video that shows this tool working: https://www.youtube.com/watch?v=AzM0sSMEtCg
The only problem is there is no way for the end user to see what they are doing. I’m trying to construct a 3D preview using OpenGL (because wxpython, the library I’m using to build the interface, has an OpenGL canvas) and pyassimp, but so far I have only hit roadblocks for drawing anything more complicated than a cube. Has anyone successfully created their own 3D viewport, esp. with python? Is there another way to go about this? Any information at all would be appreciated!
Also, if you have other suggestions I would love to hear them!
I’ve done some viewport stuff, but it’s been a long time.
Also … I hadn’t heard of pyassimp before. I will definitely be checking out that library.
Have you tried adapting the pyassimp viewer? It looks more full-featured than anything I’ve written. And the fact that they’re compiling OpenGL shaders leads me to believe that somebody tried to make it a bit performant. It may be worth unabashedly stealing from.
Thanks tfox! Unfortunately I have already checked out the 3D_viewer and I have been playing wack-a-mole with the errors I get from it. When I finally got it to run, it doesn’t draw the model at all, just the grid that the model should sit on. I have posted on the github about this but so far, no luck in getting a response.
Well, then let’s whack some moles! Viewports are definitely not easy.
Looking at that 3d_viewer.py code, I can see it’s relatively old (like not inheriting from object), so I very much wouldn’t expect it to be a drop-in solution.
So in this case, I suggest: Start simple and build up from there.
You said you’ve got some things like cubes loading … what kind of problems are you getting when you try to load something bigger? Memory issues? Speed issues? Python errors? Straight-up crashes?
I think that getting a viewport that draws anything more complicated than a cube (even if its stupidly slow and doesn’t animate) is step no. 1.
So another example.
Here’s my decade old, STUPIDLY simple viewport (It’s weird looking at code that old, knowing that I wrote it). It does little more than set up interaction, and call .draw() on the object I have loaded.
Then the object, and sub-object drawing code is called recursively to get something on screen.
It uses Qt instead of wxpython, but I’m guessing there will be enough overlap that it may be useful? Hopefully? It uses native openGL without any shaders, so it’ll probably be way too slow to do what you’re trying to do, but just getting something up on screen is a start.
Or maybe another more complicated viewport that may be worth looking at: