ZBrushCentral

writing a mesh importer ?

I wrote a silo binary/ascii parser/generator lib in c++.
Is it possible to write a plugin for zbrush ?
Is there any basic sample code for importing a mesh ?

to the best of my knowledge we are still waiting for an sdk.

you could write a plugin with the zscript language but not like you are thinking so far…as far as i know…i don’t think much has been mentioned about this for z3

  • could you show a very simple polygon creation example ?
  • I’d still need to get the data from my lib but i read that this could be done through a dll
  • could displacement be created from file as well ?

well i don’t think you can do yet what you want…but somewhere here i do have some links to some threads you might find helpful or at least interesting and might answer your questions better…i don’t have time tonight as i gotta sleep once in a while…they tell me i do anyways…so will try to get them to you tomorrow…yell at me if i don’t to remind me.

Without access to the API, which is not public, there’s little you can do. Mostly the zscript language provides a way to automate ZBrush tasks. With specially written dlls you can extend that somewhat but there’s no access to mesh data (at least, not much) within zscripting. It is possible to generate displacement maps through zscripting but again the possibilities are limited.

If you’ve an idea which you really want to try out then there’s no harm in writing to Pixologic. But it might be worth waiting until they have released the update to Z3, after which they will perhaps have a little more time to consider your request.

HTH,

While looking at this sample dll code
http://www.zbrushcentral.com/zbc/showpost.php?p=269869&postcount=14
I was thinking mi could pass my c++ file parser / generator mesh data in memory to zscript variables creating polygons (but i don’t know if we can create polygons from zscripts ?)

Well take a look at the ZScript command reference and see if you can find a way:
http://www.zbrushcentral.com/zbc/showthread.php?t=23549

thanks,
according to this, it looks like zscript doesn’t provide a command to create polygons…

Yup, exactly.

This would be great plugin if possible. It would alleviate the problems many
are having with importing and exporting to other programs. It would be good if Pixologic would allow for a plugin like this. Many people I know want to use Zbrush for Rapid Prototyping and the main format is STL.
not.OBJ.

Since the obj exporter is standard in all 3D apps there should be no reason
why Pixologic would not open up a plugin for this. Good luck hope something comes of your idea. I think it is a great idea.

What file format do you want to import from.

I think this is possible, but only for windows based machines. Or anything that could run a .dll. Here is how I would suggest doing it. Use a script to call your C++ dll. You need to pass it the name of the file you want to import (or you could have your dll call a common file dialog within itself), and maybe some memory flag that the script checks in an endless loop. Then your lib would import the meshToBeImported and do its fancy stuff. You could then write out a temp .OBJ file and set the scripts memory flag to completed (passing it the name of the file if it doesn't know it yet). Then have the script finish by importing the OBJmesh into ZBrush. I havn't tried calling Dll's with Z3 yet, hopefully it still works. If you have any questions give me a shout. I have used DLL's with zbrush for quite a while now and it works very nicely. The most difficult part is dynamically setting up all the memory in the ZScript, and the loop. There is no infinite loop in ZBrush if I remember correctly. But you can check the loop and go into another and another and so on. For something so simple as an importer it won't matter too much, when it matters is when there are GUI's and long calculations that may take a while ( you don't want the script to finish and dump the dll before it is completed). Anyways, Good Luck Chris Reid

If I get some time I could write up a sample .lwo importer as proof of concept. Or if you have the dll code already, we could work on it together. Shouldn’t be to bad.

hello chris,
that’s interesting , my lib could indeed write atemp obj, but silo can also export objs…so that’s not really an advantage.
The point of this plugin would be to send the base mesh together with hierarchical 3d displacement data directly from the native silo binary file format to zbrush.
But considering the zscript commands limitations it looks like it’s not possible.
There is another possibility : hack the ztl format (that’s what i did with the sib format)… and add a ztl i|o to my lib.
I’l have a look to see if a basic mesh could be parsed easily.

I hope pixologic want to provide open pipeline tools in the future…

No matter how you do it, you are going to have to convert silo data into zbrush readable data. For now that leaves obj, tiff, psd. If you need displacement data also , you could use tifflib to write out your displacment data and obj for your mesh data. As for hierarchical 3d displacement that will be a bit tricky( depending on how silo does it ).
If you figure out anything with the ztl please share it with us. It would be nice to have read/write capabilities for this data. The tricky things with rebuilding the displacement data is knowing how the zintensity for silo and zbrush relate. I have some interesting super hack methods too, but they could have memory issues depending on the size and subLevel of the obj. Wish I was more familiar with silo and its format… I could be of more help…until then… good luck.

Chris