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

Color a texture at contact positions

Discussion in 'Editor & General Support' started by HaggiKrey, Apr 11, 2022.

  1. HaggiKrey

    HaggiKrey

    Joined:
    Apr 19, 2018
    Posts:
    10
    Hi,
    my problem is the following: I have to distribute splashes of paint over a table, a lot of splashes. So my idea was to create a splash, and at the contact points of the splash with the table, I modify the color of a texture (visualized in the image with the splash on the right side). What I was able to do until now is: Load a splash (created in Houdini and exported via VAT) and I was able to create a shader graph which can paint mouse strokes on a texture via shader graph (the attachted image with the brickwall).

    Now I have no idea how to combine these two elements since the splash is a shadergraph as well. Is there a way to use the output of a shader graph as input for another? Or are there any other possibilities to do that, with particles or someting like that?
     

    Attached Files:

  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,951
    Last edited: Apr 12, 2022
  3. HaggiKrey

    HaggiKrey

    Joined:
    Apr 19, 2018
    Posts:
    10
    Thank you very much, very appreciated, I'll have a look at it.
     
  4. HaggiKrey

    HaggiKrey

    Joined:
    Apr 19, 2018
    Posts:
    10
    Okay, I had a closer look and your code and scene setup was quite helpful for a beginner like me.

    Unfortunately it does not help very much in my case. To visualize it I made a small video from Houdini.


    I was able to import the splashes via VAT into Unity. But now I'm stuck because I have no idea how to transfer the contact areas between the splashes and the grid to the texture of the grid. Is that possible?
     

    Attached Files:

  5. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,951
    You would need some kind of visible object (eg, Renderer), either some generated geometry (the way I do it in the example project), or else a sprite with your textures on them. The presence of those visible objects is what the Camera then "paints" onto the target texture.
     
  6. HaggiKrey

    HaggiKrey

    Joined:
    Apr 19, 2018
    Posts:
    10
    Ah, now I think I have a clue how to proceed, thanks.
     
    Kurt-Dekker likes this.