Alex_on_the_web Posted December 4, 2014 Share Posted December 4, 2014 Hey folks! I've been screwing around with this damn mountain side covering mesh all day. The last few (4+) hours were about getting it a bump mapped texture. I'm having problems with making up UV coordinates I assume. I'm going around each side, and I'm pushing two vertices for each original vertex on the edge of the mountain, one for the top, and one for a bottom to cover the side, like so:xLeft.push(x, y, z, x, -70, z);Then I join them to a single array of positions like so, and try to make 2*UV coordinates for each pair of vertices (pair as in a top and a bottom one, like inserted before):var wrappingPoints = xRight.concat(zTop, xLeft, zBottom);var wrappingUvs = [];var increment = 1 / wrappingPoints.length / 3 * 2;for (var i = 0; i < wrappingPoints.length / 3; i += 2) { wrappingUvs.push( increment * i, wrappingPoints[3 * i + 1] / yMax, // x , y increment * i,0 // x , y );}I've been mixing up the orders of the Us and Vs, and trying to do all sorts of experiments, but for the sake of it, I cannot find what's wrong with this. The thing that's visible on the image is that every second triangle of the mesh (1 tri / quad) has it's texture upside down. So the coordinates I wanted to add for each pair of vertex were - (increment * i, wrappingPoints[3 * i + 1] / yMax) for the top and (increment * i,0) for the bottom one. What am I doing wrong here? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.