PDA

View Full Version : Scene Check



tcoursey
07-14-2008, 03:54 PM
Our studio is looking for a plugin/lscript, that could tell us quickly a set of values found inside a scene.

1. Ram Usage (same as opening up Task Manager and looking for Lightwave.exe)
2. Images that are over a certain size (all images over 5MB or something)
3. Polygon Count threshold. Show objects that are above a certain value. (3 objects over 500K polys)
4. Load time for the scene.

Anyone know of anything like this, or if this information is available to a knowledgable lscripter? Would love to hear feedback! thanks.

Lightwolf
07-14-2008, 04:10 PM
Hm, let me see:
1) Depends on a lot of variables, not only 2 and 3 but also subdivision levels, framebuffer sizes, the amount of buffers exported etc.
2) Would require loading the objects, scanning for images, then load those to actually find out how much RAM they (since compressed images have a different size on disk)
3) Again, required loading the actual objects
4) Hard to estimate, that depends on a lot of variables (i/o speed, CPU speed).

The only thing I can think of is to actually load the scene to see what happens (without making the whole thing _extremely_ complicated and probably slower as well).
Getting 1) will still be hard since LScript doesn't have access to read the amount of RAM used by LW.

But so sum it up, none of these values can actually be figured out by just looking at the scene (the .lws file).

Cheers,
Mike

Blochi
07-14-2008, 07:44 PM
Well, I think this is all do-able.
Yes, the script would have to actually load the scene.

4. The script would read the system time, load the scene, and then read the system time again. Difference is the time it takes to load.

3. Polycount is accessible through the mesh() object. Very simple, and runs fast as long as you're not updating Layout.

2. Images could be checked for dimensions. Size in memory is directly related to pixel count, so if width*height*32byte > 5200000 you have an image bigger than 5 MB. Different multiplier is needed for images with fixed palette or HDRIs.

4. This one is a bit of a hack, but very much possible. You could call the system info from the commandline, and grab the commandline output. Then parse it for "lightwave.exe". Here is a little fun test script that illustrates the first part (without the parsing):



//-----------------------------------------
// LScript System Command Test
// by Blochi

@version 2.2
@warnings
@script generic

var out;

generic
{
out = systemex("tasklist");

out[1] = "Commandline Output:"; // overwrite first one, otherwise its hex 0 and fucks up

reqbegin("C:\\>tasklist");

c0 = ctledit(560,400,out,true,false,<230,200,100>,<52,55,86>);
ctlposition(c0,16,16);

return if !reqpost();
reqend();
}


Good luck, trooper!
Blochi

Lightwolf
07-15-2008, 04:54 AM
3. Polycount is accessible through the mesh() object. Very simple, and runs fast as long as you're not updating Layout.

Almost. Consider SubDs and APS. You can get the amount of polygons in the .lwo, or the amount of polygons currently used for openGL display, but not the amount of polygons thrown at the renderer (if that's what is required).


4. This one is a bit of a hack, but very much possible.
Ah, nice one :D

Cheers,
Mike

tcoursey
07-15-2008, 06:48 AM
Very nice ideas! thanks guys. The thought is to run the script on an open scene. So having the script open the scene should not be necessary.

I'm not much of an Lscripter. (however I do rumage around in ASP and PHP) so I might could get my head around it sooner or later.

Anyone want to give it a shot, i'm sure if you posted it to a website with a PayPal Donate button I could get our owner to throw a bit of money your way.

Anyway, thanks for the thoughts and direction.

Lightwolf
07-15-2008, 06:54 AM
Very nice ideas! thanks guys. The thought is to run the script on an open scene. So having the script open the scene should not be necessary.
But then you won't be able to check the load times for the scene either.

Unless you want to write out the data to a file or such, you might as well look at the scene info ("w" in Layout) as well as the image panel (for the memory used by all images) for the stats you're looking for.

Cheers,
Mike

Blochi
07-15-2008, 08:04 AM
hehe ... well, I don't have the time to write it, and with PayPal buttons I'm done anyway.

Generally speaking, it's quite impossible to get load times with the scene already open. This is just depending on too many odd things in Lightwave...

Blochi

tcoursey
07-16-2008, 09:04 AM
Blochi,

Without checking the load time, it sounds like everything is doable, to some extent. What would you charge for such a script? If you don't want to tackle it, do you have any other input on where a newbie would look to begin figuring something like this out.

Thanks for any further input.

Blochi
07-17-2008, 04:02 PM
err.... sorry to pass, but I simply don't have the time. Too many things on my plate already.

Common, fellow scripters - nobody here wants to make a quick buck? :)