V
V
viruseg852019-02-09 19:23:33
Unity
viruseg85, 2019-02-09 19:23:33

How to create a shader that fills a mesh plane with two textures?

I want to learn how to write shaders. And for training I chose the goal to create 2d water. For further experiments, we need to create a simple shader that will fill the mesh with two textures, one of them should be at the top and fill only horizontally, and the second texture should fill the rest of the space, but not replace the first one if there is not enough space. I turned Google over for all the queries that came to mind, but did not find what I needed.
Here are examples of what we would like to get as a result:
5c5efd391e403453277230.png
If the height of the mesh is equal to the height of the first texture or less, then the second texture should not be visible at all:
5c5efd40408d4022647121.png
If there is not much room for the second texture, then it should be clipped so that the first one always fits completely vertically:
5c5efd48c0b09063144639.png

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question