lightning-js / renderer

Lightning 3 Renderer
Apache License 2.0
50 stars 21 forks source link

HolePunch Shader #358

Closed chiefcll closed 1 week ago

chiefcll commented 1 month ago

Question about the HolePunch Shader - should that cut a hole through every node? Currently the HolePunch only cuts a hole in the single node that it is attached to.

I've tried the hole punch example test and added a node under the node with the hole punch and it doesn't cut all the way through.

const t0 = renderer.createNode({
    x: 0,
    y: 0,
    width: 960,
    height: 540,
    color: 0xff44ffff,
    zIndex: 5,
    parent: testRoot,
  });
image
chiefcll commented 1 month ago

The blue ish ones are the tag. The pink is the t0 node.

jfboeve commented 1 week ago

Typically a shader is only applied to its assigned CoreNode. It only gets texture data and other prop data to work with to adjust the output of texture data or just simply a color. A Shader is not aware of any children nodes, if you want the HoleShader to cut off all content in said CoreNode you will have to use renderToTexture(rtt). However this might be a big performance hit. I would advise a figuring out a different solution depending on what you want to achieve.

chiefcll commented 1 week ago

Thanks