How to animate "Visible to Camera" checkbox in 3ds max?

How to animate "Visible to Camera" checkbox in 3ds max?

Bob.Bon2000
Collaborator Collaborator
5,013 Views
12 Replies
Message 1 of 13

How to animate "Visible to Camera" checkbox in 3ds max?

Bob.Bon2000
Collaborator
Collaborator

How can I animate checkbox that in frame 10 isVisible 11 isInvisible, 20 isInvisible in 21 isVsible again?

 

I'm running out of ideas and I can't believe it's not keyable... I must be doing something very wrong...

 

Thanks.

0 Likes
Accepted solutions (1)
5,014 Views
12 Replies
Replies (12)
Message 2 of 13

electrotoast_old
Community Manager
Community Manager

You could add the visibility track to the object or objects in question. Then set some keyframes and set the keyframe interpolation to stepped.

 

Frame 0 set to is visible (value of 100)

Frame 11 set to invisible (value of 0)

Frame 21 set to visible (100 again)

-----------------------------
Chip Weatherman
Product Manager, 3ds Max
Media & Entertainment
twitter.com/chipnuts
-----------------------------
0 Likes
Message 3 of 13

Bob.Bon2000
Collaborator
Collaborator

Which visibility track ? Because if its the one that animate Visibility then the object hides and its shadow/reflection/everything else become hidden as well...

 

I need to animate the checkbox marked in Blue, not red. Red one does not work.

 

Thanks for quick reply!

0 Likes
Message 4 of 13

electrotoast_old
Community Manager
Community Manager

Ah, I see. Those checkboxes can't be animated in the traditional sense. A lot of those values can't be changed via typical keyframes. What you can do is use State Sets and set up two passes. One where the object is visible to camera, one where it's not, set up the frames you want to render out for each, then add them together in a quick compositing app.

 

If you need to render it all at once, you may need to script it. My maxscript is a little rough, but I'll see if I can get some help and post it.

-----------------------------
Chip Weatherman
Product Manager, 3ds Max
Media & Entertainment
twitter.com/chipnuts
-----------------------------
0 Likes
Message 5 of 13

Bob.Bon2000
Collaborator
Collaborator

Hey

 

Thanks, I'm trying to reserve state sets for stuff that is more important... otherwise, I will need to do 3x the amount of state sets = 90% something will break. As I will need to do edits and prepare scene for post production output...

 

I'm researching now to see if I can run a pre and post render script in vray. Then I can script it.  Also gotta see if we can network render it so heh :- )

 

Thanks for looking into it!

 

Do you think these parameters can be adjusted in the future version of max to be keyable?

 

Any animation where we go into building/go around objects and we have obstructions we could really use this checkbox to be keyable...

 

Thank you for your help ! 

 

0 Likes
Message 6 of 13

Anonymous
Not applicable

I'm not sure if it is what you need, but what about this solution?

 

1. Manage Scene Sets: a) one for "visible to camera", b) second "not visible to camera"

 

visible to camera.png

 

 

 

2. Now create Batch Render with 2 sequences: first from 0 to 5 and second from 6 to 10. First sequence set to State "visible" and second sequence set to "not visible to camera"

 

visible to camera batch render.png

 

 

 

Now it is not difficult to change range of sequences.

 

Best Regards

 

 

 

 

0 Likes
Message 7 of 13

Bob.Bon2000
Collaborator
Collaborator

Hey

 

zaluski - looks interesting! Will think about it. At the end I will need to produce Beauty + passes render / few lights variants  / few custom passes... so if I need to do 3 sets of animation say

 

0-20 x 3 types

21-31 x 3 types 

32-40  x 3 types

 

You are looking at 9 systems to manage already.... instead of 3

 

 

Then there is a lot of setting up and area for user errors...

 

I tried Pre-Render script with backburner but it did not work :- (

 

 

 

arrTime = #(12,13,14,15,16)

xx = False

for FR in arrTime do
	if sliderTime == FR then(
		xx = True
	)
	

if xx == true then  (
	$HIDEMESHME.primaryVisibility = off

)
else
(
	$HIDEMESHME.primaryVisibility = on
)
	

 

Maybe some1 can have a look and let me know how I can edit it to work with backburner / vray ? 

 

Thanks for all the help ! 

0 Likes
Message 8 of 13

electrotoast_old
Community Manager
Community Manager

You have the idea of the pre-render script down. Make sure the script is accessible via the network path correctly. You may need to wrap in a loop if you have lots of objects or assign them to a closed group.

 

Copy and paste this into a txt file. Change Box001 to the object you want to change visibility on. Change the extension to .ms and load it into a pre-render script.

By default, the expression evaulates true. So between 11-20 the object will be hidden.

 

$Box001.primaryvisibility = ((currenttime.frame < 11) and (currenttime.frame > 21));

Special thanks to Tom Hudson for helping me with it this morning. 🙂

-----------------------------
Chip Weatherman
Product Manager, 3ds Max
Media & Entertainment
twitter.com/chipnuts
-----------------------------
Message 9 of 13

Bob.Bon2000
Collaborator
Collaborator

Hey

 

Wow so elegant! 

 

I will give it a go asap thank you!

0 Likes
Message 10 of 13

Bob.Bon2000
Collaborator
Collaborator

Hey

 

Bit of an update.... the pre-render script gets executed only one time in animation. On 1st render. How can I make it execute per each frame of animation? 

0 Likes
Message 11 of 13

electrotoast_old
Community Manager
Community Manager

You could look at creating a Callback Script in the file (link to some maxscript docs). I tried this but unfortunately had some mixed results. Make sure you save a copy before trying it as the callback script could be saved in the scene.

 

Hope this helps!

-----------------------------
Chip Weatherman
Product Manager, 3ds Max
Media & Entertainment
twitter.com/chipnuts
-----------------------------
0 Likes
Message 12 of 13

Bob.Bon2000
Collaborator
Collaborator
Accepted solution

Hey

 

Yeah was fighting with it since my last post... but I managed yay ! 

 

 

Here is the code:

 

txt = "hh = false \n"
txt += "if currenttime.frame > 2 and  currenttime.frame < 5 do hh = true \n"
txt += "if hh == false then ($XXX.primaryVisibility = on)else ($XXX.primaryVisibility = off ) \n"
callbacks.addScript #preRenderFrame txt id:#preFrameStuff

Its ugly... but it works :- ) replace "XXX" With the name of the object. 

 

It appear to be working. 

 

Thanks again for your help ! 

 

Message 13 of 13

electrotoast_old
Community Manager
Community Manager

You're most welcome! I've tried a couple different versions and had some luck as well. Learn something new everyday. 🙂

-----------------------------
Chip Weatherman
Product Manager, 3ds Max
Media & Entertainment
twitter.com/chipnuts
-----------------------------
0 Likes