- May 20, 2019
- 51
- 207
GNVE has identified the usual cause. Note that if you go over to the Daz forums, in the Daz Studio / Scripting forum, someone posted a "recenter in world" script. Select your character, run the script, and it shifts everything in the scene so that the selected item is at 0,0,0. Saves a lot of fiddling.
Just found this thread and looked at the linked daz3d forum post. Two questions (request also if applicable):Here's the DAZ forum thread with the scripting...
You must be registered to see the links
In reference to the above issue with the ring around the eyes? Scripts are completely unnecessary for it. Just change the Instancing Optimization from Auto to Speed or Memory in Render Settings.Just found this thread and looked at the linked daz3d forum post. Two questions (request also if applicable):
1. Towards the bottom of the daz forum post there is a second "script" in a long single line format that supposedly moves everything including any locked items. Is this still applicable? And if so...
2. I have no idea how to copy/paste that script into a working Notepad format to make it work. I tried comparing it to the first post in the thread as guidance, but obviously there are differences that non-script writing people (me) wouldn't comprehend. If the second script would still be applicable to the current version of Daz Studio, can someone convert it to a Notepad file and upload it for a quick download here?
Thanks for any clarification/assistance.
same, just saw this thread, the one longer sentence can be used (so I didn't try the first one), but it need to be cut to few sentences, you can simply cut(enter) from every long space .Just found this thread and looked at the linked daz3d forum post. Two questions (request also if applicable):
1. Towards the bottom of the daz forum post there is a second "script" in a long single line format that supposedly moves everything including any locked items. Is this still applicable? And if so...
2. I have no idea how to copy/paste that script into a working Notepad format to make it work. I tried comparing it to the first post in the thread as guidance, but obviously there are differences that non-script writing people (me) wouldn't comprehend. If the second script would still be applicable to the current version of Daz Studio, can someone convert it to a Notepad file and upload it for a quick download here?
Thanks for any clarification/assistance.
Yes, this does address this problem, however there are other problems that will also occur when you're too far from the (0,0) point as well, so understanding the cause of the problem is important. Another artifact that you'll sometimes see when too far away are funny black lines on the forehead due to the interaction between the forehead and hair cap.In reference to the above issue with the ring around the eyes? Scripts are completely unnecessary for it. Just change the Instancing Optimization from Auto to Speed or Memory in Render Settings.
The thing I don't understand is why swapping instance optimization actually works. I remember reading about it on Daz forum, but can't find that particular post. Fair bet is that is recalculate the floating point but I'm not sure why it's happening at all (nor it is on Nvidia or Daz side). It's like software mystery lol.All of this has to do with the fact that iRay optimizes memory in the GPU by using floating point numbers that have limited numbers of digits, and so when you're far away from (0,0) it has trouble keeping "nearly intersecting" surfaces from actually intersecting. By example, when you're near zero, you can have digits like this 1.0001, so things separated by 0.01 are kepty separate, but when you're far away you get fewer to the right of the decimal - like 1000.1, so things separated by 0.01 can't be.
Actually, that I know, because I read a long and ridiculously technical article about it. When you set the instance optimization setting the way you suggested, there's a side effect where iRay actually "recenters" the world around the current camera. Which, effectively, puts the camera at (0,0), which eliminates the floating point problem in most cases, because by the time you're far enough away for it to show up, the artifacts are usually too small to see.The thing I don't understand is why swapping instance optimization actually works. I remember reading about it on Daz forum, but can't find that particular post. Fair bet is that is recalculate the floating point but I'm not sure why it's happening at all (nor it is on Nvidia or Daz side). It's like software mystery lol.
// DAZ Studio version 4.12.1.118 filetype DAZ Script
// Origin by OMNI at https://www.daz3d.com/forums/discussion/284301/world-recenter-script-feedback-sought
// modified by function to fix camera group problem
/* Use it: select the object that want to put as world center, run this script, done, and can undo.*/
(function(){
function repositionNode (oNode)
{
if (oNode.isRootNode())
{
// Unlock locked controls before repositioning
var aFunctions = [oNode.getXPosControl, oNode.getYPosControl, oNode.getZPosControl];
var bLockTracker = [false, false, false]
aFunctions.forEach (function (control, i) { if (control().isLocked()) control().lock (bLockTracker[i]++) });
// Reposition node
oNode.setWSPos (oNode.getWSPos().subtract (vecOffset));
// Restore locked controls
aFunctions.forEach (function (control, i) { if (bLockTracker[i]) control().lock (true) });
}
}
if (Scene.getNumSelectedNodes() != 1)
MessageBox.warning ("Please select a single item in the scene before invoking this script", "Selection Error", qsTr ("&OK"), "");
else
{
// Get selected nodes offset from world origin
var vecOffset = Scene.getSelectedNode (0).getWSPos();
beginUndo();
Scene.getNodeList().forEach (repositionNode);
/**********below script is for CameraGroup_to_WorldCenter*************/
// DAZ Studio version 4.16.0.3 filetype DAZ Script
/* This script is to reset all Camera Groups' coordinate to
world center 0,0,0 in a scene, to avoid camera orbit problem. */
// get all scene nodes list
var aAllNodes = Scene.getNodeList();
var nAllNodes = aAllNodes.length;
// Iterate over all scene nodes
for (var i1 = 0; i1 < nAllNodes; i1 += 1) {
// Get the 'current' node
var oNode = aAllNodes[i1];
// set its parent node
var oParent = oNode.getNodeParent();
// check if current node is a Camera
if (oNode.isViewCamera) {
// check if node has parent
if (oParent) {
// Get all of the child nodes of the camera parent
var aNodes = oParent.getNodeChildren(true);
// Get the number of nodes
var nNodes = aNodes.length;
// Iterate over all cameras
for (var i = 0; i < nNodes; i += 1) {
// Get the 'current' camera
var oCamera = aNodes[i];
/* get each Camera's World position & rotation, clear its Local position & rotation,
delete all its keyframes, and set its Local p & r to its World p & r. */
var p = oCamera.getWSPos();
var r = oCamera.getWSRot();
oCamera.getXRotControl().deleteAllKeys();
oCamera.getYRotControl().deleteAllKeys();
oCamera.getZRotControl().deleteAllKeys();
oCamera.getXPosControl().deleteAllKeys();
oCamera.getYPosControl().deleteAllKeys();
oCamera.getZPosControl().deleteAllKeys();
oCamera.setLocalPos(p);
oCamera.setLocalRot(r);
}
// finally clear Camera Group's world position and rotation and delete keyframes.
oParent.getXRotControl().deleteAllKeys();
oParent.getYRotControl().deleteAllKeys();
oParent.getZRotControl().deleteAllKeys();
oParent.getXPosControl().deleteAllKeys();
oParent.getYPosControl().deleteAllKeys();
oParent.getZPosControl().deleteAllKeys();
}
}
}
/**********end of script for CameraGroup_to_WorldCenter**************/
acceptUndo("Reposition to world center");
}
})();
Thank you for sharing!Ok, as mentioned above, I found a problem for that script (actually I think it is a bug for DAZ3D), now I fixed it by adding some actions to set camera groups' coordinate to 000. Here is the whole script:
To use it, simply copy it to notepad, save as worldReCenter.dsa, put it to a folder that you can find in your DAZ Content Library, and run it.JavaScript:// DAZ Studio version 4.12.1.118 filetype DAZ Script // Origin by OMNI at https://www.daz3d.com/forums/discussion/284301/world-recenter-script-feedback-sought // modified by function to fix camera group problem /* Use it: select the object that want to put as world center, run this script, done, and can undo.*/ (function(){ function repositionNode (oNode) { if (oNode.isRootNode()) { // Unlock locked controls before repositioning var aFunctions = [oNode.getXPosControl, oNode.getYPosControl, oNode.getZPosControl]; var bLockTracker = [false, false, false] aFunctions.forEach (function (control, i) { if (control().isLocked()) control().lock (bLockTracker[i]++) }); // Reposition node oNode.setWSPos (oNode.getWSPos().subtract (vecOffset)); // Restore locked controls aFunctions.forEach (function (control, i) { if (bLockTracker[i]) control().lock (true) }); } } if (Scene.getNumSelectedNodes() != 1) MessageBox.warning ("Please select a single item in the scene before invoking this script", "Selection Error", qsTr ("&OK"), ""); else { // Get selected nodes offset from world origin var vecOffset = Scene.getSelectedNode (0).getWSPos(); beginUndo(); Scene.getNodeList().forEach (repositionNode); /**********below script is for CameraGroup_to_WorldCenter*************/ // DAZ Studio version 4.16.0.3 filetype DAZ Script /* This script is to reset all Camera Groups' coordinate to world center 0,0,0 in a scene, to avoid camera orbit problem. */ // get all scene nodes list var aAllNodes = Scene.getNodeList(); var nAllNodes = aAllNodes.length; // Iterate over all scene nodes for (var i1 = 0; i1 < nAllNodes; i1 += 1) { // Get the 'current' node var oNode = aAllNodes[i1]; // set its parent node var oParent = oNode.getNodeParent(); // check if current node is a Camera if (oNode.isViewCamera) { // check if node has parent if (oParent) { // Get all of the child nodes of the camera parent var aNodes = oParent.getNodeChildren(true); // Get the number of nodes var nNodes = aNodes.length; // Iterate over all cameras for (var i = 0; i < nNodes; i += 1) { // Get the 'current' camera var oCamera = aNodes[i]; /* get each Camera's World position & rotation, clear its Local position & rotation, delete all its keyframes, and set its Local p & r to its World p & r. */ var p = oCamera.getWSPos(); var r = oCamera.getWSRot(); oCamera.getXRotControl().deleteAllKeys(); oCamera.getYRotControl().deleteAllKeys(); oCamera.getZRotControl().deleteAllKeys(); oCamera.getXPosControl().deleteAllKeys(); oCamera.getYPosControl().deleteAllKeys(); oCamera.getZPosControl().deleteAllKeys(); oCamera.setLocalPos(p); oCamera.setLocalRot(r); } // finally clear Camera Group's world position and rotation and delete keyframes. oParent.getXRotControl().deleteAllKeys(); oParent.getYRotControl().deleteAllKeys(); oParent.getZRotControl().deleteAllKeys(); oParent.getXPosControl().deleteAllKeys(); oParent.getYPosControl().deleteAllKeys(); oParent.getZPosControl().deleteAllKeys(); } } } /**********end of script for CameraGroup_to_WorldCenter**************/ acceptUndo("Reposition to world center"); } })();