Quantcast
Channel: Pixi.js Latest Topics
Viewing all 3978 articles
Browse latest View live

Problem Getting Particle Emitter Examples to Load

$
0
0

This is going to sound really dumb so please excuse me being such a noob. I am trying to get the pixi-particle examples to work but can't seem to.

What I did:

I downloaded and unzipped the following: https://github.com/pixijs/pixi-particles

Unzipped it and loaded up the examples folder via the command line with: python -m SimpleHTTPServer 8000

none of the examples are showing anything within http://localhost:8000/ when I navigate to them though. How can I get this working?

 

Browser is showing the following errors:

pixi.js:1 Failed to load resource: the server responded with a status of 404 (File not found)
pixi-particles.js:1 Failed to load resource: the server responded with a status of 404 (File not found)
ParticleExample.js:24 Uncaught ReferenceError: PIXI is not defined
    at new ParticleExample (ParticleExample.js:24)
    at explosion.html:25

What I have been trying (many other things too...):

I have tried: npm install pixi.js pixi-particles 

But it doesn't seem to work, I'm not sure if I'm installing in the wrong place or what?


Multi-Style text

$
0
0

Allo!

 

For a specific project, I needed to create a lot of multi-style text. And to be honest, it's just painful to do it manually every time. So I decided to create an object to do it for me, because I don't want to do it manually anymore :) This one calculates the position of each group of text automatically and will save me a lot of dev time now.

 

I called it "MultiStyleText" and the source code is available on github if you want: https://github.com/tleunen/pixi-multistyle-text

 

I'm pretty sure there are a few bugs in there, especially with styles using different font-size. But this is a start :)

I've released it as 0.1.0 because I'm not sure yet of the way to create it, with the 2 "styles" object. Feel free to suggest improvements on that!

 

I put an example using the same that Mat created for Pixi.Text and here is the result:

lQZeHZ1.jpg

 

Let me know what you think.

Nested spritesheets?

$
0
0

Let's say I have multiple frame by frame animations. PIXI.AnimatedSprite instance could be created using spritesheet, but what if i want to merge animation spritesheets (if they are small enough) into one big spritesheet but maintain refference to nested sheets? Is it possible and if so, is it even worth it?

Scaffolding for Particle Emitter

$
0
0

I am trying to setup a Pixi particle emitter using the pixi-particle dependency. Does someone have an example scaffolding file I could use? The examples that are listed are unfortunately only for v4 and I have not been able to accurately update them to get them to work.

 

I would want something that I could drop in an particle object from here: https://pixijs.io/pixi-particles-editor/ and then play around with to see how everything is working.

background downloader for pixi.js

$
0
0

hi masters 😍

im beginner in pixi.js and game develop.

i write a program that in some time load some picture or video or music...
not problem in pictures but when load a video or a music. it take long time until play .

I decided when start my program . download all video and all music. then show a progressbar with title (loading...)

i created my progressBar but can't connect  it on my media.

thanks for your helps. and sorry for my english languge... 

Large texture data on mobile with zoom pan

$
0
0

Looking for some feedback on best practices for handling large texture data.

On desktop, it seems I can easily load large textures exceeding 8k on a side; however, mobile fails to render past 4096 pixels on the longest side.

Project I'm working on loads schematic views, of sorts - there's a background image on which components are placed.  Zoom / pan is implemented from Pixi-Viewport project.

background4.gif.5b0a9aadb9366351892da7b149d296ce.gif

These are available as vector, but prototyping as SVG seems to incur a significant performance loss.

Not sure if there's a mipmapping approach, or some kind of level of detail such as TileMap.

Roughly following the TileMap project... background image is sliced and loaded via multiple frames.

Presume source code for the "webglzoomin and zoomout / retina webglzoomin and zoomout" examples are just https://github.com/pixijs/pixi-tilemap/blob/master/demo/main.js

The canvas version doesn't appear to be working:

main.js:104 Uncaught TypeError: Cannot read property 'flush' of undefined
    at update (main.js:104)

Prevent browser page zoom pinch gesture on desktop

$
0
0

Having an issue on desktop where Pixi interaction manager doesn't appear to prevent default capturing pinch gestures.

