1

In a scene in VR I am trying to implement a shader with shader graph, where at each point of contact of my hand with a cube, the cube gets a simple red dot.

My idea was to create a texture where I changed the color of the concerned vertices and then applied it to the cube, but I didn't find any way to apply a texture to a cube. Then I tried to modify the vertices directly with the "VertexColor" node, but I don't know exactly how it works and the documentation is not very clear to me.

I had also considered using decals, but I am using the URP, for which Unity does not support projectors and would prefer to use a shader.

So if anybody could provide any help, I would be very greatfull.

pf15
  • 33
  • 5
  • 1
    You can pass the contract point to the shader then set the vertex color based on the distance between the vertex and the contract point. – shingo Sep 27 '20 at 10:14
  • Hi, thanks for the reply. I guess I still don't quite understand the Vertex Color node, does it represent a specific Vertex? How would I know with which Vertex I am calculating the distance? – pf15 Sep 27 '20 at 10:21
  • 1
    Every vertex can have a color property https://docs.unity3d.com/Manual/SL-ShaderSemantics.html – shingo Sep 27 '20 at 10:30

0 Answers0