- Home /
Displacement Map in Unity3D like in Flash?
Is it possible to do something like this in Unity3D?
http://www.andysaia.com/radicalpropositions/?p=120
I've looked into the documentation and found image effect, but that requires pro and it seems like it apply to the whole screen. I want it to apply to one image only, and I don't have pro version :/
Answer by DaveA · Apr 08, 2011 at 05:38 AM
Unity (and many others) calls them UV's. Yeah you can do that. You'd dig into the Mesh and get/modify/set the uv coordinates.
Do you have an example of how to do this? Do I need to write my own shader or something?
No shader, see this page: http://unity3d.com/support/documentation/ScriptReference/$$anonymous$$esh-uv.html
You should read up on UV mapping (google it) to get a sense of what it's about. For a quick-and-dirty effect, you could set each x and y component of each uv datum to a random number between 0 and 1. This will likey be very messed up. Second try, make them a random offset from what they currently are, going a little positive or negative.
If you start with a built-in Unity plane, which is a 10x10 grid, it should work ok. Each uv will be like 0, .11, .22, .33 etc up to 1.0 (note, not actually, but close). So if you were to offset each one by +/- .02 or so, it would probably look pretty much like what you see. You may want to not affect the uv's on the borders.