Tag Info

Hot answers tagged

5

This may be a winding issue. Are you sure that the texture coordinates are parsed in the right sense of rotation? However, this how you should debug you program. Draw in wire frame mode to find out how the rectangle is composed out of two triangles. The OpenGL command for this is glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);. Use a texture with a gradient ...


4

Local versus world is just a matter of the order in which you compose transforms. For instance, when using row-vector math, multiplying the current local-to-world transform by a new transform on the left will perform the new transform in local space, since it will be equivalent to doing the new transform followed by the old local-to-world transform. ...


3

Easy way of building the rotation matrix: Start with an identity matrix Translate the matrix by -centre of the object Rotate the matrix by the desired amount Translate the matrix by centre of the object Use the resulting matrix to transform the object that you desire to rotate


2

Rotation/scaling is around the origin. To both scale/rotate around a pivot, you apply a negative translation to move the pivot point to the origin, apply your scale and rotate, and then move your pivot point back. mat4 result = glm::translate(-pivot) * glm::scale(..) * glm::rotate(..) * glm::translate(pivot) * ...


2

First thing I see is that you shouldn't read the quaternion in reverse order. Also you shouldn't use glm::mix, use glm::slerp instead. And here is how I construct the bone transform: mat = glm::mat4_cast( currentrotation ); mat[0][0] *= currentscale.x; mat[1][0] *= currentscale.x; mat[2][0] *= currentscale.x; mat[0][1] *= currentscale.y; mat[1][1] *= ...


2

I managed to fix everything through a lot of experimenting. It seems my problem came from my own misunderstanding of quaternions. I was under the impression that they represented a change in angle, when actually they represent an orientation. So my rotation matrix was always a bit strange because I was just pushing seemingly random values into it, ...


1

I've done it by using a mix of Lighthouse3D tutorial, which I got by following the tip of @concept3d. My previous Frustum Culling routine was execute in about 12~16ms using Clip Space approach, but extracting planes from camera, I can execute it in 1~2ms....So, the peformance boost is awesome. Here is my final code. Whenever my rotation/position changes, I ...


1

Your camera (and every object with a transform) has its own local space axes, which will usually not be the same as the world axes. Transforming around the world-space axis will give a different result than transforming around a local-space axis. Cameras typically need to work with both. You usually want to rotate a camera horizontally around "world up" ...


1

In V8 you can wrap your own, custom C++ classes expose them to JavaScript and have V8 take care of destructing the instance once the corresponding JS object gets GC'd. But you still have to write your methods in a style like this: Handle<Value> Vector::add(const Arguments& args) { Vector *vector = ...


1

Your ray is possibly in view (camera) space. I'm unsure exactly how glm::unproject works. If I'm right, pass its end points through the inverse camera matrix to put then in world space. Remember that a coordinate is expressed in some basis, which for our purposes can be considered a vector space (mathematically there is some difference) or commonly just a ...


1

The image of a point A under a rotation around another point B (an affine rotation if B is not the origin of the space) is A', with A' = B + R*(A-B) where R is the matrix of the associated linear rotation. For example, in dimension 2, say you want to rotate A = (1,0) around B = (1,1) by 90 degrees counter-clockwise. That will yield (2,1). Make a picture ...


1

How can I calculate intersection with my scene geometries? it varies depending on your performance needs and scene size, there are different approaches the easiest one is checking ray intersection with all bounding volumes containing geometry in the scene, however this may not be good enough if your scene is huge, or you have limited computational ...



Only top voted, non community-wiki answers of a minimum length are eligible