Question: 4k render problem ... can't render close up. Why?
My zScript/Tool Setup
-I have some buttons that will change the document size (1k, 2k, 3k, 4k). 1k and 4k are included in code below.
-I have another set of buttons that store camera angles. The "Front" button is included in the code below. You click the button and it stores your current camera angle. I've included a "Clear" button below that will remove stored camera angle from the "Front" button.
-I have another button labeled "Render". NOT included in the code below. This button looks at the "Front" button and if it has a view stored it will render that view.
Here's the problem ...
I need to do high res (4k) renders of my models. And I need some of them to be close ups of the model. When I zoom in on the model and store the camera position into the "Front" button it seems to store the view. But when I click the "Front" button again the view changes. The canvas zooms out and moves the model down on the canvas. After extensive testing it looks like zBrush won't (or can't) store a camera angle that is close up on the model. It's like there is a clipping plane that zBrush won't let the camera past. This also happens when the document is set to 2k. But when I have my document set to 1k I can get as close as I want to the model. The camera angle stores without a problem.
Why can't I store a camera angle that is close up on the model? Is this a limitation of zBrush or is my code messed up?
Thanks![CODE]//Choose document size
[IButton,"1K","1024 X 1024",
[IButton,"4K","4096 X 4096",
//Store Camera View
[IButton,"FRONT","Store Front Camera",
//when the button is pressed:
[If, frontBtn(0) == 0, //the first element is used to check if we have stored the values or not
[VarSet,frontBtn(0),1]// we are storing values so our 'check' is set to one
//now get the current transform values into the list
[TransformGet,frontBtn(1),frontBtn(2),frontBtn(3),f rontBtn(4),frontBtn(5),frontBtn(6),frontBtn(7),fro ntBtn(8),frontBtn(9)]
,//else we have stored values so we need to set the new position
[TransformSet,frontBtn(1),frontBtn(2),frontBtn(3),f rontBtn(4),frontBtn(5),frontBtn(6),frontBtn(7),fro ntBtn(8),frontBtn(9)]
,,.5 // button width
//Clear stored views
[IButton,"Clear View","Clear View",
//clear data from front button
[If,frontBtn(0) == 1,//then
,,0.5 //clear all button width
] //end clear all button[/CODE]
Last edited by ijacobs; 09-14-12 at 02:16 PM.
I'm taking a look at this and will get back to you tomorrow.
It looks as though the scale values for [TransformSet] get clamped to a 1024. This means that you can't store scale values above that using this method. (I will update the command reference on this.)
Fortunately there is another method you can use which doesn't have this problem. This uses a memory block to store the values with the [MTransformGet] command, and then [MTransformSet] to reset the model.
I've adapted your zscript in the attached file, using this method. I have also added a couple of buttons to store and load the data from disk, so you can see how that is done.
Thanks for the help! That's great stuff.
I ran into one minor problem with the "Load Data" button.
Steps to reproduce:
1. Open ztl file
2. Go to the front view of your model
3. Store that view in the FRONT button
4. Click the Save Data button
5. Close zBrush (If you don't close and reopen zbrush the load button works just fine)
6. Reopen zBrush
7. Open the same ztl file you were using before
8. Click Load Data button
9. Click FRONT button
10. Observe that your model is flipped upside down (and possibly moved off the canvas).
So the Save button saves out a file and the Load button loads that file but the data it saves and loads for the front view is wrong. I tested several other views (back, sides, etc) and they seem to save and load without a problem. But for some reason the front view gets flipped upside down.
Any ideas why? Is this a gimble problem? Can this be fixed?
Yes, it's likely to be the gimbal lock problem. You will need to check the values and adjust as necessary. (In the code examples I give I am not covering all possible issues as they are only code examples. Added to which, finding out what is going wrong is the best way to learn! )
Probably just checking (when the values are stored) to see if the rotation values are close to 0 and then making them 0.001 will be enough to stop the problem.
The indices for rotation the example I gave will be 7, 8 & 9. You can access the memblock like this:
[If, [MVarGet,IJ_frontBtn,7] == 0, // if the X Rotation value is exactly zero
[MVarSet,IJ_frontBtn,7,0.001] //change it to 0.001
//repeat for & Rot and Z Rot
The model disappearing is probably because you are resetting the model position without adjusting the canvas size. If the canvas was large when the values were stored then they may be off-canvas if loaded for a small canvas.
Tags for this Thread