Gaussian filter with OpenGL Shaders

A highly optimized shader-based approach for performing a nine-hit Gaussian blur was presented by Daniel Rákos. His process uses the underlying interpolation provided by texture filtering in hardware to perform a nine-hit filter using only five texture reads per pass. This is also split into separate horizontal and vertical passes to further reduce the number … Read more

How to render clipped surfaces as solid objects

You want to render a clipped surface as if it were a solid — i.e., not hollow. You can achieve that effect with MeshPhongMaterial — or any three.js material for that matter — with a simple hack to the material shader. material.onBeforeCompile = function( shader ) { shader.fragmentShader = shader.fragmentShader.replace( ‘#include <output_fragment>’, ` vec3 backfaceColor … Read more

YUV to RGB conversion by fragment shader

I don’t know if you solved your problem. I used your code and I solved in this mode. public class MyRenderer implements Renderer{ public static final int recWidth = Costanti.recWidth; public static final int recHeight = Costanti.recHeight; private static final int U_INDEX = recWidth*recHeight; private static final int V_INDEX = recWidth*recHeight*5/4; private static final int … Read more

What is state-of-the-art for text rendering in OpenGL as of version 4.1? [closed]

Rendering outlines, unless you render only a dozen characters total, remains a “no go” due to the number of vertices needed per character to approximate curvature. Though there have been approaches to evaluate bezier curves in the pixel shader instead, these suffer from not being easily antialiased, which is trivial using a distance-map-textured quad, and … Read more

Replicating MeshLambertMaterial Using ShaderMaterial ignores textures

three.js was designed to be easy to use, not easy to modify. This may change in the future… You need to set the material.defines like so: var defines = {}; defines[ “USE_MAP” ] = “”;. Then specify defines in the material constructor. var material = new THREE.ShaderMaterial({ name: “TerrainShader”, defines : defines, uniforms : shaderUniforms, … Read more

How to render Android’s YUV-NV21 camera image on the background in libgdx with OpenGLES 2.0 in real-time?

The short answer is to load the camera image channels (Y,UV) into textures and draw these textures onto a Mesh using a custom fragment shader that will do the color space conversion for us. Since this shader will be running on the GPU, it will be much faster than CPU and certainly much much faster … Read more