Announcement

Collapse
No announcement yet.

MultiSubTex - "Loop through textures" by particle ID?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • MultiSubTex - "Loop through textures" by particle ID?

    I've got a string of x-mas lights wrapped around a tree using tyFlow and I'm trying to cycle through an array of colors by using the generated particle ID's. I'm able to get a random assignment, but not one where it repeatedly loops through the options. What am I missing?



    Click image for larger version

Name:	2022-11-17 14_43_16-V-Ray Frame Buffer - [100.0% of 1689 x 1267].png
Views:	181
Size:	1.55 MB
ID:	1165661Click image for larger version

Name:	2022-11-17 14_45_09-Window.png
Views:	117
Size:	158.1 KB
ID:	1165663 Click image for larger version

Name:	2022-11-17 14_44_47-Window.png
Views:	116
Size:	189.2 KB
ID:	1165665
    Attached Files

  • #2
    Originally posted by studiotribe View Post
    I'm able to get a random assignment, but not one where it repeatedly loops through the options. What am I missing? ​
    I'm not sure what you mean. It's random - what kind of loop are you referring to? Or maybe you wish to have those 5 textures randomized and afterward looped?
    Aleksandar Hadzhiev | chaos.com
    Chaos Support Representative | contact us

    Comment


    • #3
      Originally posted by hermit.crab View Post

      I'm not sure what you mean. It's random - what kind of loop are you referring to? Or maybe you wish to have those 5 textures randomized and afterward looped?
      Thanks for the response. I don't want the string of bulb colors to be random. I want them to cycle through the list of texture inputs repeatedly in order so that particle ID:

      ID 1 = texture 1
      ID 2 = texture 2
      ID 3 = texture 3
      ID 4 = texture 4
      ID 5 = texture 5

      –[repeat cycle]–

      ID 6 = texture 1
      ID 7 = texture 2
      ID 8 = texture 3
      etc..
      .
      .
      .

      Comment


      • #4
        You may likely be able to do this directly in TyFlow, but one method would be to use a Krakatoa MagmaModifier to set the MaterialID to he ParticleID Modulo (%) some integer. Krakatoa is now free.

        EDIT: Depending on how your TyFlow is setup you could use the MaterialID to node to cycle material IDs.

        I would make the strand of light with RailClone personally.

        Click image for larger version

Name:	image.png
Views:	118
Size:	42.5 KB
ID:	1165734Click image for larger version

Name:	image.png
Views:	102
Size:	24.4 KB
ID:	1165735
        Last edited by Joelaff; 18-11-2022, 10:10 AM.

        Comment


        • #5
          ​Another thought would be to use a script operator in TyFlow. (Though I would see if you can make it happen with the basic MaterialID operator first.)


          Something like this in the script, replacing this function in the sample script.

          Download the text script here: MatIDScript.zip

          Copy and paste that text into the script in a script operator.

          Also enable float1 for input, and make sure you name it exactly as shown (case included) "Num_IDs" (or modify the script).

          Now you can adjust the value of Num_IDs (set to 5.0 in the example) to change the number of IDs to loop through.

          Click image for larger version  Name:	image.png Views:	0 Size:	204.1 KB ID:	1165742

          Note that script could be optimized further, but given the number of lights in the string (thus a low particle count), who cares?

          Script Docs here

          EDIT: Turning this "Allow static evaluation" option on could speed it up (but given the particle count you have it won't matter):

          Click image for larger version

Name:	image.png
Views:	101
Size:	46.0 KB
ID:	1165743
          Attached Files
          Last edited by Joelaff; 18-11-2022, 11:01 AM.

          Comment


          • #6
            Thanks so much for your suggestions. The simplest solution looked to be cycling the Material ID within tyFlow, but for some odd reason tyFlow doesn't cycle correctly using a "Birth Spline" source. I'll try your script next.


            Click image for larger version

Name:	image.png
Views:	106
Size:	111.1 KB
ID:	1165746
            ​​​​​​

            Comment


            • #7
              Maybe if you birthed one particle per frame it would work?

              Comment


              • #8
                Originally posted by Joelaff View Post
                Maybe if you birthed one particle per frame it would work?
                I didn't have any luck getting that to work, but the script you shared worked like a charm. Thanks again for your help with this.

                For the folks back at VRay HQ, it would have been nice to have an option to handle this at the shader level. Within the paramaters for the MultiSubTex node, it would've been great to have the option to "Loop through textures" from the particle IDs. Currently for the "Loop through textures" option to be available, we can only source the ID from the "Object ID" or the "Face Material ID". Is it possible to add the particle ID as an option here?


                Click image for larger version

Name:	image.png
Views:	116
Size:	21.6 KB
ID:	1165755

                Comment


                • #9
                  Glad you got it to work. Yes, would be awesome if the VRay tools could use the Particle ID. It wouldn't surprise me if there was already a way that we are just not seeing.

                  Comment


                  • #10
                    Looks like you can also use a Position Object (Select the spline) set to Vertices In Order with a standard Birth, and then use the Cycle mode of Material ID (birth one per frame and cycle one per frame, for instance). However, it looks like Vertices In Order starts at vertex 1 ion the spline nstead of vertex zero, which I think is a bug. Of course I am running 1.007 Pro. Maybe this has been fixed.
                    Last edited by Joelaff; 18-11-2022, 04:47 PM.

                    Comment


                    • #11
                      [QUOTE=studiotribe;n1165754Currently for the "Loop through textures" option to be available, we can only source the ID from the "Object ID" or the "Face Material ID". Is it possible to add the particle ID as an option here?​[/QUOTE]

                      I've logged an improvement request (Internal bug-tracker id: VMAX-12798 ) about it.

                      Aleksandar Hadzhiev | chaos.com
                      Chaos Support Representative | contact us

                      Comment

                      Working...
                      X