ZBrushCentral

Terrain map plugin help

I’ve been working on a terrain system that use a texture that contains the height + normals in a single texture by packing the data together to save memory. Our artist wants to be able to streamline the process of creating the texture through ZBrush if possible.

So I’ve been trying to write a plugin that would generate the texture from the canvas. The interface stuff has been easy, and retrieving the data from the canvas should be easy too through the PixolPick function, but I’ve hit a roadblock when it comes to writing the data to a texture and then exporting. I’ve looked through the forums and I haven’t been able to find an example of data being written to a texture and then being exported.

If anyone has an example of this, or even a snippet of code or an explanation of how it can be done, I would really be grateful, thanks.

You’ll have to explain a bit more of what you are trying to do. Pixol Pick is fine for some stuff but will be slow if you are trying to cover the whole canvas. Why can’t you use the MRGBZGrabber tool and then combine the alpha [depth] and texture outside of ZBrush or through a DLL?

Basically I’m trying to read the normal and height data, compress the values, and write that out to a texture. Basically it’s to avoid having to compress the texture maps together at runtime.

I hadn’t seen the MRGBZGrabber tool. I just saw the PixolPick function in the reference and saw that it could get the information I needed, didn’t know it would be so slow. How would the dll work? Is there an example of one somewhere that I can look at?

When I said dll I was simply meaning that you create a DLL with the functions you need that can then be called from within zscript using the FileExecute command. It will be much quicker writing binary data that way (though you can do it in zscript using the various Mem commands). But either way I still think you will run into problems if you use Pixol Pick intensively. If you can use the height and color data from exported images after using the MRGBZGrabber I think you’ll find it easier.

Ok cool thanks. Is there a way that I can get the height and color data from MRGBZGrabber directly? Or do I have to save the files and then open them in the DLL?

You’ll have to export the maps. The alpha created will be 16bit. As presumably you’ll need the height map as 8bit the simplest way of converting is to use the Alpha:Make Tx button and export the result from the Texture palette.