I wonder how the sample code using VBO’s compares to the mesh rendering abilities of our moglmorpher()
function, as demonstrated in MorphDemo.m and MorphTextureDemo.m? While it is mostly intended for fast morphing between different meshes of identical topology, and that’s what those demos show, it can also render sets of single meshes via VBO’s, similar to what is demonstrated at a lower level in this demo, using VBO’s (subfunctions like ‘renderMesh’, ‘render’, ‘renderToDisplayList’, ‘renderRange’ etc.) and stuff for good performance, and various other goodies, e.g., ‘renderNormals’, ‘getVertexPositions’. In principle moglmorpher() should do this stuff in a convenient higher level way, although I think our demos only show the morphing stuff, not the general mesh rendering stuff, which only was used by lab internal code.
Another thing to point out wrt. complex scenery are our bindings to the Horde3D rendering engine. I think they weren’t heavily advertised, and are even only stored in my GitHub repo:
They do allow for way more convenient rendering of complex 3D scenes, with less low level control though, than what can be done by low level use of OpenGL or what PTB ships in terms of helpers. The nice thing about Horde3D is that it is a lightweight rendering engine used for video games and such. Not at the level of Godot, Unity, Unreal, etc., but still quite capable.
Your demo code also mentions that you use readOB()
from gptoolbox, because “…the LoadOBJFile included with Psychtoolbox fails to load many common .obj files.” - Is this also your experience if you set the optional preparse
parameter of LoadOBJFile(filename, debug, preparse)
to 0? preparse is 1 by default, which speeds up loading of suitable large OBJ files, but will fail on OBJ files which contain other than 3-component vertices, faces and texture coordinates. So preparse 0 should be slower but more robust against various OBJ’s.
In principle one could include readOBJ.m from gptoolbox and use it as a fallback for LoadOBJFile, given that gptoolbox is under a compatible MIT license which easily allows this, just by giving proper credit. LoadOBJFile btw. is an improved version of code originally contributed by William Harwin from University of Reading. It is a small world…