[Closed] [SDK] Is there any way to extract mesh drawn by RedrawViewsCallback?
Hi,
I’m currently working on a Simple Object2 C++ plugin. Without going into details it just generates some meshes.
The plugin will be commercial, but I also want to make a free demo, that’s why I want to draw the generated meshes using the GraphicsWindow::triangle() functions so that the user can see the mesh, but can’t render it and do anything with it except seeing it in the viewport.
Is it a safe solution? Is there no chance that someone using the demo can extract this mesh somehow?
You want to cheat … so leave the same chance for others to cheat too
Well… let’s be serious. The SimpleObject2 is a geometry plugin and has to return a TriMesh at least. It’s up to you what to return. And it will be the only mesh that others can get.
If it’s a simple plugin, you can noodle with the legacy display functions…but in reality what you’ll really want to do is implement the various Nitrous display methods, which allow you to send any arbitrary mesh to the GPU without exposing that same mesh to SimpleObject2 methods, collapse functions, rendering, etc.
The benefit of the Nitrous methods is that you can also instance your geometry. So you could display 100,000 teapots in realtime, because you only need to send 1 teapot to the GPU and a list of transforms.
Examples of how to do these things are in the SDK. It’s a mildly complicated process but once you get the hang of it, it will all make good sense.
try
MyObject::IsRenderable() { return FALSE; }
and
MyObject::ConvertToType(TimeValue t, Class_ID objtype) { return NULL; }
oh and
MyObject::CanConvertToType ( Class_ID obtype ) { return FALSE; }
What about SnapshotAsMesh called on such object? Or export the object to .obj for example and reimport?
it can’t be snapshotted as it can’t be converted to mesh. Like wise with any exporter it would need to convert it to a trimesh first before it’s exported. You could provide your own trimesh to your class on the off chance theres an export out there that directly gets the mesh from SimpleObject2 without calling ConvertToType first. But that is so unlikely.
Will it become convertible if someone curious enough just patch a couple of plugin dll bytes to something like this?
MyObject::CanConvertToType ( Class_ID obtype ) { return TRUE; }
that would just crash max as ConvertToType doesn’t return a valid object.
Couldn’t you just create a very basic plugin for testing and open a Challenge thread for those who may want to extract the mesh in question?
as I said above you have to override mesh property. all other methods are just ‘decoration’.
ConvertToType, GetRenderMesh… are all up to you what to return.
without your code it’s very unlikely that someone will be able to find your ‘real’ mesh. (but I don’t say it’s impossible )