Mini-Challenge #5. Are you ready?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  11 November 2011
Mini-Challenge #5. Are you ready?

I have an idea about some mini-challenge... Working with one of my projects I found that to collect all animated nodes in a scene is not a trivial task.
First is it's not easy to find all animated things of the node.
Second is it's not easy to do it fast and complete.
Are you interested in this challenge? I can give a test scene for the playing... Do you wanna play?
 
  11 November 2011
Sounds like a fun challenge!
__________________

 
  11 November 2011
I'm trying to think of a quick way of doing this and all I can come up with is horrible loops within loops.

Sounds like a good challenge. I'm in
 
  11 November 2011
I'm up for it, let's play
 
  11 November 2011
Great! We have a company!
Here is a test scene:

(
	seed 0
	delete objects
	smat = Standard()
	cont = Bezier_Float()
	addnewkey cont 50f
	smat.opacity.controller = cont
	
	mmat = MultiMaterial numsubs:2
	mmat[2] = smat
	
	attr = attributes attr 
	(
		parameters params 
		(
			value type:#float
		)
	)
	
	modi = NoiseModifier()
	modi.scale.controller = cont

	text = Noise()
	text.size.controller = cont

	empt = EmptyModifier()
	custattributes.add empt attr
	empt.attr.value.controller = cont
	
	cmat = Standard()
	custattributes.add cmat attr
	cmat.attr.value.controller = cont
	
	mats = #(smat, mmat, Standard diffusemap:text, cmat, Standard(), Standard())
	
	nodes = for k=1 to 1000 do
	(
		b = box()
		if (random 1 10) < 5 do b.mat = mats[random 1 mats.count]
		if (random 1 10) < 3 do b.controller.pos.controller[1].controller = cont
		if (random 1 10) < 2 do addmodifier b modi 
		if (random 1 10) > 8 do addmodifier b empt
		if (random 1 10) > 9 do 
		(
			custattributes.add b attr baseobject:on
			b.baseobject.value.controller = cont
		)
		if (random 1 10) < 2 do 
		(
			custattributes.add b attr baseobject:off
			b.value.controller = cont
		)
		if (random 1 10) > 7 do b.width.controller = cont 
		if (random 1 10) < 1 do 
		(
			converttomesh b
			animatevertex b #all
			addnewkey b.baseobject[#master_point_controller].vertex_1.controller 40f
		)
	)
	gc()
)


there are only 1000 nodes... but to get all animated ones takes ... I don't tell how long it takes. Just try and see.

The animated node is any node that has any related animated track.
The animated track is a track that has a key.

Here is a life situation: select all animated nodes to move/scale all their keys ...
It's pretty usual, isn't it?

But before doing this just try to find all animated nodes
 
  11 November 2011
try to cover at least all types/kinds of animation that I give in the test.
but the main idea is to find any source of animation...
 
  11 November 2011
here is a reference point (my version):

(
	t1 = timestamp()
	m1 = heapfree
	a = findAnimatedNodes()
	format "nodes:%\n\ttime:% memory:%\n" a.count (timestamp() - t1) (m1 - heapfree)
)
/* result is:
nodes:753
	time:244 memory:1704L
*/


my first attempt was ~1.5 sec to get them all...

~15 secs for 10,000 nodes is VERY slow. I was really shocked.
~2.5 secs is still slow. But hopefully we will find a better solution.
 
  11 November 2011
here are some numbers (not 100% sure that I'm right):
only transform animation: 183
only modifiers animation: 111
only material animation: 197
...
 
  11 November 2011
Enjoy the challenge!
Happy Turkey for all Americans and Have a Nice Day for all of us!
 
  11 November 2011
Hmm this is proving to be pretty difficult. There are so many damn properties to check!!

So far I have a function that checks for baseObject properties, modifier properties and controllers (recursively). I still need to add materials but this is quite tricky.

Results:
nodes:499
time:94 memory:39544L


P.S. I'm a little unsure what the memory usage means. Is this the memory consumed by the function during processing? In bytes or kb, or something else?
 
  11 November 2011
Originally Posted by TimHawker: Results:
nodes:499
time:94 memory:39544L


P.S. I'm a little unsure what the memory usage means. Is this the memory consumed by the function during processing? In bytes or kb, or something else?


you are in very good speed and in good memory usage. i don't think that the memory leaking is an issue of this challenge. but it's a right practice to check the memory usage. when you call any of your functions you have to be sure that the function will complete before it eats all memory and crashes the system.
 
  11 November 2011
i know that anyone who works with animation sooner or later meets this task.
i'm not asking everyone for sharing the code (because it might be your personal treasure), but i appreciate the seeing your numbers to compare. thanks.
 
  11 November 2011
This is not the way to do it, but I'll put it out there for people to rip on:


 (	
 	fn findAnimatedNodes =
 	(
 		clearListener()
 		select$*
 		sceneSelection = selection as array
 		arrAnims = #()
 		
 		for i=1 to sceneSelection.count do
 		(
 			local check = false
 			
 			for j=1 to 20 do (try(if (sceneSelection[i][3][j].keys != undefined) then (check = true))catch())
 			for j=1 to 20 do (try(if (sceneSelection[i][4][j].keys != undefined) then (check = true))catch())
 			for j=1 to 20 do (try(if (sceneSelection[i][5][j].keys != undefined) then (check = true))catch())
 			
 			if check == true then (append arrAnims sceneSelection[i])
 		)
 		
 		return arrAnims
 	)
 	
 	(
 		t1 = timestamp()
 		m1 = heapfree
 		a = findAnimatedNodes()
 		format "nodes:%\n\ttime:% memory:%\n" a.count (timestamp() - t1) (m1 - heapfree)
 	)
 	
 )
 



 nodes:1000
 time:585 
 memory:66176L
 


I'm sure this isn't the way to do it, or if I'm even returning the array that you wanted denisT.
I'm interested in seeing other's code
__________________

 
  11 November 2011
99ms
796 keyed nodes found

don't know if I missed something..
 
  11 November 2011
Originally Posted by Ruramuq: 99ms
796 keyed nodes found

don't know if I missed something..


you are not missing, you are finding more than me
which is absolutely possible.
and you do it very fast!

can you post at least the bitarray of keyed object index numbers?
like #{objects[n0],objects[n...], ...}
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 05:55 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.