adding an offset to the frame number of an image sequence

   4836   7   2
User Avatar
Member
5 posts
Joined: May 2014
Offline
Hey Guys,

I am trying to create a 2D crowd with cards of random textures offset in time. I have 3 cards, each with materials being copied onto a grid with a switch sop. I would like to create a variable so that I can offset an image sequence randomly($F+variable) playing in the material that is copied onto the grid. I tried to create an expression in the file name but it doesn't seem to be able to talk to the copy properly. Any ideas?
User Avatar
Member
336 posts
Joined: Dec. 2014
Offline
My bet is you can do this with copy stamp expression on a material with local overrides, but I haven't tried it
User Avatar
Member
336 posts
Joined: Dec. 2014
Offline
Ok, I've wondered about the same thing so I spent a few minutes figuring it out here's what you do: Copy your cards and turn on stamp inputs, write a stamp expression to offset the image sequence, something like int(fit01(rand($PT),1,50)) which would offset randomly between 1-50, let's say you call that “textureOffset”. On your material SOP add an override for the map sequence, on a constant shader it's called dif_map. Set the parameter type to string and put your file path there, but replace the $F with `($F)+(stamp(“../copy1”,“textureOffset”,0))` Works great.
Edited by AndyW - Nov. 18, 2016 16:11:32
User Avatar
Member
5 posts
Joined: May 2014
Offline
moogtastic
Ok, I've wondered about the same thing so I spent a few minutes figuring it out here's what you do: Copy your cards and turn on stamp inputs, write a stamp expression to offset the image sequence, something like int(fit01(rand($PT),1,50)) which would offset randomly between 1-50, let's say you call that “textureOffset”. On your material SOP add an override for the map sequence, on a constant shader it's called dif_map. Set the parameter type to string and put your file path there, but replace the $F with `($F)+(stamp(“../copy1”,“textureOffset”,0))` Works great.

I was definitely trying something like that but maybe my expression wasn't written properly. Thanks, will try this!
User Avatar
Member
5 posts
Joined: May 2014
Offline
Thanks so much! I probably never would have figured out adding the material override! Cheers! Works great!
User Avatar
Member
24 posts
Joined: Nov. 2006
Offline
I'm trying the same thing, do you have a example hip?
User Avatar
Member
63 posts
Joined: July 2018
Offline
This is Redshift specific, but it's what I've got handy. Should be able to adapt it:

-- First edit the parameter interface on the RS material builder VOP and drag the filename field from the texture node inside the VOP into the interface, effectively promoting that file path field so it is exposed on the VOP.

-- Then add a new stylesheet and style to your object
-- Add a target: point instances
-- Add a condition: Point name or path attribbute: value=*
-- Add an override: Set material type=Material override path=/mat/path_to_your_shader_VOP
-- Add an override script: type=Material Parameter Override name=the name of the parameter you promoted above (tex0 by default) Override type=Attribute binding Value=myFilePath

Then add an attribCreate node to your SOP chain for the packed objects

Make a string attribute myFilePath and set it to whatever file path you want complete with any expressions to offset the frame numbers per point instance. For instance: /path/to/my/image/sequence/myImgSeq.`padzero(4, $F + ($PT*10))`.exr

Offsets each instance by 10 frames.

I'll say that I wish this was easier. It's such a common thing and I still keep this stashed away because everytime I need to do it, I forget.
madebygeoff.com
User Avatar
Member
24 posts
Joined: Nov. 2006
Offline
ok cool! I'm going to make a test. Does this method work in viewport as well?
  • Quick Links