Notifications
Clear all

[Closed] Animating IsHidden

I have a process for channel rendering , I use mxs to rendering every frame , between frames I change object’s properties , maybe that’s another method ,use the script you posted to set visibility , use mxs to hide or unhide them between rendering

 MZ1

I tried that, it will not increase the performance too much. compare to hide the object.

5 Replies
(@denist)
Joined: 10 months ago

Posts: 0

What performance are you talking about? Navigating the viewport, redrawing? This is fine and you can use anything as shown above. But you must understand that this is not real visibility and cannot be used in animation.

 MZ1
(@mz1)
Joined: 10 months ago

Posts: 0

I’m taking about framerate in viewport.
I don’t want to argue with either, I just want to find a hack or trick.
Why I try again while you discussed that? because maybe in new version of the max something is changed and we can use it.

(@denist)
Joined: 10 months ago

Posts: 0

maybe it needs a different solution if you just want to manage the state of the scene at a specific time

you are not new to this business why are you so naive about MAX?

(@denist)
Joined: 10 months ago

Posts: 0

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

(@denist)
Joined: 10 months ago

Posts: 0

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


I don’t understand why argue, if it’s enough just to take and try … I don’t need to do it, because I’ve already gone through it. Moreover, we even discussed it on this forum.

anyway … I do it again.

HideControlAttr = attributes HideControlAttr attribid:#(123456, 121212)
(
	parameters params rollout:params
	(
		hide_control type:#boolean ui:ui_hide_control
	) 
	rollout params "Hide Conrtrol"
	(
		checkbox ui_hide_control "Hide Owner"
	)	
)


delete objects
b = box name:#hide_test
ca = createinstance HideControlAttr
append b.baseobject.custattributes ca 

with animate on 
(
	for k=0 to 3 do at time (k*25) ca.hide_control = (mod k 2) != 0
)
c = b.controller.scale.controller = scale_script()
c.addnode "self" b
c.addobject "ca" ca[#hide_control]
c.setexpression "b.ishidden = (ca.value != 0); [1,1,1]"

Run this example and you will see that if you manually change the timeline it will look like working. But try rendering your scene animation from 0 to 100. You will see that it is not! NOT ANIMATABLE PROPERTIES CANNOT BE ANIMATED!

Some objects might have some not-animatable parameters (for example, “text” in the Text splineshape), that can be animated using the mechanics shown above. PARAMETERS! BUT NOT PROPERTIES!

 MZ1

The script only works in modify mode, because I used get handler, that will be validate only in modify panel.
So I should find another handler, maybe “Scripted Animation Controller Plug-ins” which has “usePBValidity” option.

 MZ1

My focus is viewport, because animators want that. So we can even combine it with the visibility track that works in rendering.

 MZ1

compare to you I’m like a baby , As you know sometimes somebody find a new trick, even undocumented stuff, so we can hunt it, and use it the code structure.
Anyway, If we leave the render problem for later, which handler you think we can find, that will be updated in time change and viewport update? As I said something like “usePBValidity” option, but for the custom attribute.

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.

1 Reply
(@denist)
Joined: 10 months ago

Posts: 0

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

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.

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

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
But there’s no much of complains (quality ones) so don’t know…
Maybe I should update my video drivers

Page 2 / 6