•   9 months ago

How to get value of scalar signal in past few frames, or get a delayed version of scalar signal.

I tried using methods like history and delayBy but couldn't succeed. May be the way I was using is not correct. A code sample would do. Thanks in advance.

  • 3 comments

  • Manager   •   9 months ago

    Good question - I'm going to ask the experts and get back to you! If anyone else knows the answer in the meantime, feel free to respond!

    Thanks,
    Stefanie

  •   •   9 months ago

    ISignal.history(number) is the correct way to reference signal values from the past frames. What issues are you running into using the history method?

    signal = signal.history(1)

  •   •   9 months ago

    //S is for shaders module
    const uv = S.vertexAttribute({"variableName":S.VertexAttribute.TEX_COORDS});
    var color = S.textureSampler(cameraTex.signal, uv);
    var delayed_color = color.history(1);
    const textureSlot = S.DefaultMaterialTextures.DIFFUSE;
    defaultMat.setTextureSlot(textureSlot, delayed_color);
    Spark AR is crashing. :(
    Above code shows camera texture if color passed instead of delayed_color.

Comments are closed.