Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render resolution #39

Closed
ghost opened this issue Nov 8, 2018 · 15 comments
Closed

Render resolution #39

ghost opened this issue Nov 8, 2018 · 15 comments

Comments

@ghost
Copy link

ghost commented Nov 8, 2018

Hello I'm trying to pass resolution param in that example https://pixijs.io/examples/#/layers/normals.js, for correct support retina and etc.

 const options = {
    width,
    height,
    resolution: window.devicePixelRatio || 1
};

const app = new PIXI.Application(options);
document.body.appendChild(app.view);
...

But unfortunately cursor position is incorrect detected. Could you please chech it.
Thanks!

@ghost
Copy link
Author

ghost commented Dec 25, 2018

any ideas?

@ivanpopelyshev
Copy link
Collaborator

ivanpopelyshev commented Dec 25, 2018

what about autoResize, CSS set width/height, like pixi does it?

Or it could be something like InteractionManager.mapPositionToXXX doesn't work or something like that. Plugin overrides a few functions inside InteractionManager.

@ivanpopelyshev
Copy link
Collaborator

ivanpopelyshev commented Dec 25, 2018

OK, I put this in example, and it doesn't work:

var app = new PIXI.Application(WIDTH, HEIGHT, {resolution:2, autoResize:true});

I guess something is wrong with getRenderTexture() for this plugin. Unfortunately, I do not have time to investigate it because I'm working on v5 release. As soon as v5 is released, I'm gonna start coding streams where I remake pixi-display and other plugins for v5.

I guess its something in https://github.com/pixijs/pixi-display/blob/layers/src/Layer.ts#L6

@TombolaShepless
Copy link

@evgkfx did you ever find a work around to this issue? We're faving the same and would really like to us some nice lighting effects

@ivanpopelyshev
Copy link
Collaborator

Still working on v5.

@TombolaShepless getRenderTexture() code is not that difficult, you can try to debug that stuff

@TombolaShepless
Copy link

@ivanpopelyshev I'm pretty new to PIXI so I'm trying. So far I've found that the invocation of PIXI.RenderTexture.create() is not passing the right arguments, its currently passing:

this.renderTexture = PIXI.RenderTexture.create(width, height, resolution);

but according to the PIXI docs, resolution is the 4th arg and the 3rd is SCALE_MODE. I've updated the code to:

this.renderTexture = PIXI.RenderTexture.create(width, height, PIXI.settings.SCALE_MODE, resolution);

but the output is the same. Not sure where to go from here TBH

@TombolaShepless
Copy link

Step through it pretty much line-by-line and I can't for the life of me see what else could be wrong other than the above. Any more pointers in a general direction @ivanpopelyshev ?

@ivanpopelyshev
Copy link
Collaborator

You've done the ritual. I'm looking at it.

@TombolaShepless
Copy link

Thanks bud, I really appreciate the help. Sorry I couldn't be more use 😞

@ivanpopelyshev
Copy link
Collaborator

Actually your fix works, @TombolaShepless . But it doesnt work with pixi-lights. Do you need it with pixi-lights?

@TombolaShepless
Copy link

TombolaShepless commented Feb 23, 2019

Yeah with pixi-lights. Do you know why it doesn't work?

@ivanpopelyshev I think its these two lines, here and here

Bu I'm not expert. It seems to fix the renderTexture size by multiplying by resolution however the light positions are not correct

@ivanpopelyshev
Copy link
Collaborator

Of course! it has one uniform in light shader that means both "size in pixels" and "size in CSS" :)

@TombolaShepless
Copy link

this?

I have no idea what to change there - thats far beyond my knowledge and understanding lol

@ivanpopelyshev
Copy link
Collaborator

ivanpopelyshev commented Feb 23, 2019

Here, try change resolution in first line: https://pixijs.io/examples/#/layers/normals-drag.js

It uses https://pixijs.io/examples/pixi-plugins/pixi-lights.js and https://pixijs.io/examples/pixi-plugins/pixi-layers.js

I'll republish layers now, as for lights, we'll have to wait someone else.

@ivanpopelyshev
Copy link
Collaborator

Yeah, you've found whats wrong with pixi-layers, good job!

As for lights improvement, i'll do it after v5 release and after i move layers to v5. There'll be new demos!

Lights are experimental stuff, its very hard to add them as well as other experimental plugins: projections, heaven. @djmisterjon knows more than others about it. Do you want an invite to pixijs slack? send me an email if you want it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants