I'm wondering, which algorithm is used for projectors. It seems that an arbitrary number of projectors is supported - even on mobile. Since I'm mainly developing for mobile platforms, I would like to know how the algorithm works to better understand how it would impact performance if used excessively.
I've already done some research, and those are the approaches I have found so far:
use a deferred renderer and the g-buffer (I guess that wouldn't work on mobile?)
create a tri-overlay and use alpha-blending
combine texture with projcted texture - precalculate the texture (in every frame)
Is Unity's algorithm one of those approaches or something completely different?
I have added some screenshots from a simple scene which contains 1 terrain, and 33 projectors which are using 3 different projection-materials/textures.
The scene without projectors:
The scene with projectors:
So, to me it looks like the geometry which receives the projections is rendered number-of-projectors times (in this case 33 times). Am I seeing this right? That could have a serious performance impact especially on mobile platforms, i guess.
jewel FWIW. as a "rule of thumb" i've never been able to use more than "a few" projectors in a scene. I've always assumed everyone else found that to be the case. Say 5 tops to put a number on it. Dunno if that helps you.
Answer by Jessy
Sep 18, 2012 at 07:39 PM
All a "projector" is, is another rendering pass. You can do whatever you want with it, but Unity sets up some special variables for it:
Question, is it one extra pass per projector, or one extra pass for all projectors? Thanks
(Sorry if this is incredibly lame question for you :) )
It's not lame at all. I actually don't know how this is handled. I bet that when you use a projector, it breaks batching. I'd have to go check it out, too, so please let us know what the stats window tells you.
I have added some screenshots to my question which include the stats window.
The big thing to notice is draw calls. Compare your two screenshots. On one, there's 53 draw calls. On the other, 1752 draw calls. 53 x 33 = 1749, so you can see that the draw call count is a direct result of using that many projectors.
fantastic analysis screenhog, thanks for that!
Answer by tatoforever
Jan 13, 2013 at 12:58 AM
Projectors actually works similar to the way post-process works. It simply renders what ever geometry it's on its frustum and then project from that POV the texture in projector (it's camera) space. I'm not sure if it does the projection in the same pass (while rendering the depth information) or in a extra pass but what i know is they shouldn't be there, they are extremely heavy. It is possible to do deferred decals in forward rendering using a depth+normal texture (well at least i got some ideas how to do it). ^^
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
To help users post good questions and use the site effectively we have posted a user guide. Please check it out.
Answers and Comments
14 People are following this question.
A node in a childnode?
Bullet Marks On Moving Object : 2D
Material projected to players position.
Strange Unity Projector Artifacts / Flickering when on Meshes
Render planes onto terrain? What to use instead of projectors?