mograph - time offset animated texture exactly one frame

Become a member of the CGSociety

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

Thread Tools Display Modes
  01 January 2013
mograph - time offset animated texture exactly one frame

i am trying to time offset the texture of mograph clones exactly 1 frame. i found douwes walkthrough on how to sequentially offset the texture via the formula effector here on cgtalk:

that basically works fine but it does start the next clones texture once the old clones texture is animated till the end. and so on.

what i need to achieve is that the time offset of each clone should be exactly 1 frame. i tried to fiddle around with the formula but couldn't wrap my head around it.

here's my scene file so far!

any help with this is very much appreciated!
  01 January 2013
figured it out with douwes other walkthrough on how to time offset animated texture:

with fiddling around with the step effector it works like a charm!

i am still interested in how to solve that with the formula effector. i'd really like to understand how this would work.

  01 January 2013
there is one addon i'd like to mention:

while the solution with step effector works, its not very elegant. changing the amount of clones throws everything of and you'd have to fiddle with step effector settings again :(
  01 January 2013
Try this simple Python Effector :

  01 January 2013
great! thanks!
  01 January 2013
brillant ! Douwe, as always ! Thanks ..
Frenchcinema4D Moderator
my website :
Kamigaz® Project on : Pinterest
  02 February 2013
hi douwe,

thanks again for your help. i've never used the python effector before and i am amazed about the possibilities it offers. just ordered books and try to get my head around python itself.

i got some basic questions about the script you posted and if you got the time i'd really appreciate if you could help me understand it.

import c4d
  from c4d.modules import mograph as mo
  from c4d import utils
  def main():
  	TexFrames = 66
  	md = mo.GeGetMoData(op)
  	if md==None: return False
  	cnt = md.GetCount()
  	carr = md.GetArray(c4d.MODATA_COLOR)
  	#fall = md.GetFalloffs()
  	frame = doc.GetTime().GetFrame(doc.GetFps())
  	for i in (xrange(0, cnt)):
  		value = c4d.utils.RangeMap(frame, i, i+(TexFrames-1), 0, 1, clampval=True)
  		col = c4d.Vector(value)
  		carr[i] = col
  	md.SetArray(c4d.MODATA_COLOR, carr, True)
  	return True

i just added print commands at the end of the script to see what the value of the variables are that you used in the rangemapper.

what i am trying to figure out is how to modify your script so that the textures of each clone are offset by 1 from the very beginning. like so:


and the next frame would be


if you could point me in the right direction, that would be amazing!

Last edited by firewireflow : 02 February 2013 at 03:39 PM.
  02 February 2013
This is not a matter of studying Python, it's just plain old school logic and math.

Instead of the frame number, you take the index number as the start value.
Then you add the actual frame number to that, so the values increase with 1 each frame.
The index number is an Integer, so you need to make that a float.
Now, for the start position you don't want the last clone in the row to display the last Shader in the Multishader, but the one that corresponds with the clone's Index Number, no matter how many clones you set, so you divide the value by the number of Shaders minus 1.
Finally you clamp the result between 0 and 1.

 for i in (xrange(0, cnt)):
		value = max(min(float(i+frame)/(TexFrames-1), 1), 0)
		col = c4d.Vector(value)
		carr[i] = col

  02 February 2013
thanks douwe!
  02 February 2013
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
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
Society of Digital Artists

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

All times are GMT. The time now is 09:47 AM.

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