I have built my first visual shader, a lidar effect. Now I would like to add extra lidar dots at the edges of objects. I figure that I need to code a custom visual shader node, that return 1 around the edges and 0 elsewere. I dont know how to do that. Most examples I find use a quadmesh as a lens to add the effect, if I understand them correctly, and I cant use that. I dont want a wireframe, just the actual edges of the object.

Any help appreciated. Are my assumptions correct? How do I code this?

  • xyz replied to this.

    xyz Thank you, but I have gone through all of them, and I dont think I can use any of them. Most use a quadmesh as a "lens" to apply the effect to the screenspace. But I need the effect to use it to modify the calculation in my lidar effect shader, to add additional lidar dots along the edges of objects.
    Is there no way to calculate what is a visible edge on a object, so I can code a visualshader custom node? The closest I got was using a wireframe shadermode, but that highlight diagonal lines across flat surfaces.

    • xyz replied to this.

      Gamero You can detect edges only in rendered images, so you'll have to adapt the whole shader to be a post processing shader, or keep what you have so far and do the edge part as an additional post processing shader.

      19 days later

      Ah, because the shader code only has knowledge of the pixel it is working on, and all the other pixels are being worked on simultaneously in other threads?
      Could I solve this by using a texture on the objects, that is black with white lines along the edges? Can the shader check the color of the texture and add more lidar dots if it is white?