how to provide Custom interpolation technique in OpenGL for filling triangle -
i trying implement custom interpolation technique in glsl shader.
i have switched off default opengl bilinear filters using flat
interpolation specifier texture coordinates. followed technique specified in below link:
how switch off default interpolation in opengl
while rasterizing, image gets image based on provoking vertex
.
is possible me introduce interpolation mechanism decide on colors filled between vertices in triangle ? or hardcoded in opengl ?
i newbie in glsl world , hence request provide me non complicated answer.
interpolation hard-coded opengl. if want own interpolation, have provide fragment shader:
- the barycentric coordinates particular fragment. can done passing, 3 vertices of triangle,
vec3(1, 0, 0)
,vec3(0, 1, 0)
, ,vec3(0, 0, 1)
. - all 3 uninterpolated values triangle's data wish interpolate. require 3
flat
input variables in fs (or array of 3 inputs, same thing).
of course, you'll need match 1, 0, 0
triangle particular uninterpreted value vertex of triangle. , same goes other 2 indices.
this requires geometry shader, since it's difficult vs pass barycentric coordinates or provide right uninterpolated data. barycentric coordinates of position, , values interpolated, should able implement whatever interpolations scheme like. #2 include more 3 values, example.
Comments
Post a Comment