x


What is the algorithm used behind projectors?

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:

  1. use a deferred renderer and the g-buffer (I guess that wouldn't work on mobile?)
  2. create a tri-overlay and use alpha-blending
  3. combine texture with projcted texture - precalculate the texture (in every frame)

Is Unity's algorithm one of those approaches or something completely different?

UPDATE:

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:

Scene with projectors

The scene with projectors:

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.

more ▼

asked Sep 18, 2012 at 06:54 PM

j00hi gravatar image

j00hi
16 2 2 5

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.

Sep 21, 2012 at 01:55 PM Fattie
(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

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:

http://en.m.wikibooks.org/wiki/GLSL_Programming/Unity/Projectors

more ▼

answered Sep 18, 2012 at 07:39 PM

Jessy gravatar image

Jessy
18.4k 208 178 293

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.

Sep 18, 2012 at 08:12 PM Jessy

I have added some screenshots to my question which include the stats window.

Sep 21, 2012 at 01:52 PM j00hi

fantastic analysis screenhog, thanks for that!

Sep 21, 2012 at 04:41 PM Fattie

So, is there anything optimized besides that most likely the VBO switches and the texture switches are minimized?

Sep 21, 2012 at 06:15 PM j00hi

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.

Sep 21, 2012 at 04:33 PM Screenhog
(comments are locked)
10|3000 characters needed characters left

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). ^^

more ▼

answered Jan 13, 2013 at 12:58 AM

tatoforever gravatar image

tatoforever
36 1

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x6907
x162

asked: Sep 18, 2012 at 06:54 PM

Seen: 1583 times

Last Updated: Jan 13, 2013 at 12:59 AM