This is especially problematic with Pixi Viewport, where pinch zoom gesture is getting caught by the browser; therefore, zooming the browser's viewport (entire DOM).

For example, as I pinch zoom the Pixi Viewport below, the browser intermittently zooms the entire view:

https://codepen.io/jasonsturges/pen/BayMWxm

pinch-zoom.thumb.gif.4b8cec276b42618e1e7466ec953111ed.gif

 

Maybe no solution here - Chrome doesn't support the `user-scalable` meta attribute in html on desktop.

By default, shouldn't the interaction manager of Pixi capture and prevent these events?  

Is PIXI force us to use PIXI.Application instead PIXI.Renderer ?

$
0
0

I have some trouble that I don't know what happen
I just want to change the background color of my renderer here
 

var webGLRender = new PIXI.Renderer({
antialias:true,
width:300,
height:400,
backgroundColor:0xf0f0fe})

as you see, the color there is not black, it's some grayish. But when I see the page, it's just black. The screen size is correct, only the color that's not working.

I've also tried using option as _backgroundColorRgba  and _backgroundColorString but still not working.
 


Framerate when rendering tilemap is only 30

$
0
0

I am using "pixijs/pixi-tilemap" library to render maps exported from Tiled, but the rendering frame rate is low.

I am newbie and I guess there may be a problem with the rendering loop logic,

My thinking is as follows:
I have several rendering layers(PIXI.display.Layer) in my game, I call them 'RenderingLayer',

there are several cameras in the game (inherited from PIXI.Container),

each camera can render multiple 'RenderingLayer' And output to RenderTexture,

finally use the PIXI.Sprite group to render the final result according to the depth property of the camera.

I use the ECS architecture to implement the game

Code of RenderingSystem.update:

for ( const camera of this.cameraComponents ) {

	if ( camera.renderingLayers.length === 0 ) {
		continue;
	}

	// clear stage
	$app.stage.removeChildren ();

	// add current rendering camera
	$app.stage.addChild ( camera.cam );
	
	// collect camera rendering layer
	for ( const layerName of camera.renderingLayers ) {
		if ( $app.renderingLayers.has ( layerName )  ) {
			let layer = $app.renderingLayers.get ( layerName );
			if ( layer.visible ) {
				camera.cam.addChild ( layer );
			}
		}
	}
	
	// rendering camera result
	Graphics.render ( $app.stage, camera.renderTexture, this.renderTarget );

	// clear
	camera.cam.removeChildren ();
}

// render final result
this.renderSprite.removeChildren ();
for ( const camera of this.cameraComponents ) {
	this.renderSprite.addChild ( camera.renderSprite );
}
renderer.render ( this.renderSprite, null, true );

May be frequent use of removeChildren / addChild affects rendering performance?😳

I use the ECS architecture to implement the game, You can find the code for the RenderingSystem class here: js/ecs/systems/rendering_system.js.

Another guess might be that I did not use the pixijs / pixi-tilemap library correctly.😲

see here: https://lihaochen910.github.io/RPGMakerProject/

code is here: https://github.com/lihaochen910/RPGMakerProject

Keep child at original scale

$
0
0

Is there a way to keep a child on it's original scale when scaling the parent object?

 

Flip a sprite?

$
0
0

Dear PIXI people,

 

First of all: I love PIXI! It's a very promising library. I'm creating a new game with it and will share the work with you when it's done. Because of the young age of this library I notice a lack of features, tho. For instance basic geometry drawing is really needed and helps alot while developing.

 

Anyway, at this moment I'm looking to flip a sprite. Is this possible? If so, how? :)

 

 

Again: thanks for this already amazing library!

 

 

Best,

Rein

PIXI.Graphics for multiple moving shape objects

$
0
0

So I've figured there are two main ways to render multiple moving shape objects with PIXI.Graphics.
1) Use only one Graphics instance, clear it on each redraw and simply draw each shape in their new position every tick.
2) Use one Graphics instance per shape object. Draw each one once at the beginning. On each redraw move the graphics instance to their new positions.

I'm wondering if I should prefer one method over the other and why?

Gradients and WebGL and PIXIv5

$
0
0

