Jump to content

Search the Community

Showing results for tags 'glow filter pixi.v3'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 1 result

  1. hi, I am new to this forum. I have been trying to use a glow filter it found at http://codepen.io/mishaa/pen/raKzrm. but it seems that it's been made for v2. This is how I am trying to set filter to the text. function setFilter() { bigtxt.filters = [ new GlowFilter( bigtxt.width, bigtxt.height, parseFloat(15), parseFloat(2), parseFloat(0), parseInt(2, 16), parseFloat(15) ) ]; };this is the glow filter code form codepen var GlowFilter = function (textureWidth, textureHeight, distance, outerStrength, innerStrength, color, quality) { PIXI.AbstractFilter.call(this); quality = Math.pow(quality, 1/3); this.quality = quality; distance *= quality; textureWidth *= quality; textureHeight *= quality; this.uniforms = { distance: {type: '1f', value: distance}, outerStrength: {type: '1f', value: null}, innerStrength: {type: '1f', value: null}, glowColor: {type: '4f', value: null}, pixelWidth: {type: '1f', value: null}, pixelHeight: {type: '1f', value: null}, }; this.color = color; this.outerStrength = outerStrength; this.innerStrength = innerStrength; this.textureWidth = textureWidth; this.textureHeight = textureHeight; this.passes = [this]; this.fragmentSrc = [ 'precision mediump float;', 'varying vec2 vTextureCoord;', 'uniform sampler2D texture;', 'uniform float distance;', 'uniform float outerStrength;', 'uniform float innerStrength;', 'uniform vec4 glowColor;', 'uniform float pixelWidth;', 'uniform float pixelHeight;', 'vec2 px = vec2(pixelWidth, pixelHeight);', 'void main(void) {', ' const float PI = 3.14159265358979323846264;', ' vec4 ownColor = texture2D(texture, vTextureCoord);', ' vec4 curColor;', ' float totalAlpha = 0.;', ' float maxTotalAlpha = 0.;', ' float cosAngle;', ' float sinAngle;', ' for (float angle = 0.; angle <= PI * 2.; angle += ' + (1 / quality / distance).toFixed(7) + ') {', ' cosAngle = cos(angle);', ' sinAngle = sin(angle);', ' for (float curDistance = 1.; curDistance <= ' + distance.toFixed(7) + '; curDistance++) {', ' curColor = texture2D(texture, vec2(vTextureCoord.x + cosAngle * curDistance * px.x, vTextureCoord.y + sinAngle * curDistance * px.y));', ' totalAlpha += (distance - curDistance) * curColor.a;', ' maxTotalAlpha += (distance - curDistance);', ' }', ' }', ' maxTotalAlpha = max(maxTotalAlpha, 0.0001);', ' ownColor.a = max(ownColor.a, 0.0001);', ' ownColor.rgb = ownColor.rgb / ownColor.a;', ' float outerGlowAlpha = (totalAlpha / maxTotalAlpha) * outerStrength * (1. - ownColor.a);', ' float innerGlowAlpha = ((maxTotalAlpha - totalAlpha) / maxTotalAlpha) * innerStrength * ownColor.a;', ' float resultAlpha = (ownColor.a + outerGlowAlpha);', ' gl_FragColor = vec4(mix(mix(ownColor.rgb, glowColor.rgb, innerGlowAlpha / ownColor.a), glowColor.rgb, outerGlowAlpha / resultAlpha) * resultAlpha, resultAlpha);', '}' ];};GlowFilter.prototype = Object.create(PIXI.AbstractFilter.prototype);GlowFilter.prototype.constructor = GlowFilter;I get these errors Am absolutely not sure how to fix this. If any of you guys could help me with this it would be great. Thanka in advance.
×
×
  • Create New...