Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Multiple Sprites To Same Shader

Discussion in 'Shaders' started by rahulkamra, Nov 7, 2015.

  1. rahulkamra

    rahulkamra

    Joined:
    Aug 16, 2013
    Posts:
    15
    Hi Guys,

    I am very new to unity and was playing around with it. I wanted to make a small shader which takes two texture with different Texture coordinates. I wanted to apply this shader to SpriteRenderer to achieve various kinds of effects for example masking. Can any one tell me the best way to achieve this.



    Thanks
    Rahul
     
  2. StevenGerrard

    StevenGerrard

    Joined:
    Jun 1, 2015
    Posts:
    97
    If you need different texture coordinates, you have to setup first uv channel and scecond uv channel.
    If you just need different "Tiling" and "Offset" for two textures, a custom shader could solve your problem.
     
  3. rahulkamra

    rahulkamra

    Joined:
    Aug 16, 2013
    Posts:
    15
    Thanks for the reply but when i apply one sprite to the custom shader , the uv mapping is done by unity itself.i didnt write any custom code to pass the right uv values, do i need to manually pass different uv values by myself? if so do you have any link to a small tutorial which can help me to pass different uv for different textures.