So, I've been using PIXI.js since v3 and am fairly familiar with drawing gradients using 2d canvas and turning it into an image so that I can use it in a WebGL renderer.  But now it's 2020 and we're on PIXI.js v5 with a mid-level API and consumable components.  I'm just now making the migration to v5 and am hoping that there is a plugin or feature that I can use to do radial and linear gradients directly in WebGL.  You see, I'm porting an old AS1 game over from Flash to HTML5 and the game makes extensive use of radial gradients and morph shapes to create interesting effects like a semi-transparent bubble-shaped shields with a moving/rotating shimmer on it as well as smoke and fire/explosions.  To date, I've been converting all of this to spritesheets.  But it kinda sucks to use all that extra space.  But it would also kinda suck to compile all of it using 2d canvas as a loading step in the game - especially as I consider increasing the framerate for these effects (the game typically runs at 12fps).  Theoretically, it would take up a lot less space and time if I did it like it was done in Flash.  That is, I define one or more morph shapes and can animate them using the fastest framerate I can up to the screen refresh rate.  It's a mobile game (PWA), so framerate can be inconsistent.  Rendering the morph shape at the ratio derived from the ticker delta time could provide a smoother animation.

That's my goal, so even if I handled the morph shape side of things, just hoping there's a fast/efficient solution for gradients outside of 2d canvas yet.  Or, is there any plan to add such a feature with an estimated timeframe for completion?

PIXI beginTextureFill issue

$
0
0

Hi!

I need to upgrade PIXI to the newest version, because I must support canvas, but I have this problem:

image.png.8b9e95025f474afa6b419ffabdfb9f6f.png

What is the alternative of beginTextureFill after PIXI 5.2.0?

What does object-based options mean?

 

 

Need help for performance issue with masks

$
0
0

Hi guys,

I have a game in which i create lots of custom animations with gsap and static assets. I want to reuse the animations on different positions, so whenever i finish the animation i destroy it and recreate it later when needed.

Every animation is within it's own container and the logic works great if i dont use any masks, but the design requires that I use 5-6 alpha masks per object, and i can have around 20 objects using the same animation. As you can imaging, this is slowing down the game quite a lot.

I've been trying to find a way to increase the performance, but with no luck so far. Can anyone give me advice on that?

Is there any way to generate some texture frames with the animation states and save it to cache? or prerender animation? Any help would be appreciated.


Passing Properties to children?

$
0
0

Is there any built in system that would pass on attributes and properties to children for example inside of a container?

A bit like how html works if you have an element inside another, and for example make the element w 50, h 50, position: abs, right: 0, top: 0, the properties gets passed on to the children etc etc, i could make this myself but it would save some time if there already was something for it.

Pixi Filter and pixel size

$
0
0

Hi, I'm trying to learn how to pass and use textures in PIXI.Filter. I have a game that uses a complex filter that takes multiple textures and behaves differently depending on the color of the pixel of each texture. It's too complicated to post here.

The main problem I have is: I don't know how to measure the width / height of a pixel of the texture I'm passing inside my shader.

Here I have a very simple filter that illustrates my issue:

I want to create a filter that I pass the following "u" shape texture

image.png.df7b1e26b92062f182ee1ca239cae1de.png

 

 

 

 

 

 

 

 

 

the filter uses that shape to generate a red drop shadow like this:

 

image.png.4ac05a8c41559b8d6e9b52e51ea5cb6d.png

The problem is the shader messes up and doesn't calculate properly the length of a pixel resulting on this:

image.png.50c827a69d7ad030740e80ebcf0a609c.png

I was expecting to have a perfect stair going up, and I was expecting more steps on the stair (see algorithm below).

Does anyone know what I'm doing wrong?

Here's a link to a codepen illustrating the issue:

https://codepen.io/alvaromartinlop/pen/abOvzxb?editors=0010

Here's the vertex shader:

attribute vec2 aVertexPosition;
attribute vec2 aTextureCoord;

uniform mat3 projectionMatrix;
varying vec2 vTextureCoord;

uniform mat3 shadowMapMatrix;
varying vec2 vShadowMapCoord;

void main(void)
{
    gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);

    vTextureCoord = aTextureCoord;
    vShadowMapCoord = (shadowMapMatrix * vec3(aTextureCoord, 1.0)).xy;   
}

Here's the frag shader:

precision highp float;

