# Search:

Type: Posts; User: GClements

Page 1 of 20 1

1. ## Thread: Calculating vertex normal for OBJ faces

by GClements
Replies
10
Views
273

### If the OBJ file contains vertex normals, there's...

If the OBJ file contains vertex normals, there's no need to calculate them. If an OBJ file contains vertex normals, they should normally be preferred to anything you calculate yourself, as a...
2. ## Thread: Calculating vertex normal for OBJ faces

by GClements
Replies
10
Views
273

### No, it's the vertex normal for that vertex. ...

No, it's the vertex normal for that vertex.

Vertex normals are used for smooth shading, where the polygon mesh is an approximation to a smooth surface. The vertices are samples of the surface,...
3. ## Thread: Skeletal Animation GLSL

by GClements
Replies
7
Views
743

### Yes. When each vertex is only affected by a...

Yes.

When each vertex is only affected by a single bone, the calculation is straightforward. The vertex position is transformed by the bone transformation.

When vertices are affected by...
4. ## Thread: Calculating vertex normal for OBJ faces

by GClements
Replies
10
Views
273

Yes.

Yes.

by GClements
Replies
8
Views
405

### Yes; good catch. For some reason, AMD's GLSL...

Yes; good catch. For some reason, AMD's GLSL didn't notice that.

Sorry, that should be:

vec3 y = normalize(cross(z, x));

(the compiler did pick that one up; I forgot to copy the...

by GClements
Replies
8
Views
405

### vec4 c = modelview * vec4(centerIn, 1.0); ...

vec4 c = modelview * vec4(centerIn, 1.0);
vec4 u = modelview * vec4(up, 0.0); // w=0 as this is a direction, not a position
vec3 z = -c.xyz;
vec3 x = normalize(cross(u, z));
vec3...
7. ## Thread: Calculating vertex normal for OBJ faces

by GClements
Replies
10
Views
273

### No. Vertex normals are only used for lighting...

No. Vertex normals are only used for lighting calculations.

In the absence of any other source, a common approach is to average the face normals of all of the faces to which a vertex belongs.
8. ## Thread: Calculating vertex normal for OBJ faces

by GClements
Replies
10
Views
273

### That isn't the reason. Vertex normals are only...

That isn't the reason. Vertex normals are only used for lighting. Face culling is based upon face normals, which are calculated from vertex positions. If the object is inside-out, either your Z...
9. ## Thread: Transparency problem - Not able to see all faces behind a transparent face

by GClements
Replies
3
Views
138

### In the general case, you need to use a...

In the general case, you need to use a topological sort. Note that it's possible for the ordering graph to contain cycles, in which case you need to split polygons to break the cycles. If the...

by GClements
Replies
8
Views
405

### The second shader is identical to the first,...

The second shader is identical to the first, except that it rotates the billboard so that the billboard's orientation is fixed in model space rather than screen space. The up vector is a vector in...

by GClements
Replies
8
Views
405

### You can't determine the rotation simply from a...

You can't determine the rotation simply from a vertex position. You need at least the object-space position of the billboard's centre and the position of the vertex within the billboard (i.e. which...
12. ## Thread: Why math libraries for transformations? Why not use gl functions instead?

by GClements
Replies
6
Views
200

### It's glGet() that's slow. Typical OpenGL commands...

It's glGet() that's slow. Typical OpenGL commands simply append a command (an opcode and parameters) to the command queue then return immediately. glGet() has to do that, then flush the commands to...
13. ## Thread: While matrices are in Row-major or column-major, I'm in confunsion-major!

by GClements
Replies
4
Views
160

### "Row-major" means that the outermost array...

"Row-major" means that the outermost array dimension is the row. "Column-major" means that the outermost array dimension is the column.

Given a matrix

[ 0 1 2 3]
[ 4 5 6 7]
[ 8 9 10...
14. ## Thread: How does drawing circle work?

by GClements
Replies
1
Views
169

### The above converts polar coordinates (radius and...

The above converts polar coordinates (radius and angle) to rectangular (Cartesian) coordinates (X and Y). Thus, the loop generates a sequence of points with a fixed radius r and increasing angles...

by GClements
Replies
2
Views
124

### That matrix performs an oblique projection, but...

That matrix performs an oblique projection, but I'm unsure as to what theta and alpha are meant to represent.

Oblique projections are normally expressed as

[1 0 a*cos(phi) 0]
[0 1 a*sin(phi)...
16. ## Thread: Skeletal Animation GLSL

by GClements
Replies
7
Views
743

### No. In this case, QT or DQ are just more...

No.

In this case, QT or DQ are just more compact representations of a matrix constructed from a rotation and a translation (note that the matrix can't have any scaling or skew, which is why you...

by GClements
Replies
3
Views
238

### OBJ uses 1-based indices throughout. You appear...

OBJ uses 1-based indices throughout. You appear to be using 1-based indices for positions but 0-based indices for texture coordinates and normals.

by GClements
Replies
1
Views
609

### You don't appear to be checking the link status...

You don't appear to be checking the link status of your program.

Beyond that, there's not much point in asking other people to debug your code based upon isolated fragments. More often than not,...
19. ## Thread: extra surface inside the octahedron

by GClements
Replies
3
Views
168

### That looks as if depth testing isn't working,...

That looks as if depth testing isn't working, resulting in back faces being drawn over front faces.

Is depth testing enabled? Does the window have a depth buffer? Is the depth buffer being cleared...

by GClements
Replies
6
Views
659

### Any object transformations need to be included in...

Any object transformations need to be included in the overall transformations for both view-space and light-space. Otherwise, you'll be calculating shadows for a different scene than the one you're...

by GClements
Replies
6
Views
659

### If the different objects have their own...

If the different objects have their own transformations, my first guess would be that you aren't using the same overall transformations in both passes. The technique requires using the same...
22. ## Thread: How to get vertex color ?

by GClements
Replies
4
Views
204

### If you're using the fixed-function pipeline, you...

If you're using the fixed-function pipeline, you can use glRenderMode(GL_FEEDBACK). Note that this applies after culling; no data will be returned for culled polygons. Polygons and quads may be...
23. ## Thread: Camera view matrix inverted?

by GClements
Replies
1
Views
517

### You're creating a perspective projection with a...

You're creating a perspective projection with a field-of-view angle of 60 radians, which is equivalent to -162 degrees (note: negative). This results in the x and y scale factors being negative (i.e....
24. ## Thread: Opengl ES 2.0: How can I pass large(aprox 1-9mb ) array to fragment shader?

by GClements
Replies
4
Views
278

### If you don't want the texture to be filtered, set...

If you don't want the texture to be filtered, set GL_TEXTURE_MIN_FILTER and GL_TEXTURE_MAG_FILTER to GL_NEAREST, and/or sample at the centre of each texel.

But even then, the standard only...