Automating Player side render-to-file

About Truespace Archives

These pages are a copy of the official truespace forums prior to their removal somewhere around 2011.

They are retained here for archive purposes only.

Automating Player side render-to-file // Archive: Tech Forum

1  |  

Post by Jack Edwards // Sep 23, 2006, 6:30am

Jack Edwards
Total Posts: 4062
pic
Hi all,


I'm trying to write a command script to automate the render to file capability from the Player window. That way I can link into the controling timer event and render out an animation as sequential images.


Looks like it should be fairly simple, but I've combed over the Developer Guide, the data objects documentation, and the scripting objects documentation and I can't find anything specific on how to do it.


The IRdBitmapDisp::SaveToFile function looks promising if I could get my hands on the render window's bitmap object... anyone have any ideas? Am I missing the obvious?


Unfortunately the macro recorder and commands panel don't seem to record the "render to file" button's action. :confused:


Thanks!

Post by Cayenne // Sep 23, 2006, 10:39am

Cayenne
Total Posts: 144
pic
hi, there is a thread here that has some ideas and discusion about this type of object. and also some objects to download which perform a similar function to what you need.


http://forums1.caligari.com/truespace/showthread.php?t=619


There may be some good information here or it may be that what you are trying to do has already been achieved.


thanks

Paul

Post by Jack Edwards // Sep 24, 2006, 7:17am

Jack Edwards
Total Posts: 4062
pic
Thanks Paul!


That's was exactly what I was looking for.


I had to simplify it down to get it to work the way I needed. Basically I reduced it to a JScript Command linked to a timer object. Here's a screen grab of the working setup.

http://www.motbc.com/ForumStuff/RenderToFile.jpg


The code needed for the render JScript being:


function Execute(params)

{


// TODO: put your action code here

D3DView.RenderToFile('{00FB4B51-4BBF-4C20-AABB-09A6F7779899}', 'auto');


}


I have no idea how clintonman came up with this, but I'm certainly greatful.

Here's a link to the avi made from the simple script diven animation I tested it on. Just a quicky proximity thing. I suspect the animation's a bit jerky because I had the timer interval set too fast and it didn't have enough time to finish rendering+saving each frame.


Ball-Door Animation (http://www.motbc.com/ForumStuff/BallDoor01.avi)


I came across two interesting errors working on this though. I get this error when I try to use this function from a JScript Object instead of a JScript Command:

http://www.motbc.com/ForumStuff/TS7Error.jpg


And I noticed that even when I set a variable or attribute as an integer, I'm still getting floating point values.


I'm using the following as a temporary workaround:


val = val - (val%1);


But since floats are innacurate it's not a perfect solution.... :(


I wonder if maybe I'm using an incompatible version of the JScript (.Net?) libraries somehow...


-Jack.

Post by Jack Edwards // Sep 24, 2006, 7:21am

Jack Edwards
Total Posts: 4062
pic
Whupps forgot to mention that the video is Divx encoded. So you'll need a Divx decoder to play it.


-Jack.
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2021. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn