Shader screenshot
See original GitHub issueHello,
I render an image with a fragment shader:
var app = new PIXI.Application({ width: window.innerWidth, height: window.innerHeight, antialiasing: false });
app.resizeTo = window;
let fragmentShader = document.getElementById('fragmentShader').textContent;
let filter = new PIXI.Filter(null, fragmentShader);
filter.uniforms.iResolution = {x: app.screen.width, y: app.screen.height};
filter.uniforms.xmin = xmin;
filter.uniforms.xmax = xmax;
filter.uniforms.ymin = ymin;
filter.uniforms.ymax = ymax;
filter.uniforms.phase = 0;
let container = new PIXI.Container();
container.filterArea = app.screen;
container.filters = [filter];
app.stage.addChild(container);
document.getElementById('container').appendChild(app.view);
I tried this technique (the takeScreenshot
function) to take a screenshot. But I only get a black 1x1 image. Should I use something else to take a screenshot?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Screenshots - Sildurs Shaders
Screenshots : Vibrant shaders album · Enhanced Default album · Fabulous shaders album. Sildur. GitHub E-Mail Twitter FB Page YouTube Discord Forum Donation ......
Read more >Minecraft Shaders Screenshot (Edited) [1920x1080] - Pinterest
[1920x1200] I made a collection of Minecraft shaders screenshots to use as wallpapers.
Read more >Screenshots. Shaders or no shaders? : r/Minecraft - Reddit
I dislike shaders for screenshots, since the shots do not represent what most people will see if they download a schematic / world...
Read more >How to Take BETTER SCREENSHOTS in Minecraft! - YouTube
In this video, I'll show you how to take better screenshots in Minecraft! I cover angles, shaders, resolution, shadows, post processing and ...
Read more >Minecraft screenshots aren't turning out? Do this instead.
This video will show you the techniques to make your screenshots look amazing, even if you can't run shaders !
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
extract.canvas(app.stage)
caculates bounds of stage and takes that part of screen. It doesnt seefilterArea
, that field does not affect bounds, it swaps bounds only forFilterSystem
.You have to create renderTexture of appropriate size, use
renderer.render(app.stage, renderTexture);
and thenextract.canvas(renderTexture);
- that will ensure that size of output is correctWhy do you need a Filter in first place when you dont use container contents (uSampler uniforms) ? Use mesh shader, its easier: https://pixijs.io/examples/#/mesh-and-shaders/triangle-textured.js
There are two ways of evading those kind of problems:
Help PixiJS team produces articles and examples for all user cases like this one, maybe make one example yourself and ask to publish it in wiki
Using pixijs cloned repo instead of just docs. Open it in separate IDE window and search for classes you use when you work with pixijs. If you read
Extract
class sources and try to debug it a bit - you will see the problem. Extract itself isnt magic it is just a wrapper around other pixi operations and WebGLreadPixels
.Thank you for noticing that filter example + screenshot example = a problem. I will remember that and I’m going to make a link at https://github.com/pixijs/pixi.js/wiki/v5-Hacks .
Seems answered. Closing. @stla let me know if it’s not and we can reopen.