Getting distortion in animated images unity2d? - animation

I am new in Unity2d creating animation via series of images of the player and images are very clear but when i add them in my animation they are getting distortion.
I am following this tutorial:
http://www.41post.com/4742/programming/unity-animated-texture-from-image-sequence-part-2
and it working perfectly for it's own images, Note: my images has empty spaces (as png pics has) and only that part of the images getting distortion while tutorial images has no empty spaces.
The Print Screen of my problem: Image sample

Didn't went through the entire tutorial line by line. What I suspect though is that you are overlapping your textures by just looking at the screenshot.
Imagine you are drawing pictures on the only piece of paper you have at hand. Suppose there are 1, 2, ..., k images, you draw the first image i1 on the piece of paper. Now, you wanna draw the second one i2. Since you have only one piece of paper, you have to rub away your previous drawing first. Without clearing the drawings on your paper, your new drawings will always overlap the old ones. Unless you are using a new piece of paper everytime, of course.
Back to the question. If the images used in the animation are fully opaque (not even a single pixel), then of course you will not notice the difference even if you draw new paintings over the old ones. But in your case, there are many transparent areas in the images. If the canvas is not cleaned everytime before drawing a new painting, it is obvious that the results will be something similar to what you have in the screenshot.
The images used in the tutorial are fully opaque, I suppose.

Related

Is there any way to implement this beautiful image effect?

Recently I found an amazing APP called Photo Lab,and I'm curious about one effect called Paper Rose.In the pictures below,one is the original picture,the other is the effected picture.My question is what kind of algorithm can do this effect,and it would be better if you can show me some code or demo.Thanks in advance!
enter image description here
enter image description here
I am afraid that this is not just an algorithm, but a complex piece of software.
The most difficult part is to model the shape of the rose. The petals are probably a meshed surface. It is not so difficult to give them a curved shape, but the hard issue is to group them in such a way that they do not intersect.
It is not quite impossible that this can be achieved by first putting them in a flat geometry where you can master intersections, then to wrap it around an axis with a king of polar transform. But I don't really believe in that. I rather think that they have a collision-avoiding geometric modeller.
The next steps, which are more classical, are to texture-map the pictures onto the petals and to perform the realistic rendering of the whole scene.
But there's another option, which I'll call the "poor man's rendering".
You can start from a real picture of a paper rose, where the petals have an empty black, thick frame. Then on the picture, you detect (either in some automated way or just by hand) points that correspond to a regular grid on the flattened paper.
As the petals are not wholly visible, the hidden parts must be clipped out from the mesh, possibly by using a polygonal fence.
Now you can take any picture, fit it over the undistorted mesh, clip out the hidden areas and warp to the distorted position. Then by compositing tricks, you will give it a natural shaded appearance on the rose.
Note: the process is eased by drawing a complet grid inside the frame. Anyway, you will need to somehow erase it before doing the compositing, in order to retrieve just the shading information.
I would tend to believe that the second approach was used here, as I see a few mapping anomalies along some edges, which would not arise on a fully synthetic scene.
In any case, hard work.

rendering thousands of unique text labels using three.js

I have a THREE.PointCloud that contains a large amount of points. In the screenshot above, each point is mapped to small purpleish circle.
I'm trying to figure out a way to display text labels beside each points.
My first attempt was to dynamically create text via the canvas and display the textures inside THREE.Sprite objects. This achieved the look I was going for, but the performance hit was significant. I quickly learned this wouldn't scale past just a few hundred points.
I'm thinking there may be a way to do this with shaders but I cannot figure out the approach. The method used in animating a million letters used a texture of glyphs, and mapped the letters to the glyphs:
I'm thinking I could do the same by creating a THREE.Geometry object and pushing the vertices and faces for each text letter of the labels. The downside is that I want the labels to billboard so that they always face the camera. Billboarding in the vertex shader seems to be pretty straightforward.
My feeling is that there are already some examples out there that combine all of these ideas into a single working example. Any suggestions on how to do large-scale text labels would be greatly appreciated. Thanks!
I figured it out. You have to use a glyph sheet and render each character as a quad using two faces.
The process is outlined pretty well in animating a million letters
I can get away with about a million on-screen characters before performance starts taking a hit.

Unity script: scene to 3D led cube

I am a total beginner to Unity, but I'm getting familiar with the interface and the way scripts work with Game Objects. Some days ago, I came across with an article regarding a 3D LED Matrix controlled by Unity and since then I've been trying to make it work with my project.
Original article: http://philippseifried.com/blog/2014/10/29/3d-led-matrix-with-unity/
Basically, once the script is attached to an Orthographic camera (or at least that's what I understood from the article), the camera layers and "slices" the scene, transforms it into a pixel matrix and paints the result into some preview layers dynamically generated.
I have accomplished to attach the camera and get the preview layers to show up. However, I'm unable to get the final result the article shows, as preview layers show absolutely nothing. I think it has to do with the fact that the author is using some kind of transparent planes I have been unable to replicate.
It would be great if someone could guide me a bit to get the exact same result of the article by reading it and watching the last Vine, as it shows his Unity screen with the transparent layers working up and running.
The script was looking at the background color to decided wether a pixel had to be painted or not.
Changing the camera background to transparent (RGBA) was enough to see the final result.

Concatenating two images in opengl

I'm developing a little videogame in which I have an infinite background image which moves horizontally. The image obviously is not infinite, it just finishes the same way it starts, so if I concatenate the image with itself, it seems is infinite.
The problem I'm having is that in the place where the two images join, a vertical black line appear. Looks like is not joining them in the exact position and I can see the black background.
I thought it was because the width of the images were not integers, but even if I superimpose one image over the other, the black vertical line still appear.
Any tips please?
What you are trying to do is called tiling. The image should be inherently 'tile-able'. To do this, put two copies of the image side by side, edges flush with each other and see if they are seamless.
Now then, to make things work in OpenGL, the simplest way might to make the quad (i.e. the mesh) holding your background pretty large and map this texture to a small part of this mesh (so that the image itself doesn't look stretched). Use the GL_REPEAT flag when texture mapping so the image is tiled across the entire large quad.

LibGDX - Sprites to texture using FBO

I am working on a simple painting app using LibGDX, and I am having trouble getting it to "paint" properly with the setup I am using. The way I am trying to do this is to draw with sprites, and add these individual sprites into a background texture, using LibGDX's FBO commands, when it is appropriate.
The problem I am having is something relating to blending, in that when the sprites are added to this texture that I am building, any transparent pixels of the sprite that are on top of pixels that have been drawn to previous will be brightened up substantially, which obviously doesn't look very good. The following is what the result looks like, using a circle with a green>red gradient as the "brush". The top row is part of the background texture now, while the bottom one is still in its purely sprite drawn form.
http://i238.photobucket.com/albums/ff307/Muriako/hmm.png
Basically, the transparent areas of each sprite are brightening anything below them, and I need to make them completely transparent. I have messed around with many different blending mode combinations and couldn't find one that was any better. GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA for example did not have this problem, but instead the transparent pixels of each sprite seem to be lowered in alpha and even take on some of the color from the layer below, which seemed even more annoying.
I will be happy to post any code snippets on request, but my code has become a bit of mess since I started trying to fix these problems, so I would rather only put up the necessary bits as necessary.
What order are you drawing the sprites in? Alpha blending only works with respect to pixels already in the target, so you have to draw all alpha-containing things (and everything "behind" them) in Z order to get the right result. I'm using .glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);

Resources