Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Help Wanted Drawing shader with world position

Discussion in 'General Graphics' started by xdragon-slayerx, Feb 27, 2021.

  1. xdragon-slayerx

    xdragon-slayerx

    Joined:
    Feb 27, 2021
    Posts:
    1
    Hi there!

    I have some problem...
    I am trying to draw on mesh, but there is a problem with slitches on the model.
    Currently i use hit.texturePoint from raycast then pass coordinates to the shader which makes a circle around it and then Graphics.Blit to save draw circle. It works fine, unless there is no slitches around.
    To sum up:
    - raycast -> hit.texturePoint
    - hit.texturePoint -> shader drawing a circle around the point on the texture
    - Graphics.Blit(OldTexture, Destination, MaterialWithShader)

    So.. i've tried customize shader to do not calculate position on the texture, but with world position of every vertex (something like calcutating sphere rather circle). The shader itself worked, but i'm worrying that Graphic.Blit doesn't take mesh and its world position into consideration.
    Again to sum up:
    - some Vector3 -> shader drawing a sphere around the point on a mesh
    - Graphics.Blit(OldTexture, Destination, MaterialWithShader)

    Any ideas how can I solve this problem?

    Can i somehow pass vertex and its uv to shader to calculate mesh virtually?
    Model has sth about 8000 vertices and as i know max array of shader can be sth about 1000.
    So the idea dropps out.

    I am lost of thoughts.
    I wish you can understand my trash english ;P.
     
unityunity