New answers tagged

1

Each face has different texture coordinates for its 4 vertices. However, your OBJ loading code is picking one texture coordinate and using that every time the same vertex position is used. Your cube.obj file has these faces in it (among many others): f 1/1/1 2/2/1 3/3/1 f 1/9/3 4/10/3 6/11/3 Let's just look at the first vertex in each face. The first ...


2

The reason you are getting artefacts is because you are not using a bump map shader; You are using a normal map shader, with a displacement map. A normal map (often confused with bump map) looks like this: The colour represents the surface normal, which you then transform from tangent space to view space. The texture you have shown is a height, or ...


1

First, change the workhorses of your texture generation loops into its own standalone generator functions. These take in a set of parameters - like which pixel you want to generate a result for - and return the generated result according to some rule. Color GetGradientColor(int x, int y) { // TODO: You can probably clean this up with Mathf.Abs() or a ...


1

You can't mix immediate mode (glBegin, glEnd, etc.) with the programmable pipeline (shaders) like this. You either need to stick to immediate mode (you really shouldn't, it's 2019) and use shaders that are compatible with it (using the built-in variables instead of attributes) or use a modern OpenGL version and pass the model information as vertex buffer ...


1

I figured out what was going on. The problem was not floating point precision, and not that I needed to make my own mipmaps to blend each level correctly. There were actually 2 problems: I was using the Max Rects packer algorithm with non-power-of-2 sized images to create the texture atlas. I wasn't setting GL_TEXTURE_MAX_LEVEL What I was doing: Use Max ...


2

While you should never use assets from someone else's game in your own game, there is a lot you can learn from reverse-engineering the games of other people and figuring out how they did things. The first texture appears to be an albedo texture. This is a texture which tells you which parts of the object have which basic color. This texture is usually the ...


Top 50 recent answers are included