Yes it is possible.
The easiest solution is to remove the material from your entity.
You would have something like this:
Entity {
property bool visible: true // or ideally, dynamically read from a c++ property or whatever suits you
Material {
id: myMaterial
// stuff
}
GeometryRenderer {
id: myRenderer
// stuff
}
components: visible ? [myMaterial, myRenderer] : []
}
Another solution (maybe a bit more difficult) is to use filters in the Effect you use in your material.
The Effect component will have one or several RenderPasses. Each of these render passes can have filter keys:
RenderPass {
id: myPass
filterKeys: [ FilterKey { name: "PassType"; value: "customFilterIdString" } ] // <-- This line here
renderStates: [
BlendEquationArguments {
...
},
...
]
}
Each render pass can be filtered in your RenderTree Using the RenderPassFilter component. This allow you to skip whole set of object and order the way passes are done. This is a bit more advanced and I don't think you need it if you just want to hide specific objects, but don't hesitate to read the doc and look for examples using these components