Chaos Corona Forum

Chaos Corona for 3ds Max => [Max] Corona Goodies - User Contributions => Topic started by: Christa Noel on 2016-04-25, 11:25:05

Title: Script - PresetOnCams
Post by: Christa Noel on 2016-04-25, 11:25:05
Hi guys,
this is a script for having a different rendersetup on our each cameras.
the same presetoncams in my bad old crntools script but much better and stable.
it features:
- different object list to hide on each camera, listed in a custom include/exclude list.
- common corona rendersetup controls.
I've been done a lot of test with some lightweight scene, and it is 99% works for me.
but reminding that I'm just not a professional programmer/scripter (autodidact), then I'm sure that you'll find many codes isn't written with optimal methods.
and... i cant find any words to describe what the script does but trust me it is worth to try :)

update:
12-5-16, script updated (fixed stupid bugs)
21-6-16, PresetOnCams v0.2 (new feature: simple BatchRendering, some data storing rewrite). note: delete old presetoncams-startup file first in 3dsmax\scripts\startup
Title: Re: Script - PresetOnCams
Post by: PROH on 2016-04-25, 14:56:49
Hi noel20. Thanks for the script. It looks like something I've been looking for in a while. But... I can't figure out how to get it to work. I've tried to install both scripts (also the StartUp Script), and found them in the UI configuration, but how do they work?

I feel a bit stupid asking this, but can you share a little "how to use this script" knowledge?

Once again thanks :)
Title: Re: Script - PresetOnCams
Post by: DarcTheo on 2016-04-25, 15:01:27
on a quick scan of it, i couldnt figure out how to use custom hide/show objects for each camera and it kept changing the aspect ratios for different cameras, forgetting what i had set it as.

Is there also a way to use this with batch rendering? hiding objects etc
Title: Re: Script - PresetOnCams
Post by: Christa Noel on 2016-04-25, 16:37:42
Ah sorry guys, i didnt give the how to use words. ;)
Here we go:
1.select a camera you need to configure the preset in the list box.
2.press the button "setup is disabled", until the text changed to "enabled"
3.change the controls as desired
4.hide objects with include/exclude button on performance rollout, the function is as the same as common "include/exclude" in max
5.press the button "render selected camera" to render with current preset.

Batch rendering is already planned. I'll make it when i have enough free time.
Tomorrow i'll record a video for tutorial, i'm not good on explanation.. Because im not good in english too :)
Cheers

Edit:
[/quote]
it kept changing the aspect ratios for different cameras, forgetting what i had set it as.
I'm not sure how could it happen. But i'll check it againmto make sure. Btw, i used it on some projects and works smoothly..
Title: Re: Script - PresetOnCams
Post by: DarcTheo on 2016-04-25, 16:58:40
I can explain what i did, maybe i used it wrong. I enabled it for view 1 2 and 3. clicked view 1 and put ratio as 1.7 then clicked 2 and used ratio 2 and 3 ratio 2. then when i clicked back to view 1 it was ratio 2 and view 2 was ratio 1.7 and view 3 was ratio 2. I tried pressing enter each time before clicking the next view but it kept changing them still. I'll try again later!

Thanks for this btw. With batch rendering it will be awesome as well. :)

Title: Re: Script - PresetOnCams
Post by: PROH on 2016-04-25, 18:23:47
Hi noel20. I tried a bit more, and found out a couple of things.

1) First of all the script doesn't work in 3dsMaxDesign2014 - it's impossible to enable a camera/preset

2) It does work I Max2016 in some degree. I can confirm the ratio issue described by DarcTheo. My workflow is similar to his and my result is the same. There seems also to be a problem with the exclude settings: they doesn't change with the camera selection and they doesn't render. And sometimes I receives an script-error rapport when trying to render with "exclude" activated.

I really hope it's me doing something wrong. I really could use the functionality your script offers :)

Regards
Title: Re: Script - PresetOnCams
Post by: Christa Noel on 2016-04-26, 04:20:18
about the output size, lets say I have 2 camera named cam1 and cam2.
now I enable both camera's setup by pressing the setup enable button. then, in cam1 I change the output width to 2000 and output height to 1000.
ok, now I go to the cam2 setup, I see that the output width value is 2000 and the height is 1000 too. its value is changed to last selected cam output width/height value, and this is the correct behavior. it will has its own value only if I changed the value.
the point is you have to change the value of cam2 first to make the cam2 value independent (not following the cam1 or generally following last selected cam's value).
hope you guys understand hahaha :)
And sometimes I receives an script-error rapport when trying to render with "exclude" activated.
can you send me the error report showed in maxscript listener?

edit:
oh mann, I didn't read your words carefully. you guys asked me about ratio spinner incorrect function and I replied with stupid unrelated long explanation.
then you must remember that you have to be very patient and tolerant when having a conversation with me :D
ok, its fixed now. I have replaced the attachments on the first post. check it out :D
Title: Re: Script - PresetOnCams
Post by: DarcTheo on 2016-04-26, 13:13:36
can confirm the ratio now works, thanks!
Title: Re: Script - PresetOnCams
Post by: rafpug on 2016-04-26, 15:54:35
Hello Noel20, good job

This folder is !? :

\Program Files\Autodesk\3ds Max\scripts\Startup\dionchstudio - presetoncams -startup.ms
\Program Files\Autodesk\3ds Max\stdplugs\stdscripts\dionchstudio - preset on cams.ms
Title: Re: Script - PresetOnCams
Post by: Christa Noel on 2016-04-27, 04:38:22
Hello Noel20, good job

This folder is !? :

\Program Files\Autodesk\3ds Max\scripts\Startup\dionchstudio - presetoncams -startup.ms
\Program Files\Autodesk\3ds Max\stdplugs\stdscripts\dionchstudio - preset on cams.ms
hi rafpug, thanx :)
here it is the correct one
\Program Files\Autodesk\3ds Max\scripts\dionchstudio - preset on cams.ms
\Program Files\Autodesk\3ds Max\scripts\Startup\dionchstudio - presetoncams -startup.ms
to launch it: after both file copied to the correct folder like mentioned above, start 3dsmax, open "customize user interface" dialog, go to ToolbarTab>Category>DionchStudio>DionchStudio - PresetOnCams, drag it to desired toolbar. :)
Title: Re: Script - PresetOnCams
Post by: Christa Noel on 2016-04-27, 04:46:11
FYI, 3 bugs is fixed.
1.remove selected in include/exclude isn't working.
2.deleting item in scene which is also listed in include/exclude, doesn't updates the object list and button text
3.UHD cache rollout doesn't hide properly when selecting camera in camera list box.

attached file in first post is already updated too. :)
Title: Re: Script - PresetOnCams
Post by: rafpug on 2016-04-28, 21:32:15
Hello noel20,
congratulations for this creation of the script "dionchstudio"


Thanks to the correct destination scripts.

The script which version supports 3dsmax and CoronaR ?
You have occurred in the script the line " denoise - filtertype " ?  It produces reading script errors ?


Thanks again for your contribution
Title: Re: Script - PresetOnCams
Post by: Christa Noel on 2016-04-29, 03:45:13
Hello noel20,
congratulations for this creation of the script "dionchstudio"


Thanks to the correct destination scripts.

The script which version supports 3dsmax and CoronaR ?
You have occurred in the script the line " denoise - filtertype " ?  It produces reading script errors ?


Thanks again for your contribution
you're welcome rafpug :)
I create this script with max 16 and latest corona pre1.4, but I've made it compatible with 1.3 too. about max compatibility, sorry, I don't have any idea about which versions is supported by this script.
may I have the whole error report produced? and when it creates the error/ how to reproduce it?
Title: Re: Script - PresetOnCams
Post by: johan belmans on 2016-04-29, 10:13:02
Hi Noel

many thanks for the script.
I have some suggestions to make this an awesome script.

Could it be possible to add:
-The pass limit
-Tone mapping: a thick box for "Use Photograpic Exposure" or a thick box for "Use simple exposure"
-A thick box for enabling DOF
-A section for defining the Scene environment + the scene overrides. So each camera can have his own Hdri or Corona sky or override.
-And the ability to switch on or off different layers. I create layers for each camera with objects related to that specific camera: foreground trees, Corona sun, ....
Title: Re: Script - PresetOnCams
Post by: Christa Noel on 2016-04-29, 12:16:21
Hi Noel

