(or do some tweak at the driver level ? I think it could be possible to mess up with the transform matrix to get this result (see the upper forum link))Īnyway, it is not like software where every new or more operation will cost you time. I would bet they actually have to ADD transistor to support such thing. Basically by shutting down the correction, you do NOT make it faster, you just skip the data path most likely. The interpolator are specific HW unit with a fast multiply by inverse kind of calculation. Now concerning the perspective correction, consider it as “free” in term of overhead for performance. So it saves you cost for memory update (no need to maintain all vertex but 1/3), if you want specific PER triangle it it may be/could be useful I think. Under Mac OS X with the Intel HD 4000 GPU, the quand was simply not displayed:įlat saves you to put the same value 3x time at each vertex. On Windows + GTX 660, I got a black quad: If interpolation qualifiers mismatch like in the following example: Last thing: interpolation qualifiers in vertex and pixel shaders must match. With the noperspective qualifier, texture coordinates are linearly interpolated in the screen space (or window space) and we clearly see each triangle. With noperspective qualifier, the rendering is: The flat qualifier disables the interpolation and each triangle of the quad is colored with the last triangle vertex color: Gl_Position = gxl3d_ModelViewProjectionMatrix * gxl3d_Position Uniform mat4 gxl3d_ModelViewProjectionMatrix Here is the GPU program used to render the quad: The first 3D test is simple: a quad with a different color at each vertex: All demos of this tutorial are included in GLSL Hacker Code Sample Pack in the GLSL_OpenGL_32_Interpolation/ folder. I used GLSL Hacker to quickly code the demo and play with GLSL shaders. Let’s see in practice how these qualifiers affect the rendering. The default interpolation qualifier is smooth when no qualifier is present. noperspective: performs a linear interpolation in window space.smooth: performs a perspective correct interpolation.The value given to the fragment shader is the value from the Provoking Vertex for that primitive. These interpolation qualifiers allow to specify the way a vertex shader output is interpolated across a primitive. OpenGL 3 introduced three interpolation qualifiers that are at our disposal in the vertex and fragment shaders.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |