2d

How to make a smooth camera follow algorithm?

孤人 提交于 2019-11-28 22:37:23
问题 I am making a game with LibGDX (Java). I need the camera to follow a fast moving character. The easiest way to do it is to just write this: this.getCamera().position.set(obj.x, obj.y, 0); But, is there any algorithm to make this more smooth? Like when camera is not that strict, and is always a bit late: character goes quick right, camera follows with slight delay, or if you suddenly appeared somewhere far, camera doesn't teleport instantly but travels at a top speed to you when it comes

Convert 2d images to 3d model [closed]

此生再无相见时 提交于 2019-11-28 21:32:56
问题 I need to display 3d sculptures in my application, but all I will have initially is 2d images of sculpture from different angles( angle and count of images is under our control) 1. Is there any library which can do that, e.g. take 8 images from all side and stitch it into a 3D model? Any opensource/commercial library/product is ok. 2. Alternatively how difficult it would be to do if I start from scratch? what direction you would take e.g. Simple solution one 3D model is not a strict

Framebuffer FBO render to texture is very slow, using OpenGL ES 2.0 on Android, why?

不问归期 提交于 2019-11-28 19:56:28
I am programming an Android 2d game using opengl es 2.0. After I draw my sprites to the backbuffer I draw lights to a FBO and try to blend it to the back buffer again. When I draw the FBO to the framebuffer, even trasparent without any color, the framerates drops from 60 to 30 on a Samsung Galaxy w (it has an adreno 205 as gpu). I searched everywhere and tried everything, even if I draw a single sprite on the scene and blend a trasparent FBO texture to the screen the framerate drops. I tried other games with lighting effects on that phone and they run fine, almost every game is fine on that

Getting text position while parsing pdf with Quartz 2D

試著忘記壹切 提交于 2019-11-28 19:53:50
another question regarding pdf parsing... Just read PDF Reference version 1.7 "5.3.1 Text-Positioning Operators" and I am a little bit confused. I wrote some code to get transformation matrix and initial text position. CGPDFOperatorTableSetCallback (table, "MP", &op_MP);//Define marked-content point CGPDFOperatorTableSetCallback (table, "DP", &op_DP);//Define marked-content point with property list CGPDFOperatorTableSetCallback (table, "BMC", &op_BMC);//Begin marked-content sequence CGPDFOperatorTableSetCallback (table, "BDC", &op_BDC);//Begin marked-content sequence with property list

3d to 2d Projection Matrix

吃可爱长大的小学妹 提交于 2019-11-28 19:34:31
I have 3 points in a 3D space of which I know the exact locations. Suppose they are: (x0,y0,z0) , (x1,y1,z1) and (x2,y2,z2) . Also I have a camera that is looking at these 3 points and I know the 2D locations of those three points on camera view plane. So for example (x0,y0,z0) will be (x0',y0') , and (x1,y1,z1) will be (x1',y1') and (x2,y2,z2) will be (x2',y2') from the camera's point of view. What is the easiest way to find the projection matrix that will project those 3D points into 2D points on camera view plane. We don't know anything about the camera location. This gives you two sets,

iOS - 2d image turn into a 3d

蓝咒 提交于 2019-11-28 18:49:42
I was checking out this cool app called Morfo . According to their product description - Use Morfo to quickly turn a photo of your friend's face into a talking, dancing, crazy 3D character! Once captured, you can make your friend say anything you want in a silly voice, rock out, wear makeup, sport a pair of huge green cat eyes, suddenly gain 300lbs, and more. So if you take a normal 2D image of steve jobs & feed it to this app it converts it into a 3D model of that image & the user can interact with it. My questions are as following - How are they doing this? How is this possible in iPad? Isn

How to know if a line intersects a plane in C#?

左心房为你撑大大i 提交于 2019-11-28 18:36:56
I have two points (a line segment) and a rectangle. I would like to know how to calculate if the line segment intersects the rectangle. From my "Geometry" class: public struct Line { public static Line Empty; private PointF p1; private PointF p2; public Line(PointF p1, PointF p2) { this.p1 = p1; this.p2 = p2; } public PointF P1 { get { return p1; } set { p1 = value; } } public PointF P2 { get { return p2; } set { p2 = value; } } public float X1 { get { return p1.X; } set { p1.X = value; } } public float X2 { get { return p2.X; } set { p2.X = value; } } public float Y1 { get { return p1.Y; }

Creating 3D volume from 2D slice set of grayscale images

房东的猫 提交于 2019-11-28 17:40:06
I am to create a 3D volume out of grayscale image set using Matlab. A set contains a continuous and quantized slices of 2D grayscale image. I am still considered myself a rookie in Matlab, but this is what I currently have in my mind: create an empty space for 3D volume. On each image, we perform all the preprocessing operation so that we only got the part that is of our interest. (In this question, assume that this preprocessing part always work flawlessly) Go through the image, each pixel's x and y coordinate on 2D will be transfer to the empty space. For z coordinate, we can use the slice

Inverse Bilinear Interpolation?

試著忘記壹切 提交于 2019-11-28 16:32:54
I have four 2d points, p0 = (x0,y0), p1 = (x1,y1), etc. that form a quadrilateral. In my case, the quad is not rectangular, but it should at least be convex. p2 --- p3 | | t | p | | | p0 --- p1 s I'm using bilinear interpolation. S and T are within [0..1] and the interpolated point is given by: bilerp(s,t) = t*(s*p3+(1-s)*p2) + (1-t)*(s*p1+(1-s)*p0) Here's the problem.. I have a 2d point p that I know is inside the quad. I want to find the s,t that will give me that point when using bilinear interpolation. Is there a simple formula to reverse the bilinear interpolation? Thanks for the

2D Engines for Javascript [closed]

感情迁移 提交于 2019-11-28 15:47:30
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 4 years ago . I'm attempting to build a tile-based game in javascript, using HTML5 canvas. There are -many- engines to choose from, such as; JawsJS GameJS Cocos2D MelonJS CraftyJS ImpactJS (commercial) ... and the list goes on and on. However, there does not seem to be one de facto