Hi all, I am diving deeper into the MeshDrawer as a way to create an efficient method for drawing morphing geometry (i.e. a procedurally generated sphere that changes shape each frame). It seems like the most low level (and efficient?) way of drawing triangles to the screen. However, the tri() method lacks one essential thing: the ability to provide vertex or face normals. I can (and must) give vertex pos, color and uv’s, but the docs and source never seem to mention normals. The result on screen is unusable, of course, because lighting/shading is just about absent.
Does anyone have any suggestions? Like I said, it has to be fast, and MeshDrawer seems to be most efficient. What might be another approach? Loading everything in EggData? Use Geom object?
My recommendation would be to try and use the low-level methods to create procedural geometry instead of MeshDrawer. It’s not as “quick and dirty” as MeshDrawer of course, but if you can manage to get to grips with how it all works, the low-level stuff will give you the most power to do anything you want with your geometry.
If you find the complexity a bit intimidating, perhaps my proposed new geometry samples can help overcome your trepidation .
Once you get comfortable with the low-level geometry manipulation, then this post may also be quite useful to you.
Indeed; while I believe that MeshDrawer is efficient, it’s less the tool for quickly putting non-modelled geometry on the screen than the one for easily putting non-modelled geometry on the screen. It’s (very) useful for simple things like lasers, debugging displays, and so on–but for more-complex purposes it’s likely less effective than the methods linked-to by Epihaius above.
In a sense, one could say that MeshDrawer is to the above-linked geometry-generation tools much as OnscreenText is to TextNode: more convenient in many ways, but also less powerful in many ways.
Thank you so much, Epihaius, this is very helpful. Studying the MeshDrawer and Geometry classes had me thinking the latter was the way to go. Your links and samples confirm this and will help me grasp the matter for sure. Keep up the good work, for me seeing samples and playing around with them helps me understand the mechanics at hand most.
Hey Thaumaturge, I see your point and I think you are right… MeshDrawer is very good at a few things, but working with ‘real’ geometry asks for more than that. I will dig in!
I think i have a question pertinent to this thread. What i need to do is “voxelize” my objects, not because i’m using some sort of voxel based representation, but because i’m mapping 3D objects into a cartesion grid, i.e. discretizing them. Naturally the question is what’s the best way to do that ?
here’s what i think is a bad way to do that: generate nx x ny x nz cubes and let panda figure it out.
so i expect what i should do is figure out the surface represention of the voxels which represent, e.g. , a sphere, and then create my list of triangles and normals and use that to represent the object, whatever it may be.
when i was first looking through the documentation , i saw the procedural generation and figured that’s what i would want to do. however, now this thread says there is something called mesh drawer (which I hadn’t seen), and i’m thinking that would actually work too, especially since i am NOT going to be morphing objects, they will be static.
So looking for some advice so i get started with the right approach, especially if there might be a better way than either mesh drawer or prodedural generation.
ok. dumb question time. i’m trying to find your code in the tree with your pull request and i can’t seem to find them. i’ve looked for pretty much all of the files mentioned in your pull request, basic.py, advanced.py, medium.py and they don’t seem to be showing up in the tree.
I know they are in there, so obviously my github skills are terrible…
Here’s the exact link that takes you straight into the examples directory. I sure have a terrible time navigating github.
last, but not least, to actually get the code i had to download the zip file, using git clone did NOT pull in the procedural_geometry directory.
Yeah, it wasn’t very convenient to download the samples in this way, my apologies. You can now download the samples in a .zip file that I’ve attached to the first post of that topic.
thanks a lot ! no need for apologies. i really have a hard time with github.
for example it looked to me like your proposed changes had been accepted into the main tree, but when i did a git clone on the tree it wasn’t in there.
github is pretty confusing for those of us easily confused