Announcement

Collapse
No announcement yet.

How to get interpolation data from transform?

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

  • How to get interpolation data from transform?

    Code:
    RenderView renderView {
    transform=interpolate(
    (0, TransformHex("0A967B3F3D553D3E0000008041368A3806A8 B7B9FFFF7F3F3D553D3E0B967BBFE3E0BAB900000000000000 A02DDD6440000000C0143B88C000000060DEB45540")),
    (1, TransformHex("EA42783F85DF793E000000805D6EB538C642 B4B9FFFF7F3F84DF793EE94278BF38E1B9B900000000000000 80072A6B4000000060310788C000000060DEB45540"))
    );
    fov=0.4173635;
    focalDistance=200;
    clipping=0;
    clipping_near=1;
    clipping_far=1000;
    }
    in fact, transform is interpolation list, however, in app sdk, I can only get
    Code:
    Transform
    instance.

  • #2
    Hello, the interpolated values could be obtained using the Animation API (several examples are available the examples/ folder).

    In AppSDK version 6, there are two methods available, as shown in the CSharp example below.
    In case you use AppSDK version 5, you could use the first one only:
    Code:
    RenderView renderView = renderer.GetInstanceOrCreate<RenderView>();
    if (Globals.GetVRayVersion() < 0x60000)
    {
        // AppSDK version 5 - only standard Animation API available
        // 'UseAnimatedValues' is necessary to be set, in case the standard Animation API is used
        renderer.UseAnimatedValues = true;
        renderer.Time = 0;
        Transform RVT_0 = renderView.Transform;
        renderer.Time = 0.25;
        Transform RVT_025 = renderView.Transform;
        renderer.Time = 0.5;
        Transform RVT_05 = renderView.Transform;
        renderer.Time = 1;
        Transform RVT_1 = renderView.Transform;
    }
    else
    {
        // AppSDK version 6 - Animation2 API available
        // 'UseAnimatedValues' is not necessary to be set, in case only Animation2 API is used
        Transform RVT_0 = renderView.Get_Transform(0);
        Transform RVT_025 = renderView.Get_Transform(0.25);
        Transform RVT_05 = renderView.Get_Transform(0.5);
        Transform RVT_1 = renderView.Get_Transform(1);
        // The standard Animation API is available as well
    }
    ​​
    Last edited by plamen.grozev; 06-12-2022, 12:03 AM.

    Comment


    • #3
      To add to Plamen's answer, you can retrieve the key-frame times with plugin.getKeyframeTimes('propertyName'). Here is a sample Python script:
      Code:
      import vray
      renderer = vray.VRayRenderer()
      renderer.loadAsText("""RenderView renderView {
      transform=interpolate(
      (0, TransformHex("0A967B3F3D553D3E0000008041368A3806A8 B7B9FFFF7F3F3D553D3E0B967BBFE3E0BAB900000000000000 A02DDD6440000000C0143B88C000000060DEB45540")),
      (1, TransformHex("EA42783F85DF793E000000805D6EB538C642 B4B9FFFF7F3F84DF793EE94278BF38E1B9B900000000000000 80072A6B4000000060310788C000000060DEB45540"))
      );
      fov=0.4173635;
      focalDistance=200;
      clipping=0;
      clipping_near=1;
      clipping_far=1000;
      }""")
      renderer.useAnimatedValues = True
      renderView = renderer.classes.RenderView.getInstanceOrCreate()
      times = renderView.getKeyframeTimes('transform')
      for t in times:
        renderer.time = t
        print(t, renderView.transform)
      ​
      The last 2 lines can be rewritten as one in version 6:
      Code:
      for t in times:
      ​  print(t, renderView.getValue('transform', t))

      Comment

      Working...
      X