Skip to content

updating effect data inputs realtime #18

Description

@sneha-belkhale

hey, thanks for the awesome library. one question -- is there a way to update the uniforms of my custom effects realtime without recompiling the shader?

  <script type="script-effect" id="customBlend" data-diffuse data-defaults="0.1">
    void $main(inout vec4 c, vec4 o, vec2 uv, float d){
      c.rgb = o.rgb;
      c.r = pow(c.r,$0);
    }
  </script>

for example, in this code, I want to change the value of $0 from another component in the scene. I can do so by setting this.el.sceneEl.setAttribute('effects', [newEffectString])
but this causes the shader to recompile.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions