• 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
1
Question by Ryan 3 · Dec 23, 2010 at 09:13 PM · projectorimagesanimated

using a projector to place a animated image on a terrain

I have a image sequence that I want to place on a terrain is that even possible in Unity. I know how to place a animated sequence on geometry with a shader but can I do it this way?

Comment
Add comment
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

1 Reply

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

Answer by Statement · Dec 23, 2010 at 10:22 PM

Given you want to swap images on the projectors material, here's how I tried this out. Put it on the projector. Make sure you use the appropriate projector shader.

public class AnimatedProjector : MonoBehaviour { public float fps = 30.0f; public Texture2D[] frames;

 private int frameIndex;
 private Projector projector;

 void Start()
 {
     projector = GetComponent<Projector>();
     NextFrame();
     InvokeRepeating("NextFrame", 1 / fps, 1 / fps);
 }

 void NextFrame()
 {
     projector.material.SetTexture("_ShadowTex", frames[frameIndex]);
     frameIndex = (frameIndex + 1) % frames.Length;
 }

}

  • As a side note: I had a hard time tweaking my material so it wouldn't look dodgy on the terrain. In case you experience blocky terrain where the projector shoots, try fixing your material shader (projector shader) and make sure your textures are set to clamp.
Comment
Add comment · 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

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Projector displays tiled texture across entire scene 9 Answers

Can Unity bake lighting/mapping from a projector? 2 Answers

Projector projects through game objects 1 Answer

Runtime passages through objects 0 Answers

Projector on parts of terrain? 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges