Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by najibK · Apr 19, 2018 at 11:16 AM · videoprojectorvideotexture

Project a video Texture using Unity5's Projector

Hi,

As the title says my goal is to use a projector in order to project a Video onto a plane or wichever 3d object. I currently achieved this behavior BUT for an image, not a video, so i have a projector projecting an image in my scene, applying it to all the 3D object who cross the projector's radius if i can call it like that.

I'am assuming that i need to find a way to transform my video into a texture in order to be able to project it the same way as i do with the image.

Surprisingly i tought it would be much easier, i've been searching for tutorials etc since the begining of the week now and it doesn't seems like somebody had the same problem/posted something equivalent somewhere on the internet.

I'am probably missing something i guess, or it's clearly not that easy, anyways all hints/guidelines are welcome :) !

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image najibK · Apr 23, 2018 at 09:18 AM 0
Share

bumping it :p ?

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by najibK · Apr 23, 2018 at 12:00 PM

Hallelujah, despite searching for days i've found a solution ! Remember, the goal is to project a video using Unity's projectors, here are the steps in order to achieve it:

  - 1: Create a Camera

  - 2: Create a RenderTexture an make sure the Wrap mode property is set to clamp (On my screen the RenderTexture name is "SpoutRenderingTexture" but the use of Spout is purely specific to my project and this is just a custom name i gave to my RenderTexture to find it easily)

  - 3: Add a VideoPlayer Component to your cam

  - 4: Set the VideoPlayer's video clip property to your video (In my case "Tom Clancy's Something..."

  - 5: Make sure the VideoPlayer's RenderMode property is set to Far Plane, and the Camera property set to your Camera (step 1)

  - 6: Set your Camera's Target Texture property to your newly created RenderTexture

  - 7: Make sure your camera is facing absolutely nothing, no objetcs crossing the view etc (could be done by using layers to separate the camera and your scene)


Camera Inspector view:

alt text

  - 8: Create an Empty GameObject with a projector component

  - 9: Create a new Material

  - 10: Set your projector's Material property to your newly created Material

  - 11: Go back to the Material you previously created (step 9) and change it's shader to a Projector -> Multiply (else the projection won't work)

  - 11.5: You may need to import Unity projector's package, it's very simple and there is plenty of tutorials so i won't cover it here, but it's extremly straightforward.

  - 12: Your Material will now have 2 texture slots, drag and drop your RenderTexture (step 2) to the cookie slot (the one on  top)

  - 13: Place wichever object you want in your projector's Field Of View and run, you should see your video applying to them ! You can now play with the size, FOV, etc of your objects to make  the projection looks like what you desire !



If you need Help, be free to comment under this post ! Hope it will help some of you as there are no online tutorials for this (at least none i could find by spending 2 weeks searching) :) !

Overall Downsides:

  • Basically the same as an image projection: the last pixels on each borders of your video will repeat themselves infinitly, there is a solution for that implying shader modification to add a Black border around your video at runtime, or doing this yourself using a Video Editing Software

  • Can be a source of high cpu usage if there is too many projections at the same time i guess ?


camera-inspector.png (75.1 kB)
Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Harinezumi · Apr 23, 2018 at 12:35 PM 1
Share

Nice solution, thanks for sharing!
If you want your camera to not render anything else, then use its Culling $$anonymous$$ask property. In this case it may be enough to set it to nothing, but maybe you will need to set it to the layer of the game object on which the VideoPlayer is. Creating a new layer is a good way to only render by this camera.

avatar image najibK Harinezumi · Apr 23, 2018 at 12:39 PM 1
Share

God, read about layers a while ago during my searchs, that's actually better than what i do but i did not tought about it! I'am adding it as a secondary solution, thanks ! :)

avatar image norskov · Aug 03, 2018 at 05:55 PM 1
Share

Thank you for this post! Very informative!

I was able to achieve the same process rendering the video player directly to a Video Texture. Is there a reason to have the video player render to the camera first?

avatar image najibK norskov · Aug 04, 2018 at 07:32 AM 0
Share

Hi ! This was posted month ago, i should have came up later to answer you, after i could verify why i did this, but for the moment the project is closed and i don't have access to the source files !

To answer your question anyway, i believe it was a work around at the time, i remember struggling with the video texture and so i thought about just applying the video to a camera and then catching it's ouput on a video texture. I don't know if i wasn't able to apply my video to a videotexture because of an older version or even maybe it was due to the fact that i was using the "free" edtion, god only knows, maybe i'am even dumb and just wasn't able to make that work with video textures even tho it should have been easy in the first place.

Anyway i'am happy you found that interesting :) !

Your answer

Hint: You can notify a user about this post by typing @username

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

Answers Answers and Comments

82 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Unity Movie Texture - Skipping First or Last Few Frames 0 Answers

VideoCodec module in Unity 0 Answers

I'm using a Chromakey to remove the green screen in my video but this has made the object visible through walls. Dose anyone know a fix? 0 Answers

Speed up video play 2 Answers

How to Project a video from a game object? 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges