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 rageingnonsense · Oct 21, 2015 at 03:57 PM · shadermeshprojection

Project a shape using a mesh

I want to be able to project a texture onto a surface, using a mesh as the "frustum" instead of simply a perspective or orthographic one, but I am unsure how to do this.

Consider the following:

alt text

This is a mockup made in Blender that tries to describe what I am looking to do. Instead of showing the texture of the floating mesh on the mesh itself, I want it to project (as shown by the green arrows) onto the surface below. This is a simple example with a flat surface, but I would also like it to to be able to project onto a bumpy surface, other objects in the way, etc.

I can't simply wrap the mesh over the surfaces I want to project onto, as the vertex resolution is almost guaranteed to not match the surfaces below.

I'm looking for a solution that uses some sort of projection shader, but all examples I have found of a projection shader use some form of a frustum to project. I could not find anything that would project using the vertices of a mesh like in the example above.

How could I go about getting the desired effect? I considered trying to make due with default projectors, but as the display area gets larger, the projection gets fuzzier. This is not desired; it should project as a decal.

The player would be creating these meshes, and they will very often have a curvature to them. The texture of the mesh they would be creating would be set to repeat (via UV manipulation during creation) As such, I need the area of projection to match the mesh the player is creating, and have it one for one projected onto the surface.

How could I go about getting this effect? Is a projector even the right thing for this?

projetion-example.png (189.7 kB)
Comment
Add comment · Show 3
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 Baste · Oct 21, 2015 at 04:38 PM 0
Share

This sounds like something you'd use a decal system for. There are some free ones on the asset store.

Another solution would be to figure out what parts of the mesh you're projecting onto you're over, and then set the UVs on that. That's a lot harder, and might be slower, but you'd get complete control over how things look.

avatar image dudester · Oct 21, 2015 at 07:40 PM 0
Share

id vote projector , just set the projector to exclude every other layer besides the layer the mesh is on , then use alpha cutoff shader so it only shows that shape.

avatar image rageingnonsense · Oct 21, 2015 at 08:16 PM 0
Share

@dudster: That won't work for me, as I use the uv's of the mesh I want to project from to create the desired image.

I'm thinking maybe the best thing I could do is create the mesh (which is procedural, and always flat), and hug it as close to all objects it is above as possible. I'm concerned about the resolution of the mesh not being perfect though.

I also thought about creating a mesh with volume that is used as a cookie cutter to create a real mesh that perfectly conforms to the triangles within it, but it feels daunting.

0 Replies

· Add your reply
  • Sort: 

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

33 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

Related Questions

Project vertices on surface, make a shape 1 Answer

Shader to make a quad work like a canvas 0 Answers

Water on a non-planar mesh 0 Answers

Altering color / alpha on a Game Object 1 Answer

How to determine shader center? 0 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