PDA

View Full Version : New LScript: Render settings on Image


MentalFish
08-18-2009, 07:15 PM
Here is an LScript I have made with help from people in the community and especially Matt Gorner who donated a good chunk of code for it.

http://mentalfish.com/uploads/lscripts/MFOverlayRenderStats.zip

Basically what it is doing is to parse the currently open LWS and overlaying the rendering settings onto the rendered image. It also spits out a "time stamp" of the render start time, and compares that to the time when applying the text to the image and displays the frame render time as well.

http://mentalfish.com/uploads/lscripts/render-stats-640x480.png

The MFGetRenderStats.ls is a Master Plugin script that needs to be applied as well as the Image Filter MFOverlayRenderStats.ls

It does not have alot of "safety" features, so make sure your scene is saved and content directory is set, before using it. If those isnt done, it will most likely not work.

Please poke at it and share thoughts and lscripts improvements to it.

JeffrySG
08-18-2009, 07:32 PM
That's very cool! Thanks to you and Matt! :D

Svenart
08-18-2009, 07:35 PM
you did this only in lscript? Respect!!! Very well done and useful!

MentalFish
08-18-2009, 07:42 PM
you did this only in lscript? Respect!!! Very well done and useful!

Haha, yes, but I had to sacrifice a goat and do some black magic voodoo on it :)

In essence its writing and reading text files, and using Glyphs to render the text back out onto the image, overlayglyph();

Glad you like it

probiner
08-18-2009, 11:09 PM
This is freaking good. I sometimes have so many samples and i think "I want this one" then "How did i render that?"

Thanks :D

MooseDog
08-18-2009, 11:45 PM
awesome! thx.

probably just me, but i just couldn't read the text on the bottom of your image above. is it the compression for the posted picture? or my failing eyes :).

toby
08-18-2009, 11:46 PM
swwwwwEET!

MentalFish
08-19-2009, 02:27 AM
MooseDog, it is a crummy small font, need to improve the solution in that department. Not sure if I will do it directly or leave it up to others in the community. The techical aspect of it is solved, would love to see others improve it, such as the font as well. Hint hint, knudge knudge.

The font is created via tga's converted with the gendata.ls script on Jeremy Hardins site: http://jeremy.lwidof.net/lscript/tutorial/

Feel free to change it and share in this thread :)

-EsHrA-
08-19-2009, 03:42 AM
excellent!


mlon

Matt
08-19-2009, 07:41 AM
Awesome work Petter! Just one point, if the scene info gathering code is the same as my script, you need to make sure your scene has been saved to have the correct info shown, as it gathers parameters not available to LScript by parsing the scene file.

Petter, you can also get rid of the UI variables, they aren't needed anymore.

Also, I'm wondering, because the font is so small, and is trying to place a lot of info in a small space, maybe a version of this that saves out a .txt file with the scene name and frame number of the render is saved out?

-EsHrA-
08-19-2009, 08:01 AM
i added both the master plugin and image filter plugin, now when i run the lsc it tells me it is not compiled for this architecture...

works fine though...so just adding both the master and image filter plugin is enough i guess?..

im on 9.6


mlon

Larry_g1s
08-19-2009, 10:15 AM
Thanks Petter. First experience with something like this is in Kray, so it's a nice addition to the native render. Thanks to all.

MentalFish
08-19-2009, 01:25 PM
There is a lot of things that needs to be fixed and added to this.

- Ask to save the scene if not saved
- Change font and output of font to non-monospace
- Better font with crisp AA and both upper and lower case
- Find an alternate way of registering render time so there is no need for a master script as well as the image filter (just an image filter would be better)
- Extend the rendered image and apply the render settings underneath the rendered image instead of overlaying it
- Clean up code and fix bugs :)

Will I do all of the above? Most likely not :D thats the beauty of open lscripts, others can add to it, knudge knudge :help:

Or just scrap it and go for ImageMagick for more flexibility: http://www.imagemagick.org The downside of this is it wont show inside LW's own image viewer after completed render.

3dworks
08-19-2009, 02:08 PM
thank you so much petter - so you did it in the end :D

cheers

markus

probiner
08-19-2009, 02:19 PM
Also, I'm wondering, because the font is so small, and is trying to place a lot of info in a small space, maybe a version of this that saves out a .txt file with the scene name and frame number of the render is saved out?

This is good idea, no matter how much info it is it will never fight with the image info.

evenflcw
08-19-2009, 02:38 PM
Thanks for the scripts Petter (and Matt). They were quite readable, gratefully! I have some suggested changes, to both scripts.

Most notable change is that GetRenderStats generates and reads from a scene copy instead. So you dont need to save first and original file is safe. All glyphs are now contained within a single array, that is indexed by the ascii code. A function encapsulates this array, "controlling" its use and output. I don't like more global variables than necessary! Add new chars/glyphs by inserting them into the array (ie one line; must be ascii char though).

What I suggest as next step is to allow for variable width glyphs. This should be relatively easy as glyphs have the w data member (width). Then somebody must create some new glyphs. :)

MFGetRenderStats.ls

revised eventloop, refactored duplicate code into saveRenderStartTime()
saveRenderSettings() now generates and reads from scene copy instead of actual. its deleted automatically.
added filename constants
combined regexp for all commands indicating render start into var expressesRenderStarted.


MFOverlayRenderStats.ls

placed all character glyphs into one array indexed by ascii code.
created function to that contains the array so the glyph implementation is encapsulated into one single function.
added an blank glyph for space character.
added filename constants for easier access.


EDIT: Oyeah... I had some trouble where the generated files were created. I had to add a backslash to all filepaths. This might be a mac/win issue though. Or the consequence of irresponsible native code where it accepts paths ending with or without backslash. Imho directory paths should always end with backslash so it's apparent that the last section is a foldername rather than a filename. Oh well...

walfridson
08-19-2009, 02:41 PM
I love this open source sharing/improving thing going on here! :)

MentalFish
08-19-2009, 04:57 PM
Nice fixes Dan! Perhaps we should scrap the prefix MF in both the filename and plugin name, since it already is a bastardized script between 3 people. Just rename it to Overlay Render Stats and Get Render Stats. People could perhaps add their "was here" messages in the top only and add a date stamp for their version of the script in the filename?

OverlayRenderStats090819.zip (and if another version is added the same day add a letter to it too OverlayRenderStats090819b.zip) Perhaps use underscore and dash? overlay_render_stats-090819c.zip

Roadwarrior
10-29-2009, 10:17 PM
Great to see the cogs turning throughout this thread
These scripts Rock!:boogiedow
Thx

Leave the thinking to the horses they have bigger heads

Matt
10-29-2009, 11:26 PM
EDIT: Oyeah... I had some trouble where the generated files were created. I had to add a backslash to all filepaths. This might be a mac/win issue though. Or the consequence of irresponsible native code where it accepts paths ending with or without backslash. Imho directory paths should always end with backslash so it's apparent that the last section is a foldername rather than a filename. Oh well...

evenflcw - take a look at the code in my Render Log script, as far as I know it grabs the locations on disk on both PC and Mac:

http://www.newtek.com/forums/showthread.php?t=102997

evenflcw
10-30-2009, 09:55 AM
Thanks Matt! I thought I'd have a look, but turns out I almost don't know what's what anymore. Wrapping my head around it again or risk getting stuck feature creeping is not what I'd like to do right now. I'll assume it works until someone complains. I'll be sure to have a closer look then. :)

Matt
10-30-2009, 10:43 AM
Try this (scene file path example)

s = split(Scene().filename);

drive = s[1];
path = s[2];
filename = s[3];
extension = s[4];