Search the Community
Showing results for tags 'alpha channel'.
-
Hey! I'm trying to make calculations in a shader, and use all 4 channels, but unfortunately the alpha channel does not work as expected. I was thinking that if I will set gl.blendFunc(gl.ONE, gl.ZERO) then the output should be only just the source, without any blending, but it's not. So I have tried to combine it also with premultipling alpha (and keep gl.blendFunc(gl.ONE, gl.ZERO)), I get sort of closer results to the expected, but still behaviour is strange. In the demo below I'm just filling mesh with one color, and console.log values of the first pixel, was expecting [25, 178, 229, 25] but I got [255, 255, 255, 25] (without premultipled alpha) and [31, 184, 235, 25] (with premultipled alpha) https://www.pixiplayground.com/#/edit/785nGjqG5wSZoa9r2Xn7I Thank you in advance for a response!
- 3 replies
-
- alpha channel
- shader
-
(and 3 more)
Tagged with:
-
Hi everybody: These days I'm starting with a development involving the visualization of a shower. The software must run in desktop and mobile (this last by means of an hybrid app). In order to show the (falling) water I'm considering two strategies: chroma-keyed video with the water falling (I'm using both a mp4 and a webm containers); particles (I'm afraid of As I am concerned about the performance penalty of using particles (it needs 30,000+ and motion blur in order to resemble a "real" shower), we are tackling first the video way. Running a raw example from server, over Chrome (Win) and Safari (OSX), shows the alpha 100% clear: With Firefox (Developer Edition / 56.0b1) the alpha channel is instead shown with a degree of opacity: Do you think is possible to obtain a correct alpha in this last browser? Best regards.
-
Hello, I have a function for playing videos on my game. It works fine, except if I play the same video again, in this case, it just draw like the first frame (or the last) as an simple image and the video never plays. Differents videos are played without problem. State.MainState.prototype.playVideo = function(video, posX, posY){ var video = new Phaser.Video(game, video); var img = video.addToWorld(posX, posY, 0, 0 , 0.8, 0.8); var fragmentSrc = [ "precision mediump float;", "varying vec2 vTextureCoord;", "uniform sampler2D uSampler;", "void main(void) {", "vec2 v1 = vTextureCoord;", "vec2 v2 = vTextureCoord;", "v1.y = vTextureCoord.y;", "v2.y = vTextureCoord.y - 0.5333;", "vec4 tex1 = texture2D(uSampler, v1);", "vec4 tex2 = texture2D(uSampler, v2);", "if(vTextureCoord.y > 0.5315)", "gl_FragColor = vec4(tex1.r, tex1.g, tex1.b, tex2.r);", "}" ]; var filter = new Phaser.Filter(game, null, fragmentSrc); img.filters = [ filter ]; var s = new Phaser.Signal(); s.add(function(){ video.destroy(); img.destroy(); }); video.onComplete = s; video.play(); };
-
Hi, I am trying to "hack" the spritesheets limitations by using JPG images with alpha channel. The process is simple: - I have a starting PNG with alpha channel - from this PNG I save a JPG (with varying fill colour for originally transparent areas) - from the PNG I extract the alpha channel and save it as an opaque indexed colour grayscale image - I load the new JPG and the grayscale PNG, and use the PNG as alpha channel for the JPG. These are the two images, the JPG and the grayscale PNG animBitmapData is BitmapData from the JPG animBitmapData_ALPHA is BitmapData from the grayscale PNG I did everything, but the last step doesn't work, animBitmapData is still opaque animBitmapData.copyChannel(animBitmapData_ALPHA, animBitmapData_ALPHA.rect, new Point(0, 0), BitmapDataChannel.ALPHA, BitmapDataChannel.RED);animBitmapData.transparent returns false, could this be the problem? Or maybe it is not correct to use a grayscale image as alpha channel? - Coding in Haxe + OpenFl -
-
- alpha channel
- bitmapdata
-
(and 3 more)
Tagged with:
-
Hi forum, I am working on a proof of concept for a game where i need to be able to place buildings (like any RTS you know). I already have some terrain generation going (I do not use tilemaps) with trees and later on other stuff. I'd like to know if it is possible somehow to calculate where a user can place buildings, and possible even draw (using PIXI.Graphics) a green colored area (around the building) where it is possible to place / install it. Circle based collisions would help at this stage, but alpha channel transparency checks would be better: i have tree textures as transparent 256*256 and 512*512 PNG's with shadow, i'd like to know when a building is being placed right near a/some tree(s). http://www.powergeek.nl/proj/mongento/versions/5/ (no preloader, working version. zooming is buggy but too lazy to work on that right now :> ). Thanks for any tips / pointers!