Jump to content

Random Sequence jpg to each grid


philpappas

Recommended Posts

i have this geo and i want to apply random textures from a folder hierarchy.

i friend of mine helped with some python code, so now i can select a folder randomly and then get the first image of the sequence with a little tweaking i managed to plug it in a quickshade and converting the file numbers to $F4 or $F3. so it should read the sequence

BUT!! although i have the iterations attribute of the foreach meta node as a seed for the python script, the same image applies to all primitives.

What is missing?

Side question: why are the uvs rotating?

any tip much appreciated, houdini forums are bit dry right now

random_sequences.hip

untitled.bgeo

Link to comment
Share on other sites

i've done some more progress and i am one step before nailing this!! so within a python node i read folders and take the first image from each. i also convert the last part of the path to $F3 or $F4 depending on the sequence.
So i have a list of all the paths and i write them as detail attributes, so that i can choose in a random fashion later and apply to each primitive.
Problem occurs, the LAST problem i hope, when try to read this detail string attribute (Chmm.pngSequences/image.$F3.jpg) from a material node like this `@path0` using the local material override

if i expand the expression this is what shows up Chmm.pngSequences/image.$F3.jpg

but when i write a path directly to that string field this is what shows up Chmm.pngSequences/image.001.jpg

the second attempt shows that the sequence gets recognised but for some reason through the detail string attribute the $F expression doesnt get recognised.

Hope this is clear,any tips much appreciated!

random_sequences_V2.hip

untitled.bgeo

Link to comment
Share on other sites

  • 4 weeks later...
On 9/15/2019 at 11:40 PM, Atom said:

Before you store them on as the attribute, you might want to use one of the various .eval() methods to resolve the path, instead of using the .unexpandedString().

Check out the Value section.

i'm sorry for the late reply seems i forgot to subscribe to the thread.

Can you explain a bit more?Can you provide an example?

inside my python node i just export a string at the end "img_$F4.jpg" but this string doent get evaluated inside my principled shader for some reason(?) how can i use the eval() method?

So right now i have a string primitive attribute with an image sequence path like "img_$F4.jpg" and i pass this attribute to my principled shader in base color texture.

its not working. if i dont add the $F4 and leave it at img_0001.jpg it works, but doesnt recognise the sequence.

So my goal here is to have multiple sequences and assign them to different grids

Link to comment
Share on other sites

On 9/16/2019 at 1:14 AM, konstantin magnus said:

It can be more efficient to apply various textures inside a shader: 

 

thanks for sharing that but if im not mistaken i dont think its the same thing im looking for. They use one image sequence as a list of images and assign them to different grids.

i have multiple sequences that i want assign to different grids and i want them to play. my problem so far is that i cant get tha $F to work when its coming inside a primitive string attribute.

i also tried making a simple material builder with an image string parameter which i override inside sop level. also didnt work. i think i;m missing something simple here but i have no clue.

Here is my file take a look

test.hip

Link to comment
Share on other sites

51 minutes ago, anim said:

you may need to evaluate it yourself 

you can use Attribute String Edit, specify your attrib and do 

From: *\$F4*

To: *$F4*

 

ohhh snap this works didnt know about attribute string edit!

only problem is that the textures do not show up on the viewport but only on render for some reason, just an average solid color of the image

no it works. this method with the image path inside an attribute overriding the material texture is straightforward but doesnt play live. the fps drop to 1.5.

do you think this is normal? considering i'm loading 50 different sequences. Could there be another technique that plays live?

 

Edited by philpappas
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...