Comments (8)
When I apply a ColorMatrixFilter on and ImageLoader the image disapears. If I apply it on it's parent it works but has unexpected results (stuff gets moved around).
Did you try adding the filter only in the Event.COMPLETE
event handler? Perhaps the filter gets drawn too soon, while there's no texture data available yet?
In any case, here is a simple utility function that allows you apply a filter directly to a texture.
from starling-framework.
I gave it a 2 seconds timeout where I can see the object rendered corectly, then it's drawn and replaced with the texture.
Hm, okay. Sorry for the troubles – this is absolutely something that should work. I hope I'll find the time to take another look at this problem.
For me it's a sort of cache where I reduce the number of objects from 35 (up to 80) to just 7. I've already generated a new texture, but the utility function could help too.
Okay! It's definitely a smart idea to use RenderTextures as a cache to simplify the scene. 👍
from starling-framework.
I just found a workaround and probably the root cause of this issue 😀
Apparently the transform of the root display object is not took into account when this later object is not added to the stage
while drawing (but only for DisplayObjects
with filters).
Workaround
addChild(_camera); // adding the drawn object to the stage solves the issue!
_renderingTexture.draw(_camera);
removeChild(_camera); // remove the drawn object to prevent rendering it twice
@PrimaryFeather Is this the intended behavior?
from starling-framework.
Haha, Aurélien, what are you doing to me? This is the worst possible combination to debug, filter plus render texture! 😂
I just tried to debug your sample to get to the root of the issue. It definitely has something to do with the object not being part of the stage, though I haven't been able to exactly put my finger on the problem.
When the current render target is a render texture, the fragment filter logic should replace all stage-related values with those of the render texture, as it effectively becomes the viewport in that case. I think I remember hitting a wall in that area, as my comment in this line shows.
In that case, the only solution would have been a breaking change in the DisplayObject class, which is a no-go, so I decided to postpone this change for Starling 3.0. 😉
To be honest, I'm not 100% sure it's exactly this issue. I'll try to look into it again with a clear head — getting my mind into this matrix stuff again is not easy. 🤪 But it seems very likely, and that your workaround fixes the problem indicates that it's connected.
At least you've got a workaround now!
The other thing you could do instead is to not use a render texture, but instead add a filter to your root object (whatever is "Starling.root") instead. In that case, every object can stay on the stage, and the FragmentFilter class can even optimize the filter bounds and not draw anything that's outside the stage.
However, if that's an alternative depends on what exactly you want to achieve.
from starling-framework.
from starling-framework.
from starling-framework.
I'm having the same issue, or similar.
When I apply a ColorMatrixFilter
on and ImageLoader
the image disapears. If I apply it on it's parent it works but has unexpected results (stuff gets moved around).
All gets drawn to a RenderTexture
, and workaround did not work for me.
I will probably need to create multiple color textures for this. Is there a way to apply a filter to a texture and get a new texture out of it?
from starling-framework.
I gave it a 2 seconds timeout where I can see the object rendered corectly, then it's drawn and replaced with the texture.
For me it's a sort of cache where I reduce the number of objects from 35 (up to 80) to just 7. I've allready generated a new texture, but the utility function could help too.
Thank you.
from starling-framework.
Related Issues (20)
- TextField AutoScale clips text if multiline and > 100% display scale HOT 2
- Glow Filter: Color issue HOT 7
- native overlay now block touch and mouse input HOT 1
- How do I use it correctly “drawToBitmapData” HOT 6
- AssetManager strange behavior
- AssetManager problem HOT 9
- Reverse delay for Tween HOT 2
- Stats showing actually rendered frames HOT 8
- ArgumentError in createVertexBuffer HOT 14
- DisplayObject dispose() method doesn't automatically remove the object from its parent HOT 3
- Render Texture: "Error #3605: Sampler 0 binds an invalid texture" when not cleared or drawn before actual Image rendering HOT 3
- Texture: Setting vertex UV coordinates doesn't take into account the potential frame of SubTextures HOT 5
- How do we use Asset Manger with Google Play's Install Time Asset Packs? HOT 4
- Starling Texture.fromCamera() flickering and a part of the picture is missing on Windows HOT 4
- Object not removed from Stage on Android - Starling maybe? HOT 5
- Starling update from 2.5 to 2.7 doesn't catch tap around the left/bottom side HOT 2
- Juggler: String allocation when using IAnimatable as a Dictionary key HOT 4
- OpenGL error at macOS 12.2.1 (M1) HOT 2
- [Feature Suggestion] Vector Graphic Tesselation HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from starling-framework.