Any good (or bad!) ideas on handling projected movies realistically?

I believe the saying that a picture paints a thousand words, so I’ve attached one to illustrate what I’m trying to do.

I have an actor in-game who runs around a stage. A projector or light source casts a movie towards the actor and a screen behind the actor. The actor picks up the movie on their mesh, as does the screen. The actor casts a shadow on the screen such that there is an actor-shaped shadow on the screen.

Is there any kind of projector that simulates real-world projected non-uniform (meaning a movie, not a single-colored source) light? When I first started thinking about this problem, I thought to place a MovieTexture as a cookie-source on a spotlight. This is not possible as far as I can tell - threads exist from years back, but no good solutions are to be found. While you can assign a MovieTexture as a light’s cookie and Play() it, the Movie will not play at run time.

Using a very large array of Textures could achieve something like this in greyscale (as the alphamaps for cookies are generated from greyscale images), but the amount of textures I’d have to store and spin through every frame precludes this being a realistic solution.

I would be willing to live with a solution that did not have the actor cast a proper shadow against the screen behind him, but Unity Projector components don’t behave the way I need - textures are “projected” onto surfaces as if the projector’s forward direction was normal to the receiving mesh’s face.

Is this even a thing I should be thinking about doing in real-time? Do other Engine’s such as UE or Crytek achieve this? My research suggests no.

You have to use a script to start the video for it to play on a projector:

using UnityEngine;
using System.Collections;
public class PlayProjectorVid : MonoBehaviour {
    public MovieTexture _movie;
    private Projector _projector;
    // Use this for initialization
    void Start () {
    _projector = GetComponent<Projector>();
    _projector.material.mainTexture = _movie;
    _movie.Play();
    }
}

The problem is unlike a real projector, it doesn’t create that outline shadow so you’ll probably have to fake it with another projector or something.

Are you using Unity Pro? If so then a custom shader for your projector that also does a depth pass and check would probably work.

The way your projector is working is fundamentally different from mine. Notice in my attached screen shot how the material is simply duplicated on the quads that intersect with the Projector’s frustum.

Can you zip and share that Unity Project referenced in the YouTube vid?

I am, and I believe that Imbarns is using said custom shader because my projector sure doesn’t work like that :slight_smile:

OK - much better place now… I found an additive shader (will look into depth in a bit) and aside from some gnarly stretching I’m on my way (attached)!