many thanks for the script.
I have some suggestions to make this an awesome script.

Could it be possible to add:
-The pass limit
-Tone mapping: a thick box for "Use Photograpic Exposure" or a thick box for "Use simple exposure"
-A thick box for enabling DOF
-A section for defining the Scene environment + the scene overrides. So each camera can have his own Hdri or Corona sky or override.
-And the ability to switch on or off different layers. I create layers for each camera with objects related to that specific camera: foreground trees, Corona sun, ....
hi belly, you're welcome :)
pass limit, tonemapping checkbox, scene environments, ..that's important too but I will start adding those things when right after I'm done with new flashlight feature and rewrite the script to change the storing data method.
but about the last point, reminding that I never work with layers (what a lazy man am I..), does the switch you mean do hide objects in specified layer(s) just like the "list of object to hide" button?
Title: Re: Script - PresetOnCams
Post by: johan belmans on 2016-04-29, 13:50:27
Hi Noel

I guess yes. I try to work organized, that's way I use layers.
The advantage is that when you hide a layer it will be hided in the Vp as well. Which is not the case with Include/exclude.
Title: Re: Script - PresetOnCams
Post by: Christa Noel on 2016-04-30, 03:50:29
Hi Noel

I guess yes. I try to work organized, that's way I use layers.
The advantage is that when you hide a layer it will be hided in the Vp as well. Which is not the case with Include/exclude.
hmm.. I think the best solution is adding the option for selecting layers and checkbox to always hide in the VP when checked and only hide on rendering progress when unchecked, isn't it? what do you think?
Title: Re: Script - PresetOnCams
Post by: Christa Noel on 2016-05-11, 12:33:09
attachments in the first post is updated, added "poor" text documentation.
fixed some bugs and
added some new feature: flashlight and hide in viewport.
Title: Re: Script - PresetOnCams
Post by: Christa Noel on 2016-06-21, 11:37:16
grab the firstpost attachments, it is updated.
added some ability, bug fix, and new feature batchrendering.
more test from you guys will be really appreciated. thank you :)
Title: Re: Script - PresetOnCams
Post by: DarcTheo on 2016-06-23, 12:16:38
grab the firstpost attachments, it is updated.
added some ability, bug fix, and new feature batchrendering.
more test from you guys will be really appreciated. thank you :)

I just tried to run the latest version and i get this error every time
"--unknown propety: "isrendering" in <Interface:CoronaFp>"

presetoncams.rendernow.enabled = not (CoronaRenderer.CoronaFp.isrendering())

Also everytime i open a max file i get unknown system exception error message.

Title: Re: Script - PresetOnCams
Post by: Ondra on 2016-06-23, 13:08:29
the isRendering method is available only in daily builds
Title: Re: Script - PresetOnCams
Post by: Christa Noel on 2016-06-24, 08:55:12
grab the firstpost attachments, it is updated.
added some ability, bug fix, and new feature batchrendering.
more test from you guys will be really appreciated. thank you :)

I just tried to run the latest version and i get this error every time
"--unknown propety: "isrendering" in <Interface:CoronaFp>"

presetoncams.rendernow.enabled = not (CoronaRenderer.CoronaFp.isrendering())

Also everytime i open a max file i get unknown system exception error message.
Title: Re: Script - PresetOnCams
Post by: DarcTheo on 2016-06-24, 10:13:15
Working fine for me now. Very useful tool! thanks very much

if we use this for hiding suns so that we can have different lighting for each camera, does anyone know an easy way of switching environment maps as well based on the cameras?
Title: Re: Script - PresetOnCams
Post by: Christa Noel on 2016-06-24, 11:43:39
thanx Ondra :)
Working fine for me now. Very useful tool! thanks very much

if we use this for hiding suns so that we can have different lighting for each camera, does anyone know an easy way of switching environment maps as well based on the cameras?
hi darc theo,
my last post doesn't contains any of my typed words, sorry the internet still isn't stable here, it makes me keep always press F5 when browsing..
here it is the little updates list of the last updated v0.211:
-non corona pre-1.5 build user should now be able to use this script.
-added resume render in right-click on render button, “resume last render” and “resume from file”
-a little change on GUI, batchrender now is a button
-added prevention when duplicated renderoutput file found

about scene environment, it is already planned. i will reach it right after when i have enough free time :) btw, thanx for the suggestion.
Title: Re: Script - PresetOnCams
Post by: DarcTheo on 2016-07-07, 11:20:35
Hi Noel,

Awesome that you will be adding environment map to this when you have the time.

Just a small thing I have noticed. When switching between my cameras in the list, although the resolutions change the ratio number does not update unless you click to change it. it does render at the correct ratio it just displays the wrong ratio in the UI. The ratio also unlocks itself when swapping between cameras. I guess it needs to when changing the resolution to begin with but it doesnt relock to that cameras ratio, so if you change resolution have to make sure its locked each time. only small annoyance i know, sorry.

Also when using interactive the ratio doesnt update unfortunately when switching cameras, would you be able to add this?

thanks again.
Title: Re: Script - PresetOnCams
Post by: Christa Noel on 2016-07-08, 09:18:33
Hi Noel,

Awesome that you will be adding environment map to this when you have the time.

Just a small thing I have noticed. When switching between my cameras in the list, although the resolutions change the ratio number does not update unless you click to change it. it does render at the correct ratio it just displays the wrong ratio in the UI. The ratio also unlocks itself when swapping between cameras. I guess it needs to when changing the resolution to begin with but it doesnt relock to that cameras ratio, so if you change resolution have to make sure its locked each time. only small annoyance i know, sorry.

Also when using interactive the ratio doesnt update unfortunately when switching cameras, would you be able to add this?

thanks again.
Hi, Nice to hear some feedback here.. :)
I'm still in vacations now and i don't remember the every features details so correct me if i'm wrong
1.you need to check the checkbutton named "check in VP" (positioned below the height spinner) to see the correct ratio in viewport. You will see ratio is changed when switch from one to another cameras.
2.the ratio unlock it self when switch between cameras. That is incorrect behaviour, i will fix it.
3. when using interactive the ratio doesnt update ,if you mean is interactive-rendering then .. I just can say that it is too tricky for me, in other means is i have alredy tried it but didnt work as well. The easiest way to do this is do the point 1 above before/when IR and adjust the width/height if you just need to see the ratio. But the other settings for the example max ray depth still stick to the scene's rendersetup and to make it stick to the presetoncams setting.. Thats what i meant about the tricky point:)
Title: Re: Script - PresetOnCams
Post by: DarcTheo on 2016-07-08, 19:41:34
Hi Noel,

Awesome that you will be adding environment map to this when you have the time.

Just a small thing I have noticed. When switching between my cameras in the list, although the resolutions change the ratio number does not update unless you click to change it. it does render at the correct ratio it just displays the wrong ratio in the UI. The ratio also unlocks itself when swapping between cameras. I guess it needs to when changing the resolution to begin with but it doesnt relock to that cameras ratio, so if you change resolution have to make sure its locked each time. only small annoyance i know, sorry.

Also when using interactive the ratio doesnt update unfortunately when switching cameras, would you be able to add this?

thanks again.
Hi, Nice to hear some feedback here.. :)
I'm still in vacations now and i don't remember the every features details so correct me if i'm wrong
1.you need to check the checkbutton named "check in VP" (positioned below the height spinner) to see the correct ratio in viewport. You will see ratio is changed when switch from one to another cameras.
2.the ratio unlock it self when switch between cameras. That is incorrect behaviour, i will fix it.
3. when using interactive the ratio doesnt update ,if you mean is interactive-rendering then .. I just can say that it is too tricky for me, in other means is i have alredy tried it but didnt work as well. The easiest way to do this is do the point 1 above before/when IR and adjust the width/height if you just need to see the ratio. But the other settings for the example max ray depth still stick to the scene's rendersetup and to make it stick to the presetoncams setting.. Thats what i meant about the tricky point:)

Yes, if you "check in VP" it updates the view port, i just meant the ratio number on the scripts UI. next to where it says check VP, that ratio number does not update when swapping between cameras unless you click the padlock. It still functions correctly but it just displays wrong, only minor but at first I kept thinking it wasnt changing my ratio.

shame about the interactive part but not a big issue really.

enjoy the rest of your vacation :)