Announcement

Collapse
No announcement yet.

Maxscript bug / my dumb coding with trace sets?

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

  • Maxscript bug / my dumb coding with trace sets?

    Hi Folks!

    A friend is working on a shot where he has to make gradually smaller copies of a scene with a camera zoom in, he wants all of them to look the same so that it can loop seamlessly. If we make the lights in each scene include only the objects in the max file, when we xref it multiple times we get consistent lighting. The next issue is now reflections where we don't want a model from one xref to reflect anything from another. Since there's a high object count I want to script trace sets so that it'll loop through all geo in the scene and add in every object in the scene except itself. This should be fine but I'm getting a dependency loop error. Any thoughts as to why the assignment doesn't behave?

    Here's my code which is less elegant than dave wortley's, who is also getting the same error:

    Code:
    theObjs = geometry as array
    
    for i = 1 to theObjs.count do
    (
    format "debug: working on object % \n" theObjs[i].name
    theTempArray = (for g in geometry where [URL="http://g.name/"]g.name[/URL] != theObjs[i].name collect g)
    print theTempArray
    theTraceSet = vrayGetTraceSets theObjs[i]
    theTraceSet.reflect_exclude = theTempArray
    --theTraceSet.reflect_exclude_type = 1
        --theTraceSet.refract_exclude_type = 1
    )
    On a simple scene with a box, sphere and a teapot here's my error log:

    Code:
    #($Box:Box001 @ [-1873.043213,223.505310,0.000000], $Sphere:Sphere001 @ [2674.760010,376.476868,0.000000], $Teapot:Teapot001 @ [6023.598633,310.325775,0.000000])
    debug: working on object Box001 
    $Sphere:Sphere001 @ [2674.760010,376.476868,0.000000]
    $Teapot:Teapot001 @ [6023.598633,310.325775,0.000000]
    debug: working on object Sphere001 
    $Box:Box001 @ [-1873.043213,223.505310,0.000000]
    $Teapot:Teapot001 @ [6023.598633,310.325775,0.000000]
    -- Error occurred in i loop; filename: ; position: 717; line: 19
    --  Frame:
    --   i: 2
    --   theTempArray: #($Box001, $Teapot001)
    --   theTraceSet: VRayTraceSets:V-Ray trace sets
    -- Runtime error: Assignment failed, possible dependency loop, $Box:Box001 @ [-1873.043213,223.505310,0.000000]

    Any thoughts?

  • #2
    Ah, seems like it's the same max bug from this post - https://forums.chaosgroup.com/forum/...-sets-question

    Comment


    • #3
      Instead of excluding everything - you maybe could just include what needs to be reflected. This should avoid the overlap between your trace sets that is leading to the dependency loop. There needs to be atleast 1 object in the trace set or it doesn't work (that might be a V-ray bug or maybe there is some weird reason for that). You could make that one object anything (e.g. a Dummy).

      So like this (assuming an object named "Dummy001" is in the scene):
      Code:
      .reflect_exclude = #($Dummy001)
      .reflect_exclude_type=1 -- include instead of exclude
      Looking add your code you maybe already tried that at some point and run into that. Just make sure your main loop skips the object used as a dummy in the include list and also that the object actually has a trace set. As far as I see form my experiment one hast to add a trace set first using vrayAddTraceSets(). In your code I only see a call to vrayGetTraceSets()

      Best Regards,
      Daniel Schmidt
      Daniel Schmidt - Developer of psd-manager

      Comment


      • #4
        Ah, that's interesting about the one object first!

        Yep, I was thinking the same thing with the include (that's the ultimate aim, to try and ring fence things to only the scene) but I wasn't aware about manually adding something in first. P.s. are you in canada at the minute? You might be one row away from me

        Cheers!

        John

        Comment


        • #5
          Germany John - so far far away I found another trick to avoid dependency loop. Let's say you have multiple teapots and multiple spheres that should exclude each other. So no teapot should reflect a sphere and no sphere should reflect a teapot. You would run into the dependency loop issue.To avoid it one can group the objects. Now instead of excluding all the teapots individually each sphere excludes just the "group of teapots" and all teapots exclude the "group of spheres". No dependency loop.

          Daniel
          Daniel Schmidt - Developer of psd-manager

          Comment


          • #6
            We've a daniel schmidt in here too and he's a bit of a max ninja it seems! Nice tip on the groups, we're at 182 objects in the scene which all have to just include the other 181 objects, I don't think things can be in multiple groups in max if I remember rightly due to the added group transforms conflicting but i'll try the manual add of one object now and see how it goes!

            Comment


            • #7
              Yeah pretty much any option comes back with that dependency loop issue - either the regular dependency loop or the max param block :/

              Comment


              • #8
                If I got the idea right - you want to isolate the lighting and reflections of the scene (a room). So that you can place multiple instances of this complete room/scene into another max file. The rooms should then not influence each other in terms of lighting and reflections, refractions. So can't you put all objects and lights in the room scene inside 1 large group? Then give all objects a trace set with just that 1 group in it (as include list). Same for the lights - use an include list for the 1 group. I tried this all manually and it worked. I made an array of rooms and they did not influence each other. (I used containers for the instancing).

                Are you sure your script does what you want it to do? Maybe you have tried too many things in that scene already and need to clean all trace sets first once so the script gets a fresh start.

                Daniel
                Daniel Schmidt - Developer of psd-manager

                Comment


                • #9
                  I made a big dumb assumption about groups so thought i'd have to make an individual group per object containing all the other objects since the trace sets would error if you tried to assign an object to not be able to reflect itself- thanks again for the clarification Daniel, I'll do that this evening!

                  Comment


                  • #10
                    This group trick looks nteresting, but groups are adding hierarchy in 3dsmax, so the transform controllers would be a mess to set and overkill with a lot of objects... 3dsmax doesn't like huge hierarchy.
                    I still think that weak references is the way to go, Vlado never updated me on that so I am still in the dark about why not?

                    Comment


                    • #11
                      Same issue that stops distance tex maps from working with each other too I think?

                      Comment

                      Working...
                      X