-
Notifications
You must be signed in to change notification settings - Fork 20
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
BitmapData: Reflection with canvas #20
Comments
Hi Fabian, do you have a code sample online - so I can take a look ? |
Hi Karim, not yet...but i´ll put something together asap |
Here is the flat canvas code of the image above. Can you setup a prototype to use this as a texture? |
demo: http://kurst.co.uk/samples/awayts/reflectionTest/ not much free time today - so not very pretty but should help :-) |
wow! That was fast! The reason why I couldn´t find any way was: |
You welcome... would love to see what you come up with. Adding source here for reference: module misc{
}
} |
Hi Fabian - there is an big with bitmapdata textures and globalCompositeOperation in Away3D TS. Not sure what it is yet - however - try without it ( by making your gradient fade to black / background colour instead of transparent ) . That is if you need to use it within the Away3D TS framework . the issue is with that line: and logged here: #21 |
Hi Karim, I can´t see the bug. For me it works fine. |
Thank you for the feedback - visual glitch is only when it used as texture in 3D ( Away3D TS ) . |
Hi,
I tried to make a reflection of a plane on another plane (with gradient to tranparent)
just like this: http://mrdoob.github.io/three.js/examples/canvas_materials_video.html
I tried 2 ways...but couldn´t get it working:
After doing the gradient stuff I use it the following way:
var bmpTex = new away.textures.BitmapTexture(flippedBitmap, false);
var reflMatTx: away.materials.TextureMaterial = new away.materials.TextureMaterial( bmpTex);
both won´t work the way I expected.
The canvas itself (2D) looks fine.
I tried many settings, but the result on the 3d plane never shows the gradient to alpha=0;
Here is what I do after loading an image:
var flipMatrix:away.geom.Matrix = new away.geom.Matrix();
flipMatrix.scale(1, -1);
flipMatrix.translate(0, image.height);
flippedBitmap = new away.display.BitmapData(image.width, image.height, true, 0);
flippedBitmap.draw(image, flipMatrix);
Here is how it works in threejs:
image = document.createElement( 'canvas' );
image.width = 480;
image.height = 204;
--- end code ---
The text was updated successfully, but these errors were encountered: