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?
adding an offset to the frame number of an image sequence
5669 7 2- chrisribar
- Member
- 5 posts
- Joined: May 2014
- Offline
- AndyW
- Member
- 339 posts
- Joined: Dec. 2014
- Offline
- AndyW
- Member
- 339 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
- chrisribar
- 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!
- chrisribar
- Member
- 5 posts
- Joined: May 2014
- Offline
- scorpes
- Member
- 25 posts
- Joined: Nov. 2006
- Offline
- made-by-geoff
- Member
- 79 posts
- Joined: July 2018
- Online
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.
-- 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.
- scorpes
- Member
- 25 posts
- Joined: Nov. 2006
- Offline
-
- Quick Links