keijiro / FaceLandmarkBarracuda

MediaPipe face landmark detection model for Unity Barracuda
Apache License 2.0
116 stars 25 forks source link

Changing color of the landmarks #4

Closed pytholic closed 2 years ago

pytholic commented 2 years ago

Hi. Thank you for the repo.

I wanted to ask how can I change the color of landmark points and tesselation from white to something else. Same for the lines, how can I change it from red to some other color.

I tried adding the following to the TemplateBuilder.cs but didn't work.

        Color32[] colors = new Color32[VertexCount];
        for (int i = 0; i < VertexCount; i++)
        {
            colors[i] = Color.red;
        }
        mesh.colors32 = colors;

Actually, I am not even sure how to use TemplateBuilder because we already have templates. How to run it or remake templates? Not sure why we need a template and shader etc. Kind of confused without the documentation.

Will appreciate your help. Thank you!

keijiro commented 2 years ago

The shader doesn't use the vertex colors. You have to modify the following line in the shader instead.

https://github.com/keijiro/FaceLandmarkBarracuda/blob/main/Assets/Shader/Visualizer.shader#L22

pytholic commented 2 years ago

The shader doesn't use the vertex colors. You have to modify the following line in the shader instead.

https://github.com/keijiro/FaceLandmarkBarracuda/blob/main/Assets/Shader/Visualizer.shader#L22

Thank you, that helped solve my issue.

I have one more question, how can I modify thickness or size of the drawn points and lines?

keijiro commented 2 years ago

You can't change them easily because the graphics APIs don't support drawing lines with thickness (you have to draw triangles to construct thick lines).

I'm closing this issue now as the question is not related to this project (that's a general question about graphics APIs and shaders). Please reopen it for further issues on this specific project.

pytholic commented 2 years ago

You can't change them easily because the graphics APIs don't support drawing lines with thickness (you have to draw triangles to construct thick lines).

I'm closing this issue now as the question is not related to this project (that's a general question about graphics APIs and shaders). Please reopen it for further issues on this specific project.

All right. Thank you for the help! Are you planning to make any documentation for this project? I want to understand everything you did and included in the project from scratch.

keijiro commented 2 years ago

I did a presentation but only in the Japanese language.

https://www.youtube.com/watch?v=dMgm4ZYfaUI

Please don't expect more from me in English as I can't speak English. I'd recommend looking for presentations/articles from advocates in the English regions.

pytholic commented 2 years ago

I did a presentation but only in the Japanese language.

https://www.youtube.com/watch?v=dMgm4ZYfaUI

Please don't expect more from me in English as I can't speak English. I'd recommend looking for presentations/articles from advocates in the English regions.

I understand. Thank you for all the help!