- Home /
GLSL - Paint fragments in a certain view position
Hi,
I'm receiving from Unity a pixel in view coordinates (X,Y) given by a simple call to Camera.WorldToScreenPoint() (where position (0,0) is at bottom left of the screen as Unity documentation states). But now I want to make a condition like this in my fragment shader:
Pseudo code: IF(my_frag_position_in_view == (X,Y)) then gl_FragColor = pink; ELSE gl_FragColor = blue;
So I'm asking if the current fragment being processed is in the same pixel position as the pixel unity gave me, if so color it pink.
My problem is, I cant figure out "my_frag_position_in_camera", that corresponds to the current fragment's position in the view coordinates.
I still can't figure out, i've tried gl_FragCoord but it still looks wrong..
Your answer
Follow this Question
Related Questions
Get Pixel Coordinate When Click On 2D Object 1 Answer
Why doesn't this vertex+fragment shader work? 0 Answers
shaderlab: Matrix-vector multiplication in fragment shader on iOS not working? 0 Answers
Vertex and Fragment Shader worldNormal 1 Answer
Converting pixel dimensions to Unity's floating-point coordinates 1 Answer