Question: Light setup

Hi ,
I have two questions to ask if they can be realized.

1.the current light all closed / reopen
2.in addition to the current light, the other open lights temporary closure/reopen

If possible, can you provide a little script tips.

thank you very much!:smiley:

I’m not clear as to what you mean by the light being “all closed/reopen”. What? Do you mean the Light palette itself?

Hi marcus,

I recorded a video to show the problems I have encountered.

Thank you very much.


Many thanks, I’ll try and find what’s going wrong.


Shadows problems

I checked out your macros. The Shadows problem - both the Save As dialog popping up and shadows not being turned on/off is to do with a typo in the macros. There is an ‘s’ missing at the end:

where you have

[IPress,Render:Render Properties:Shadow]

it should be

[IPress,Render:Render Properties:Shadows]

Lights problems

I think the solution here would be loading in files for the Lights or LightCaps. Save out ZLI and ZLD files and then load them as required. For example:

[IButton,???,“lightcap setup 01”,
//[IPress,2219]//don’t need this!
[IPress,PopUp:Texture 01]
[ISet,Render:BPR RenderPass:SPix,0]
[ISet,Render:Render Properties:Details,1]
[IUnPress,Render:Render Properties:Shadows] // hides background until BPR

Note that in the above macro, turning off Shadows in the last line means the background disappears until you do a BPR!!

And for Lights:

[IButton,???,“keylight on.”,

I think I’ve covered everything. If I’ve missed something, let me know.


Hi Marcus
Thank you very much for your reply, I have solved the problem of the shadow.

About lightcap,
My idea is to load the default panorama, then automatically switch to the image, then use it to generate HDRI lighting, it doesn’t seem to need this step, because I have been pre-generated Lightcap, I only need to load them…

Now I need to load Lightcap and panorama, it can automatically switch to this image, but at the moment I can only load but can not switch the image, the panorama is always my choice of the first.

About light,
According to your script, I can load light preset, which is to replace the current set of lights, but I hope that lights on / off, because I close other lights, only to open a light, I will only adjust the light effect, then open the other lights.

can I use the script to open the Lightbox panel and switch to the “ZLightCaps” folder so that I can see directly the effect I want to load.

PS:After the completion of these tools, I can make a case teaching video to show the ZBrush rendering and post process, hoping to help more people to use.

Although ZBrush rendering has some shortcomings, but most of the time, only I need to render a lot of reflection or transparent objects, I will use the keyshot, because the only time to keyshot show a strong advantage than ZBrush, otherwise either the rendering speed or accuracy, or set the material and environment of the time, it will be slower than zbrush.

Finally, thank you again for your help!!:lol:

Modify some parts, optimize the process

You can turn Lights on and off like this:

[IButton,???,“keylight on.”,

[If,[IGetFlags,1556]!=15,[IClick,1556]]//turn ON

[If,[IGetFlags,1557]==15,[IClick,1557]]//turn OFF

[If,[IGetFlags,1558]==15,[IClick,1558]]//turn OFF

[If,[IGetFlags,1559]==15,[IClick,1559]]//turn OFF


Hi, Marcus.
This is the final version,
I also provide a custom UI - QRender
Now it’s very practical.
Thank you very much for your help!

Great! :+1: And glad I could help.

Hi Marcus
I have corrected the error in the script again,and added several function buttons.

PS:About “3-object ID” script, I find that if I use the render pass to output image, the image without the application of anti aliasing, I changed the document output there is no problem, I don’t know why.

About color pass,
Whether I can direct rendering a no shade image, like flat mode.
Due to the software cannot be antialiased rendering in flat mode , so I need to fill flatcolor material for all visible model , and then use the BPR render.

It will abandon the previous material.
Can I use the script to calculate this result?

Thank you very much~

PS:About render pass, I find that if I use the render pass to output image, the image without the application of anti aliasing,
for example depth,sss,shade,shadow,ao,Only mask pass no problem…:cry:

Do you mean where the model meets the background? That is deliberate because you don’t want the background color mixed with the model edge. As you will presumably be compositing the passes with your own background and using the mask.

I’ve not had a chance to look at your other questions. I’ll try to tomorrow or Friday.

I had a few days ago to search for the problem of anti aliasing, I have understood its principle, so this is not a problem.:wink:

Now I have two questions:

  1. About color and pass ID, if I can directly generate them with the script, without changing the current state of the model, such as color and material,

Now I can use script to generate color and ID pass, but it will certainly change the state of the model.

  1. I want to know if I can use the script to the environment texture (Light 》background palette) button switch the image I have loaded.

This is the latest version of the script. I made a lot of changes.

I am about to complete the rendering of the video, but I speak English is not very good, the audience needs to use the subtitle function youtube to understand what I said.

  1. If you want to change the model’s color and material temporarily then you can just turn off Tool>Polypaint>Colorize. That will mean that the model takes on the selected color & material:

[ISet,Tool:Polypaint:Colorize,0]//turns it off
[IPress,Material:Flat Color]

  1. You can add a background image like this:

[VarSet,txtrFile,“ZBRUSH_ZTextures\Panoramas\pixologic_bourran1.jpg”]//path to file you want to load
[VarSet,txtrName,[FileNameExtract,[FileNameResolvePath,txtrFile],2]]//gets the name of the file only


Hey, Marcus
Thank you very much for your reply.

On the first question, I actually want to use the code in the software to calculate the internal image, but I do not want to change the current model file, now I hope that use the code will inevitably change the model state, such as the material has been applied to the model, but I can now use another method to restore the texture and material effects on the model.

On the second question, I applied this script, ZBrush can not start, there should be a script error.:stuck_out_tongue:

PS:This is my teaching video page.


I’m sorry, that was just a code snippet. It needs to go inside a button like this:

[IButton,???,“Change background image”,

[VarSet,txtrFile,"ZBRUSH_ZTextures\Panoramas\pixologic_bourran1.jpg "]//path to file you want to load
[VarSet,txtrName,[FileNameExtract,[FileNameResolvePath,txtrFile],2]]//gets the name of the file only

]//end of button

Thanks for posting the videos! :+1:

Hey, Marcus
I copied this piece of code as a macro, click on it without any changes,:rolleyes:

Here is one of my previous macro scripts,How should I add your new code to this script?:slight_smile:

//ZBRUSH MACRO - Recorded in ZBrush version 4.73
[IButton,???,“lightcap setup 02”,
[ISet,Render:BPR RenderPass:SPix,0]
[ISet,Render:Render Properties: Details,1]
[IUnPress,Render:Render Properties:Shadows]

Sorry about that. The ZBC BB Code is inserting a space in the file name where there shouldn’t be one. Try the attached file instead.

And here is your macro with the code inserted:

Now I have a total of eight buttons, click on each button will load an image.

I am following your code to modify these scripts.

But I found that as long as the texture map thumbnail(Light》background) loaded an image, click the other button, the thumbnail can not switch to other images…:cry: