I try to implement DOF effect in my shader. In the shader I have color texture + offset for blurring. I need to add offset for RGB and my own A channel, which I make in the shader before. How can I replace the alpha channel in one step? I can't to find something suitable among GLSL functions. Thank you!
Replace alpha for texture into the shader
346 Views Asked by javierMarquez At
1
There are 1 best solutions below
Related Questions in OPENGL
- setting OpenGL version in objective-C
- How to run OpenGL version 3.3 (with Intel HD 4000) on Ubuntu 15.04
- Can linear filtering be used for an FBO blit of an MSAA texture to non-MSAA texture?
- How to get shader version from QOpenGLShader?
- "Capture GPU Frame" in XCode -- iOS only?
- Difference between glewGetString(GLEW_VERSION) and glewIsSupported
- Tesselation result flickering - OpenGL/GLSL
- Water rendering in opengl
- Texture mapping consuming physical memory
- Rotating a Cube using Quaternions in PyOpenGL
- Switching from perspective orthographic projection in OpenGL
- FreeType2 and OpenGL : Use unicode
- Should Meshes with and without Skeleton use different Shaders?
- How to get accurate 3D depth from 2D screen mouse click for large scale object in OpenGL?
- Trying to load 2d texture with glTexImage2D, but just getting blank
Related Questions in GLSL
- How to get shader version from QOpenGLShader?
- Tesselation result flickering - OpenGL/GLSL
- Water rendering in opengl
- Should Meshes with and without Skeleton use different Shaders?
- PBO Indexed Color Texture Rendering with Palette in Fragment Shader not working
- Modern GLSL ( opengl 3+ ) : Implementing phong effect correctly;
- Passing grayscale OpenCV image to an OpenGL texture
- OpenGL / weight order independent transparency
- GLSL: How to calculate fragments output RGB value based on Photoshops curve value?
- Fragment shader does not show any colour when compiled with vs2013
- How to access all vertexes within the same patch in Tessellation Control Shader
- OpenGL GLSL: How to implement the concept of gradient map in photoshop using fragment shader?
- Ambient and Specular lighting not working correctly in GLSL
- How to debug transforms in glsl vertex shaders in lwjgl
- Blender GLSL Export to THREE.js
Related Questions in SHADER
- Water rendering in opengl
- Draw a sphere on a billboard with world normal from a pointlist
- DirectX - Pixel Shader 3.0 doesn't work
- Should Meshes with and without Skeleton use different Shaders?
- unity custom shader not receiving Shadow
- Constant buffer is empty when passed HLSL C++
- Unity | 'gameobject.renderer.material.color' in version 5.x
- Shader programming with ShaderLab and CG in unity
- How to use a huge array in HLSL (error X4505)
- mat4 type in attribute shader
- Reading a shader from a .txt file using a structure
- Rendering a circle with a Vertex shader in DirectX
- Blur the camera at a particular point Unity2D
- Render multiple models in OpenGL with a single draw call
- Why passing parameter is OK between Vertex and Fragment shader
Related Questions in FRAGMENT-SHADER
- PBO Indexed Color Texture Rendering with Palette in Fragment Shader not working
- GLSL Shader Draws Only Black Screen LWJGL
- Is this GLSL program correct? My cubes are solid black
- GLSL noise function on devices with no high precision fragment shader
- JMonkey Filter Shader - get World Position of Fragment
- Three.js, custom shader and png texture with transparency
- Threejs: make custom shader match the standard rendering
- SKShader to create parallax background
- Switching from 3D to 2D in OpenGL
- Getting exact pixel from texture
- Why is my texture mapping with my fragment shader generating lines at texture coordinate jumps?
- How to make the line color flat instead of gradient in OpengGL ES 2.0?
- WebGL: 2D Fragment Shader With Dynamic Data
- How to disable color interpolation in opengl es 2.0?
- Replace alpha for texture into the shader
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Yes, it's possible to use textures (or rather images) as both input and outputs, but you shouldn't do it.
The OpenGL driver needs to know what is an input and what is an output, so it can properly synchronize the operations (e.g. a read on a texture should wait for a write to that same texture to have completed...)
OpenGL 4.2 introduces Image Load/Store, a way of reading and writing to images, but you have to manage synchronization yourself (with
barrier()and*Barrier()calls). It's meant for data that has to be both read and written to, e.g. atomic counters, transparency values...In your case, there are two sets of data: colors and offsets. One will only be read from, and the other only written to. It's better to just separate the two and simply treat them as regular inputs/outputs (texture binding/FBO attachment). If you used one texture for the two sets, it would be treated as one entity to synchronize, thus leading to more waits somewhere else.