PDA

View Full Version : Data from binary file ?


romm
12-20-08, 05:54 AM
Hi all
I would like to :
1. read bytes from a binary file
2. Convert every 4 bytes to a floats
3. Displace Tool in Zbrush using floats

Some pointers , as to how to achieve this in ZScript would be grand

I would like to create a data pipeline between Vue,GameEngine & ZBrush

marcus_civis
12-22-08, 04:24 AM
You can use the [MemRead] command to read from a memory block, after first creating the block from the file using [MemCreateFromFile]. If you were reading char, you could then put these together using [StrMerge]. That would give you a string that represented your float. In zscript the only numerical data type in float so there would be no need to do more than evaluate the string using [Val].

As for 'displacing the tool in ZBrush', you are limited in zscript to using the interface buttons or sliders, for example in the Tool>Deformation submenu.

romm
12-22-08, 04:32 AM
Many thanx for this info.

To work around the displacement limitations, can I
Create an obj in memory and then use it as a Tool ?

romm
12-22-08, 04:43 AM
Also, just to clarify

I would like to keep the file/pipe binary and not use chars to represent floats
Is this viable?
If not, I may well just export an obj from Vue, which I would rather avoid.

marcus_civis
12-22-08, 06:28 AM
You can't transfer data from a memory block directly to ZBrush. If you had an OBJ in memory you'd have to write out a file and then import that into ZBrush using the standard import. That's slow using zscript - it would be better to write a dll.

If you are using [MemRead] then you are restricted to the [basically C++] data types as indicated in the Command Reference. I mentioned char because that's the only one that occupies a single byte. See here: http://www.zbrush.info/docs/index.php/ZScript_Command_Reference#Memory_Blocks

romm
07-06-09, 07:51 PM
Hey marcus
I have noticed that there is a GOZ binary IO in 3.2
Are you aware of the layout of the data, so I can begin hacking ?
Are the new updates to ZBSCRIPT ?

marcus_civis
07-06-09, 11:34 PM
Hi romm,

There will be an SDK for GoZ released in due course so you'll need to wait for that.

romm
07-07-09, 04:50 AM
thanx marcus,
how about a heads up on the byte layout of the myfile.GoZ file export option
I need to get into this with C# BinaryReader and BinaryWriter.
If i could get this, I it will save me counting bytes in my HexEditor.

romm
07-24-09, 01:07 AM
"/Applications/ZBrushOSX 3.2/ZStartup/ExportTamplates"

does the trick

romm
01-04-10, 10:49 AM
public static byte[] pntsTag = HexUtil.GetBytes("11270000");// PNTS tag
public static byte[] plyTag = HexUtil.GetBytes("214E0000");// POLY tag
public static byte[] uvTag = HexUtil.GetBytes("A9610000"); // UV tag

PS : howz that GoZ SDK comming along ?

or please gimme more hex tags if there are.

for FULL ON Zbrush to unity integration