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:

  1. the barycentric coordinates particular fragment. can done passing, 3 vertices of triangle, vec3(1, 0, 0), vec3(0, 1, 0), , vec3(0, 0, 1).
  2. 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

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -