So I have a geo that instances spheres that move towards the camera, but i’d like to set a fade for the instances relative to the camera.
If it’s too close to the camera i’d like the nearest instances to fade out, but if its too far i’d also like the furthest instances to fade out. So generally, there’s going to be a middle section that’ll be visible.
Any techniques that can do this? I’m assuming glsl or something may be required but not sure.
Perhaps some kind of bounding box to isolate the instances i want in a way where theres the ability to fade, or maybe could be done via materials?
Would be good to share something to get more precise feedback. Regardless, off the top of my head, you should be able to inform the alpha channels of the instances by comparing their positions to the camera’s ( you can get the camera’s position with object CHOP) and then some math or lookups to get a ramp in your falloff zones to apply to the instances’ alpha values.
Probably the trickiest part would be adapting to the orientation of the camera so that you are comparing a relative position of the instances from the camera’s frame of view. You can probably account for this by using Object CHOP’s reference/target functions, or using Transform CHOP to transform the object’s positions to be relative to the camera in order to compare the z from it’s point of view.
Shouldn’t need any GLSL for this, though you could do this sort of thing in a custom shader as well.
I’ll respond with a follow up soon to show where I am at, I’ll try with the Object CHOP approach you mentioned. I feel like GLSL might be a quicker/smoother way but who knows, I appreciate the advice.