render script question
ktg1
Posts: 0
I have no experience with Daz scripts. I'm hoping something already exists that will meet my need. I'm doing a 2D game and hope to automate at least part of the render process. There are several animations per character, which will need to be rendered one at a time in 8 directions. This will be done by rendering all frames of a given animation, rotating the viewport 45 degrees, render all frames again, rotate 45 degrees again, etc. Ideally, the file name used would change with every rotation - i.e. each direction has a different file name. Is there a script that can do this? If so, where and how do you use it?
Comments
Hi!
I had this script here that did the camera rotation. I have now updated it to include animation of the currently loaded scene. It isn't tested much but it should work. Renders are going to be saved in: Users\\AppData\Roaming\DAZ 3D\Studio4\temp and named Angle#Frame##.png
You can change a few things by editing the top few lines, which are commented. To use it, copy the code in Wordpad (if you are on Windows), and save the file, then change its extension from txt to dsa. Place it anywhere inside your My Library folder (but outside Runtime subfolder), for example in My Library/Scripts. Access it from your Content Library tab and it will render your animation. If your animation is less than 30 frames it may render the last frames several times. Remember to cut the rendered frames elsewhere, since they would be overwritten by a second animation rendered.
Great script. Thank you, ReDave! Just a couple of things that would be nice to change.
1. I'd like to change the camera height to, perhaps, 135. I tried changing the 2nd line to have var oHeight=135; but it did the same thing. I even tried restarting Daz Studio, but it still looks like the same angle (105).
2. Daz opens up its small render window with each frame rendered. This could be around 100 per animation. I have to close every one of those windows after its done. Is there a way to prevent that or have it automatically close when done?
If you have any ideas on these things, let me know.
Thanks again.
Hmm, camera height works for me (I tried with 5, and I saw the feet all right ;) ), however camera height is only half of the pointing vector. I completely forgot until now how the aiming was done in that script: it automatically aims at the center of the bounding box of the selected nodes, so select your whole figure, plus hat if any, to raise the view.
Regarding the second problem I have made experiments, but it doesn't seem to work with Save=1 (it always wants to overwrite the same file for some reason). So you can set Save=0 and look for the empty line between
var oRenderMgr = App.getRenderMgr();
and
oRenderMgr.doRender();
In that empty line add the following:
var oROptions = App.getRenderMgr().getRenderOptions();
oROptions.RenderImgTarget=2;
oROptions.renderImgFilename=String( "%1.%2" ).arg( "Angle"+i+"Frame"+fr ).arg( "png" );
This should save the pictures elsewhere, though, they ended up in my Content folder for me. But it may be based on the last Content folder you rendered to, I'm none too sure. I'd advise making short experiments first, I use three frames and 1 step, myself.
You're right, the camera height (oHeight) works. It just wasn't what I had expected. I was thinking it would be like an angle, with 90 = straight on, 180 top down, or something like that. I see now that its not like that. Not sure what the unit is, but I will work with it and decide on a setting I like.
As for the script changes, I added it, and running it that way gave an error (and didn't render anything). I determined the line it didn't like is the one that started with:
oROptions.renderImgFilename
I then tried hardcoding a filename to eliminate the error. It ran like that, but still had the issue of many windows poping up that need to be closed.
This one isn't a show-stopper for me, but if you have any other ideas, I'd like to hear.
Thanks again for helping me out.
Regarding the aiming, remember it points at the center of the bounding box of whatever is selected, so if you can't find a bodypart that allows the camera to point at the proper angle, try creating a box (Create->New primitive) at frame 0 and set it at the correct height, keep only it selected and turn it invisible.
What version of DS are you running? I don't get that error on 4.5 RC1. However it doesn't like my hack (which actually worked for me the last time I tried, but doesn't work right now :-S ). I'd like to figure out how to make the renders save themselves without windows popping up, but I don't think I can troubleshoot it until mid-week.
I'm using Daz Studio Pro 4, the 64-bit version. Running on Windows 7.
I would never have found it on my own, but after getting the correct keywords yet again from a script by Casual, I think I've managed. There's now a variable to change the render to folder (add double slashes \\ instead of just one) in the declarations block near the top.
I hope it works this time!
Worked like a charm - no more little windows to close. Fabulous script. Thanks again, ReDave!
No problem, since most of the script is old! ;) Glad to have gotten it to work at last!