GLSL code not working

Hi community,

I would like to color my shape based on the position of the vertices (vposition) using GLSL code.

I believe there is something wrong with my GLSL code, particularly the function I defined to detect whether vposition is on the first segment of the geometry or not. I made a JSFiddle for it (JSFiddle)

Please refer to the pictures below to see the final expected result + the math behind the GLSL function (isptonsurface).

Could you please help detect what’s wrong.

Thank you so much


https://math.stackexchange.com/questions/3518495/check-if-a-general-point-is-inside-a-given-cylinder

Hi!
The jsfiddle provided is not working either :thinking:

The JSFiddle code is not working, because you’re trying to reference a css-file from your local C:\ drive:

<link href="C:\Users\nawfa\Desktop\3D GC Tool\Styles\style_base_model.css" rel="stylesheet" type="text/css">

Output from JSFiddle console:

[Warning] [blocked] The page at https://fiddle.jshell.net/GiBelle/0wnjgp9t/3/show/?editor_console= was not allowed to run insecure content from c:\Users\nawfa\Desktop\3D GC Tool\Styles\style_base_model.css. (show, line 16)

My apologies :relaxed:,

Here is the working JSFiddle

I commented out the section in GLSL code that wouldn’t work. This is the section I have a problem with and need help with.

Thank you