varying vec2 vTextureCoord;
uniform vec4 inputPixel; // Problem is here

varying vec2 vShadowMapCoord;
uniform sampler2D shadowMapTexture;

void main() {
  vec4 shadowColor = vec4(1, 0, 0, 1);

  vec2 displacementCoord = vShadowMapCoord;
  vec4 shadowMapColor = texture2D(shadowMapTexture, vShadowMapCoord);
  vec4 finalColor;
  vec4 translateColor;

  vec2 translate = vec2(inputPixel.z,-inputPixel.w);
  for(int i= 0; i < 10; i++) {
    displacementCoord -= translate;
    translateColor = texture2D(shadowMapTexture, displacementCoord);
    if (translateColor.x > 0.0 && shadowMapColor.x == 0.0) {
      finalColor = shadowColor;
      break;
    }
  }
	gl_FragColor = finalColor;
}

Clearly the issue is with inputPixel, displacementCoord is not decrementing properly on each iteration in the for loop.

Here's how I calculate the matrix for the texture

  public apply(
    filterManager: systems.FilterSystem,
    input: RenderTexture,
    output: RenderTexture,
    clearMode: boolean
  ): void {
    this.uniforms.shadowMapMatrix = filterManager.calculateSpriteMatrix(
      this._matrix,
      this._shadowMapSprite
    );
    filterManager.applyFilter(this, input, output, clearMode);
  }

So the question is. How do I properly calculate inputPixel so that I don't have the irregular staircase problem?

Thanks.

Need Proper Code To Make a 3D Picture...

$
0
0

Sup guys:

Just trying to make a server side 3D image for my website. I want it to look just as good as the 3D images on FaceBook. I know how to make depth maps properly, I just need the code to add it to my own site.

You can see a bad example using Pixi code below. Just scroll down to where it says "demo" near the bottom of the page, and scroll over the picture for the effect. This is what I want, but it has to look good, like the 3D images you see on FaceBook:

Demo

I know Pixi code can help me, I'm just not that smart to know how to use it. Hope someone can help.

Thx.

-el

How bind webGL texture current to shader on PIXI.Mesh?

$
0
0

Hi,

I want to create a mesh with shader, and through uniforms webGL textures to shader, 

I'm able use pixiapp.renderer.gl.createTexture, it works.

613919283_ScreenShot2020-02-12at11_31_04AM.png.a06447ad950b22355c30549595ae3a16.png

But other sprite in pixiapp(PIXI.application) stage also force to mesh's webGL Texture

1144526680_ScreenShot2020-02-12at12_05_56PM.thumb.png.43fb55ef98061a9882facdf51bb7f44e.png

is webGL texture binding index confusion? (gl.TEXTURE0)

maybe need to use pixi webgl abstraction?

does anyone have idea?

best regrads.

 

 

Base64 Spritesheet ?

$
0
0

Hello ! I want to integrate have my spritesheet based on a Base64 Image. I am not 100% sure how to make it work. I cant make it work. I dont get textures in my spritesheet in the end...
 

  sheet = new PIXI.Spritesheet(PIXI.Texture.from("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgA...."), {
            "frames": {
                "banana.png": {
                    "frame": {"x":513, "y":0, "w":512, "h":512},
                    "spriteSourceSize": {"x":0,"y":0,"w":512,"h":512},
                    "sourceSize": {"w":512,"h":512}
                },
                "coin.png": {
                    "frame": {"x":513, "y":513, "w":310, "h":334},
                    "spriteSourceSize": {"x":0,"y":0,"w":310,"h":334},
                    "sourceSize": {"w":310,"h":334}
                },
                "strawberry.png": {
                    "frame": {"x":0, "y":0, "w":512, "h":512},
                    "spriteSourceSize": {"x":0,"y":0,"w":512,"h":512},
                    "sourceSize": {"w":512,"h":512}
                },
                "wrong.png": {
                    "frame": {"x":0, "y":513, "w":512, "h":512},
                    "spriteSourceSize": {"x":0,"y":0,"w":512,"h":512},
                    "sourceSize": {"w":512,"h":512}
                }

            },
            "meta": {
                "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgA....",
                "size": {"w": 1026, "h": 1026},
                "scale": "1"
            }
        });

 

Viewing all 3978 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>