Tag Info

New answers tagged


I think that it is impossible to solve your problem just by using a pair of tricky fragment and vertex shaders. That is why: You select a set of UV points in 2D space. Then, using the function you have defined, you can get another "linked" set of UV points. But you still have to get somehow 3D coordinates from the surface UV coordinates. So your problem can ...


Try using this instead: glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 256, 1, 0, GL_BGRA, GL_UNSIGNED_BYTE, pLUT);


I have discovered the reason for the H vector to be used. Unfortunately it is not the way it is used in most shading models, which can then be concluded to be incorrect. For physically based shading reflected light must obey the fresnel equations. (Most "physically based" shaders don't) Microfacets must also obey the fresnel equations, which relies on the ...


Actually, I think you yourself listed the reasons why Blinn is the default over Phong. Each reason you listed there is, in fact, an area where Blinn proves superior to Phong. Taken as a whole, all of these lead to Blinn being a better default than Phong. Is Blinn perfect? Is it better than Phong? No. But it is a reasonable default. Feel free to ...


For perfectly reflective surfaces Phong-model makes sense. However, where does the n in (R.V)^n of Phong-model for approximating rougher surfaces come from? Where is the theory that you have to raise the result of the dot product to the power except that it just appears to empirically give the proper result? For Blinn-model there's physically based ...


You can use the inbuilt GLSL lessThan() and greaterThan() functions (supported in all GLSL versions). These give two boolean vectors as a result. https://www.opengl.org/sdk/docs/man/html/greaterThan.xhtml http://www.opengl.org/sdk/docs/man4/html/lessThan.xhtml Then, you can use 'equal' (https://www.opengl.org/sdk/docs/man/html/equal.xhtml) on those ...


How about: vec3 delta = abs(textureColor - vec3(0.85, 0.85, 0.85)); // Get delta from middle vec3 if (delta.r <= 0.05) && (delta.g <= 0.05) && (delta.b <= 0.05) Performance needs to be profiled, but it's sure shorter to write

Top 50 recent answers are included