Animating IsHidden


#21

get an idea:

delete objects
gc()

for k=1 to 100 do point pos:(random -[100,100,100] [100,100,100]) wirecolor:(random gray white)

global monitor_nodes = objects as array

fn timerelatedVis node = 
(
	t = mod (int currenttime) 10
	mod (finditem monitor_nodes node) 10 == t 
)

registerDisplayFilterCallback timerelatedVis "Time Based ID"
k = getNumberDisplayFilters()
setDisplayFilter k on

the hardest part here is to keep memory … avoid leaking as well as possible


#22

Of course it won’t be faster than hiding the object, in best case it will perform the same, but the difference is that it works.

While this topic has been discussed many times, I’ve never seen the solution I posted, that’s why I posted it.

The main advantages are:

  • It can be animated
  • It works in both viewport and rendering, while other solutions won’t
  • It is not a “hack” nor a “trick”, so there are not too many chances for it to “break” the system
  • It uses no controllers, no callbacks, no global variables, no custom attributes
  • You can select the object in its “hidden state”, something you can’t do if the object is really hidden
  • It is very simple

I can see the benefits.


#23

another examples:

delete objects
gc()

for k=1 to 10 do 
(
	point pos:[(k-1)*30,0,0]
	dummy pos:[(k-1)*30,0,30]
	teapot pos:[(k-1)*30,0,-40] radius:10
)

fn typerelatedVis node = 
(
	(iskindof node Point and currenttime > 10 and currenttime < 30) or \
	(iskindof node Dummy and currenttime > 20 and currenttime < 40) or \
	(iskindof node Teapot and currenttime > 50 and currenttime < 70)
)
registerDisplayFilterCallback typerelatedVis "Type Based"
k = getNumberDisplayFilters()
setDisplayFilter k on

fn posrelatedVis node = 
(
	node.pos.x/5 > currenttime
)
registerDisplayFilterCallback posrelatedVis "PosX Based"
k = getNumberDisplayFilters()
setDisplayFilter k on



#24

but there are also disadvantages …
the solution is an object based (not a node based), which means you will have the same behavior for all instances and references. This is one. … but unfortunately there is more


#25

second, any geometry changes greatly affect all types of simulation and deformation (e.g. Skin, Cloth, Flex, etc.). This can kill performance and stability. I’m not 100% sure about the potential problems, but this requires “deep” testing at least.


#26

Yes, it has all the disadvantages of a geometry modifier.


#27

as I said … we discussed it many times.
unfortunately there are no miracles … real animation of the visibility is only using the visibility track.


#28

What I see in 2021 is Max behaving like obsessed street cleaner, collecting garbage on every move.
You need physical force to make some changes.
And if you menage to make it and hit play you will get FPS like before - I’m comparing to 2015.

It looks like development put great hopes in “tricks” and all-mighty oblivion…
I don’t know what to say about default renderer who can not render his own shaders nor in Mat. Editor nor translate them to viewport (hsls)
All my files have “Recovered” in names :grin:
But there’s no much of complains (quality ones) so don’t know…
Maybe I should update my video drivers :rofl:


#29

Here’s one example where changing state on/of can freeze Max where we can get same effect other way…
Have nice scene with lights, shadows and everything, you want turn some light off - don’t, it will freeze Max…
Change intensity multiplier to 0 or put it in a box - painless transition.


#30

Where? How? give an example …
Always, if you have a statement, please support it with an example.


#31

What do you mean"where"?
I describe the scenario.
Maybe missing to put as many lights your hardware and Max can handle at same time…


#32

Put a Waveform controller on multiplier to have nice negative effect :slightly_smiling_face:
Is it not working for you?


#33

As far as I understand, sometimes turning off the lights in the scene can cause the MAX hang (crash), but if you just set the light intensity to ZERO, it’s safe.

Give an example to prove it. It doesn’t make sense to me without proof.


#34

Not crash but freeze, make it nonresponding.

What proof? You think I’m laying or making this up? :rofl:


#35

Just checked it on 2021, light off didn’t freeze it but make textured obj. draw a checkerboard and changing multiplayer painless.
So there are differences from versions but still…
My default is 2015 where I’m using this with greater impact.


#36

I just don’t care … if you want to discuss any issue, you should make a setup for anyone who wants to help with it.
So, to make easy to discuss:
#- here is the scene
#- this is the problem
#- these are the steps how to reproduce it

without all this it’s not a pro … it’s for Reddit, Twitter, Facebook …


#37

try this method , it’s not a natural method ,but can be a solution when need to change something while rendering.

objsel=for o in objects where o.modifiers[#ishidden]!=undefined collect #(o,o.ishidden)
renderimage=bitmap 800 600
display renderimage
for n = animationrange.start to animationrange.end do
(
	if keyboard.escPressed do exit
	sliderTime = n
	for o in objects where o.modifiers[#ishidden]!=undefined do if o.modifiers[#ishidden].ishidden then hide o else unhide o
	render to:renderimage
)
for o in objsel do o[1].ishidden = o[2]

it works with your script posted at Floor 6


#38

of course we can do something like that … but we have to understand that this can only be used for dirty previews.


#39

#- here is the scene:

Doesn’t have to be nice, just kind of demanding for viewport rendering - with lights, shadows and everything

#- there’s no problems
#- steps are there


#40

Our hardware- and doesn’t have to be new or expensive, viewport rendering, active shade (actually pretty useless thing, fortunately) make those methods obsolete, if ever it was really usable.