• 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 Reverend-Speed · Jul 08, 2019 at 01:44 PM · projectorspotlightnormalmapdecal

How can I project a normal map onto a wall?

Hey there. I'm looking to project a normal map onto a wall, so that I can move the image of the object (a stereo jack) across multiple surfaces, making it appear that the object is moving beneath the deforming surface.

  • I've done a little research with Projectors (from here), but I'm unsure of how to get that shader to work with normal maps, or integrate with the Standard Shader.

  • I've also looked into cookies for Spot lights, but these don't seem to be able to use normal maps.

  • I've found a Decal Projector Component, but there doesn't seem to be any documentation for it.

Can anybody suggest a way to project normal maps onto surfaces? I have a normal map and a mask ready...!

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
1

Answer by Pangamini · Jul 08, 2019 at 02:48 PM

What projector does is, that it renders all the mesh renderers within its frustum with a projector's material. This material should use a special shader that reads values

 float4x4 unity_Projector;
 float4x4 unity_ProjectorClip;

to map the textures in a projector-calculated space. See any default projector shader. Now apparently this projector does not render the material as lit, rendering only the first pass or something. BUT, you could write your own projector using Graphics.DrawMesh which lets you render a mesh by including it in the full pipeline (causing it to be lit, receive shadows, etc)

So what you need is to write a script that:

  1. Determines which mesh renderers to project to (either by querying the scene, or simply by assigning references to the projection target renderer)

  2. Calculating the unity_Projector and unity_ProjectorClip and setting them as global shader values

  3. Use a projector shader that utilizes these, but is a surface shader

  4. Call Graphics.DrawMesh, with your projector material and matrix and mesh from the meshRenderer

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 Reverend-Speed · Jul 08, 2019 at 03:30 PM 0
Share

Okay. That gives me some places to start researching. I'm still confused, but thank you. =D

avatar image Pangamini Reverend-Speed · Jul 08, 2019 at 03:31 PM 0
Share

Feel free to ask. I don't have an exact solution in front of me, but this would be the way to go

avatar image Reverend-Speed Pangamini · Jul 10, 2019 at 12:21 PM 0
Share

I'm afraid that "Legacy projectors aren't compatible with any kind of built in lighting systems. So no, they cannot do normal maps", or so I've been told.

I case anybody else is interested in this topic, however, I did manage to dig up some interesting documentation on projector shaders.

In addition, I've found documentation for the Decal Projector Component here, though I'm unsure how I'm going to use this in my current project - really, a projector would have been the ideal way to get the little objects crawling under the skin of the wall... =(

Show more comments

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

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

108 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 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

Material with only a normal map 0 Answers

How can I "generate a mesh" for a projected image or decal? 0 Answers

a shader or decal that only renders the normal map 0 Answers

Shader that only shows mesh at the point where it is colliding with terrain? (A projector?) 0 Answers

Help 3D Enemy Detection Visual Feedback 3 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