ZBrushCentral

Question: XY, XZ, YZ, and XYZ symmetry

I’m trying to write a zscript that I thought would be fairly simple. I’m no programmer and I’ve never written a script like this before, but I think I could write it if I could just understand a few concepts and had the right commands. And yes, I’ve read the zscripting sections of the documentation. I also searched this forum and the zscript utilities forum.

I’d like to make 4 extra toggle switches in the transform palette [assuming it becomes a plugin] for what I’m calling compound symmetry. They would be labeled XY, XZ, YZ, and XYZ. With XY symmetry, the duplicate stroke would be mirrored across both the X and Y axes, with the Z values remaining identical to those of the manual stroke. With XYZ symmetry, every axis would be inverted on the duplicate stroke.

With normal symmetry activated on the X and Y axes for example, you would get 4 strokes at once [including your manual stroke]. With X, Y, and Z, you would get 8. But with only XY and XZ symmetry activated, you would get 3 strokes [including the manual one], and with XY, XZ, and YZ activated, you would get 4.

Now here’s the application that I had in mind for this script: I’m trying to sculpt a chain link, but it’s not just a square or oval shaped link. It’s a jewelry type of chain, sometimes called a curb chain.

If I could just sculpt the link the way I want, then I could make an insert mesh brush with a curve. The links might look symmetrical at first glance but they’re not symmetrical in terms of the vanilla features of zbrush. I could just take a ring primitive and sculpt away, but I would have to use XY, XZ, and YZ symmetry to do what I want to do. If you have suggestions for doing this perfectly without a script, I’m all ears. I could think of a few ways to do it, but they would be time-consuming and frustrating…

When zbrush is operating normally with a 3d mesh in edit mode, and you hover your cursor over a vertex, the XYZ coordinates of that vertex are automatically returned. This is obvious because I can see the coordinates in the upper left corner. How can I call up these coordinates in the zscript so that I can write the simple mathematical expressions? [I found the command to find the H, V coordinates of a stroke, but it seems to me that I need the XYZ coordinates.] What is the code for duplicating a brush stroke in real time [but with altered settings]? Is there anything else I’m missing?

I realize that for a good script writer, it might be easier to write the script yourself than to explain to me how to do it, and if you decide to do that, I would appreciate it very much. Also I’m sure it would get a lot of use from other people because there would be many applications for it. I also thought this seems like something that should exist already, but I looked around and couldn’t find it. But I have seen great models with these types of chains included…

Attachments

61CXZBoexML.UY395.jpg

There’s no way to do exactly what you want. It’s just not possible to directly sculpt the mesh through zscript, so that the movement of the cursor is replicated at some other point on the model. Indeed, it’s not even possible to get the coordinates of the point under the cursor, despite these being displayed in the NoteBar. ZScript has severe limitations in this regard.

The only way I can think of to get vaguely close to what you’re after is to use the ability to record Canavs strokes (see the Stroke>Inventory sub-palette). Basically it would work like this:

  1. A button starts recording Canvas strokes. Before recording actually starts the model’s transforms are stored.
  2. Recording is stopped.
  3. A button replays the recording. Before replay the model is restored to its original transforms and rotated the relevant amount so that the replayed strokes sculpt on the right part of the mesh for the required axis.

HTH,

marcus_civis:

There’s no way to do exactly what you want. It’s just not possible to directly sculpt the mesh through zscript, so that the movement of the cursor is replicated at some other point on the model. Indeed, it’s not even possible to get the coordinates of the point under the cursor, despite these being displayed in the NoteBar. ZScript has severe limitations in this regard.

Well poop. That’s too bad. But thank you so much for your help. See, now I’m glad I didn’t spend months getting really good at writing zscripts only to be no closer to the script I wanted.
I’m not giving up. I’ll try your suggested method if it’s my best option.

Although I can imagine uses for a script of the sort you want, in your particular example of a curb chain I’m not sure it wouldn’t be quicker to model by hand. I attach a quick example.

Attachments

CurbChainpic.jpg

Ok here’s what I came up with.
Rip chain1.jpg
I made a modified ring, rotated half of it 50 degrees on the x axis, rotated the whole thing -25 degrees on the x axis, flattened parts of it with the deformation sub palette, and then made an insert mesh curve brush with it. Piece of cake. You’re right- It’s very quick and easy this way. I just can’t really get crazy sculpting the link with compound symmetry at this stage as I described… Oh well. I’ll keep playing with it and I suppose it’ll serve my purposes for now.

Again, thanks a lot for your help.

Edit: Here’s a better process outlined for other newbies trying to make a chain like this:

  1. Sculpt your link from a ring primitive with symmetry enabled on the X, Y, and Z axes.
  2. Perform a ‘twist’ deformation on the Y axis.
  3. Perform ‘flatten’ deformations on the X and Z axes.
  4. Now make your insert mesh curve brush.

Looks great! And don’t give up on zscript. At some point I’m sure you’ll find it useful.

Oh my god I laughed out loud at myself…
I never considered using radial symmetry. I normally just use it for cylindrical shapes. But if you enable it and move the radialcount slider down to 2, then you get exactly what I wanted in the first place. :stuck_out_tongue: What’s interesting is that it works the same with any two axes or all three.

So this may have been a waste of a thread and peoples’ time, but if it’s in the proper place, the information may help others to get ideas for new techniques. Perhaps I will write about it in the main forum or the tutorials forum.
Here are my refined process steps for making a curb chain:


  1. Sculpt your link from a ring primitive with symmetry enabled on the X, Y, and Z axes. If you like, you may remesh it using whatever method you prefer, but keep symmetry enabled.
  2. Go to the Tool palette and perform a ‘Twist’ deformation on the Y axis. I turn it to -50 or lower. [I’ve noticed that all curb chains I’ve seen have the negative twist. It must be an industry standard or something.]
  3. Perform ‘Flatten’ deformations on the X and Z axes. Be sure that if you flatten to 40 on one axis, you also flatten to -40 on that same axis. Alternatively, instead of flattening on the X axis, you can orient your view to the XZ plane and use the ClipCurve brush to flatten the 4 corners.
  4. Enable radial symmetry, move the RadialCount slider to 2, and sculpt to your heart’s content. If you want to see how the chain will look with multiple links, go into Move mode, hold ctrl shift, and drag the white circle in the center of the transpose line to duplicate the subtool. The duplicate will be a new shape in the same subtool, with the same polygroups, but will be masked off with an invisible mask. This only works if you don’t have multiple subdivision levels. But you may also simply duplicate the subtool and manipulate it in Move mode.
  5. When the link looks the way you want it, now make your insert mesh curve brush. First orient your view so that you see the XY plane squarely, and click ‘Create InsertMesh’ in the Brush palette. Now in the Stroke palette, under the Curve menu, enable curve mode. Move the CurveStep slider to .55 or thereabouts. You’re ready to draw your chain using a curve. Don’t forget to save the tool and your new brush.