Giter Club home page Giter Club logo

Comments (3)

peteihis avatar peteihis commented on June 16, 2024

Did a little research...

It would seem that Raytracer.addObject() is not thread safe, when it has to recursively call itself. That happens, when theObject is and ObjectCollection, it this case a ScriptedObject.

Adding some debugging code shows that addObject() always finds both of the first level objects (scripts), but sometimes misses one of the cubes the scripts produce. Setting addObject synchronized naturally takes care of the problem but then we'd lose (some of the) benefit of parallel processing.

As I recall, in the earlier case the scripted object was supposed to create arrow heads out of primitives by boolean operations and in that case the outcome was in most cases only partially made as if the object from the collection had been read before the script had completed the build. That would also explain what happens here.

If that theory is correct, the question would be, how can it be made sure that running the script has been competed before addObject() requests the content?

Edited a bit.

from artofillusion.

peteihis avatar peteihis commented on June 16, 2024

So, the problem is that Groovy is not thread safe! -- This is actually nothing new, it tends to fail with recursion levels and things of that sort too...

I changed the objects so that one of them is a Cylinder and one a Cube. When I render the 1 second movie, sometimes one of the objects is missing entirely and sometimes their position coordinates are confused...

Scripted primitives.zip

I did not quite understand what the mechanism that triggers updating the ScriptedObjects is, but it turns out that SriptedObject.getObjectScript() is visited twice for each rendered frame. Once before Raytracer.addObject() and once after. Apparently the firts one happens in the model scene and addObject() triggers the latter one is for the raytracing scene. With Groovy the latter visit is sometimes missing for one of the objects (typically looks like the 1st one on the list). Other times both objects end up in the same coordinates.

In the coordinates swapping case I find it a bit strange that the coordinates that are changing places are not in the script, they are the Scene position coordinates. Internally the scripts only use new CoordinateSystem().

When I change the language to BeanShell the scripts work as expected.

from artofillusion.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.