简体   繁体   中英

Opengl: Quadratic interplation between vertex and fragment shader

Is it possible to implement iterpolation that is of a higher order than linear when passing data from vertex to fragment shaders? Ideally I would like some form of quadratic interpolation, but that would require access to vertices beyond the corners of the face being interpolated across.

The short answer is: no.

I do not think that there is a native support for interpolation other than linear if it comes to attributes passed from vertices to the fragment shader.

However you could incorporate a trick to have non linear interpolation by using geometry shader an inserting interpolated vertices in-between. Or, if you want so have some kind of distribution of values along the interpolated line, you can use a predefined 1D texture that will contain the interpolation curve you need to use in the fragment shader.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM