Jump to content
philpappas

Random Sequence jpg to each grid

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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.

https://www.sidefx.com/docs/houdini/hom/hou/Parm.html

Edited by Atom

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

you may need to evaluate it yourself 

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

From: *\$F4*

To: *$F4*

 

  • Thanks 1

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×