Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
3
Question by mysteryDate · Mar 10, 2015 at 09:01 PM · shadermeshrendertextureuv

How do I get mesh data into post-processing shader (or render a mesh shader to a texture)?

I have created a water ripple effect to distort surfaces. Right now it creates two texture buffers and ping-pongs between them as in this openFrameworks addon:

https://github.com/patriciogonzalezvivo/ofxFX

I use graphics.Blit() in the update loop to apply the affect, inputting the buffers and writing to a texture that I use as a normal map (which is how the eventual effect is displayed). Unfortunately the powers that be have decided that they want this effect not on flat planes, but on this big-old deforming mesh we have in the game. Applying the normal-map texture I have generated to this mesh is easy, however I need to occasionally disturb the texture to create the ripples.

For this, I need the uv coordinates of some point on the mesh to feed to my shader. A mesh collider is not possible, as the mesh deforms (also, that would be SUPER expensive). The only way I can think of to do this is to bake the mesh every frame, loop through the vertices to find the closest one in screen space (or maybe just use a compute shader), then look up the appropriate uv coordinates, THEN send that to my shader.

Either that or I need to attach my effect to the mesh itself, but either way I need to render to a texture, which does not seem possible outside of the Graphics.Blit functionality. All in all, this seems ridiculously complicated, considering all I need is a single texture coordinate based on a screen/object/or world space coordinate on a mesh (really any of the three coordinates would do). This information is clearly somewhere within Unity. How do I get to it?

alt text

The ripple effect, on a plane.

alt text

The 3D model to which I need to apply this effect.

ripples.jpg (40.6 kB)
avatar.png (189.5 kB)
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

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

CustomRenderTexture ignores "ComputeScreenPos" 1 Answer

Pass "external" uv's to shader 0 Answers

Accessing uv without a texture 1 Answer

Is there a way to merge 2D tiles into one mesh? 0 Answers

How to set float or float4 UV in Mesh. 1 Answer


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