- Home /
Detect % of sprite is visible from camera
Hi, everyone! Pretend I have a number of cubes in a scene. Some of them have pictures on some sides. I want to determine approximately what percent of a certain picture area is visible by a player. Cubes can be out of sight at all, cubes can overlap each other (ex: one behind another) and so on. Any ideas? :-) Thanks.
this is just a stupid guess, but since this sounds like doing everything that the rendering pipeline is doing already (culling and such), maybe it's possible to write some shader that counts discarded and written pixels per object. at least this way you'd have the percentage of the current, the player facing, area.
Thanks for reply! This can be not a stupid guess, but I have no idea how to do this. I'm too weak in shader program$$anonymous$$g. Not even sure if it is possible. But I guess this is a good opportunity to improve my skills. :-)
Answer by AvatarMars · Dec 24, 2021 at 05:04 AM
Did you ever manage to figure this out? I'm trying to do a similar thing.
Your answer
Follow this Question
Related Questions
pixel perfect 2d Sprite in 3d world with isometric camera, how to do it right? 1 Answer
I don't want to use sorting order? 1 Answer
What is the meaning of 1:1 in unity? 1 Answer
Is there a way to mask out a sprite layer 0 Answers
Sprite not displaying when I add a line of code that moves the main camera to another sprite 0 Answers