blending

Alpha blending with multiple textures leaves colored border

半世苍凉 提交于 2019-12-06 14:27:38
问题 Following problem: I have two textures and I want to combine these two into a new texture. Thus, one texture is used as background, the other will be overlaid. The overlay texture is getting initialized with glClearColor(1.0, 1.0, 1.0, 0.0). Objects are draw onto the texture, these objects do have alpha values. Now blending between the two textures leaves a white border around the objects. The border comes from the fact that the background color in the second texture is white, isn't it? How

Replicate OpenGL Blending in Metal

﹥>﹥吖頭↗ 提交于 2019-12-06 05:38:56
I have been working on porting an open source game written using a fixed function pipeline to Metal. I have been able to redo all the projection transformation and have things being drawn where they should be drawn with the correct texture and vertex information but I'm having lots of trouble getting the fragment shader to match the OpenGL blending, the textures look correct but the blending and brightness are off. Here is what I'm trying to match: here is how it is currently rendering: The code I can see controlling the GL Blending looks like: glShadeModel(GL_SMOOTH); glEnable(GL_ALPHA_TEST);

Blending anti-aliased circles with regl

橙三吉。 提交于 2019-12-06 05:37:21
问题 I'm rendering circles using regl, and have three goals: The canvas should be transparent, showing HTML content behind it. Circles should be antialiased smoothly. Overlapping circles should look reasonable (blend colors, no corners showing) So far, I have this: Glitch code and demo. UPDATE: The demo links now reflect the working, accepted answer. Code below is unchanged. index.js const regl = require('regl'); const glsl = require('glslify'); const vertexShader = glsl.file('../shaders/vertex

How to draw a UILabel with a different blend mode in draw(_ rect: CGRect) in Swift

跟風遠走 提交于 2019-12-05 21:07:30
So I have a UILabel that is being drawn on top of a gradient image (that is a UIImageView ). It looks sorta like this: I'm trying to change the blendMode of the graphics context in the UILabel 's draw(_ rect: CGRect) function so that it draws the label but blended with the background with a softLight blending mode. Here is what I want it to look like: Here is the code I have in the draw(_ rect: CGRect) function: override func draw(_ rect: CGRect) { // Drawing code if let context = UIGraphicsGetCurrentContext() { context.setBlendMode(.softLight) self.textColor.set() self.drawText(in: rect) } }

Libgdx 3D Texture Transparency

蓝咒 提交于 2019-12-05 16:57:26
I'm having a problem with a texture on a cylinder. Basically it is a coin with a texture on it, I have done this before as demo but lost the code. Now the problem I'm facing is that I cant get the edge of the coin to be transparent anymore. The transparent parts of the png appear white on the cylinder, or even the box I tried. I enabled G20.GL_Blend, have the blending function with alpha_src and one_minus_alpha_src, enabled something like texture_2d. (Srry for the wrong variable names, only on my phone atm, will change @home) I have tried everything I can find online, but it just doesnt change

Blending with HTML background in WebGL

走远了吗. 提交于 2019-12-05 10:55:34
I am drawing flat colors and textures into WebGL canvas. My colors and textures have varying alpha values and I want them to be blended correctly. I want to have transparent background (they should be blended with HTML content, which is under canvas). In WebGL, I use gl.clearColor(0, 0, 0, 0); gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA); gl.enable(gl.BLEND); It works correctly, when HTML background is black. But when I set a JPG pattern as a background of , I draw black triangle (alpha=1) and white triangle (alpha=0.5), I can see the background pattern in place where triangles intersect

Alpha blending with multiple textures leaves colored border

北城余情 提交于 2019-12-04 21:49:06
Following problem: I have two textures and I want to combine these two into a new texture. Thus, one texture is used as background, the other will be overlaid. The overlay texture is getting initialized with glClearColor(1.0, 1.0, 1.0, 0.0). Objects are draw onto the texture, these objects do have alpha values. Now blending between the two textures leaves a white border around the objects. The border comes from the fact that the background color in the second texture is white, isn't it? How can I use alpha blending where I do not have to think about the background color of the overlaying

Blending anti-aliased circles with regl

孤街醉人 提交于 2019-12-04 10:55:35
I'm rendering circles using regl, and have three goals: The canvas should be transparent, showing HTML content behind it. Circles should be antialiased smoothly. Overlapping circles should look reasonable (blend colors, no corners showing) So far, I have this: Glitch code and demo . UPDATE: The demo links now reflect the working, accepted answer. Code below is unchanged. index.js const regl = require('regl'); const glsl = require('glslify'); const vertexShader = glsl.file('../shaders/vertex.glsl'); const fragmentShader = glsl.file('../shaders/fragment.glsl'); // Create webgl context and clear.

Is it possible to do additive blending with matplotlib?

余生长醉 提交于 2019-12-04 08:00:24
问题 When dealing with overlapping high density scatter or line plots of different colors it can be convenient to implement additive blending schemes, where the RGB colors of each marker add together to produce the final color in the canvas. This is a common operation in 2D and 3D render engines. However, in Matplotlib I've only found support for alpha/opacity blending. Is there any roundabout way of doing it or am I stuck with rendering to bitmap and then blending them in some paint program? Edit

iOS Sprite Kit why can't I repeat colorizeWithColor using white color?

一世执手 提交于 2019-12-04 03:02:43
I'm experimenting with ways of selecting sprite nodes using methods other than scale. The one method that I like the most is colorize with white, which highlights the node visibly. However, I cannot seem to be able to replicate the colorize with white behavior more than once. Why can't I apply colorizeWithColor using white color more than once? These two method calls are identical, except for the color used. If I use red, gray, etc, the node responds by flashing for each touch. But If I use white, it does so only once, then never responds to touches again. [self runAction:[SKAction