Paralax map looks incorrect

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
ErUs
Posts: 165
Joined: Thu Oct 07, 2004 6:13 pm

Paralax map looks incorrect

Post by ErUs »

Code: Select all

// Front
		Vertices[0] = video::S3DVertex(0,0,1, 0,0,1,
			video::SColor(255,255,255,255), 0, size.Y);
		Vertices[1] = video::S3DVertex(1,0,1, 0,0,1,
			video::SColor(255,255,255,255), size.X, size.Y);
		Vertices[2] = video::S3DVertex(1,1,1, 0,0,1,
			video::SColor(255,255,255,255), size.X, 0);
		Vertices[3] = video::S3DVertex(0,1,1, 0,0,1,
			video::SColor(2255,255,255,255), 0, 0);

		// Back
		Vertices[4] = video::S3DVertex(0,0,0, 0,0,-1,
			video::SColor(255,255,255,255), size.Y, size.X);
		Vertices[5] = video::S3DVertex(0,1,0, 0,0,-1,
			video::SColor(255,255,255,255), 0, size.X);
		Vertices[6] = video::S3DVertex(1,1,0, 0,0,-1,
			video::SColor(255,255,255,255), 0, 0);
		Vertices[7] = video::S3DVertex(1,0,0, 0,0,-1,
			video::SColor(255,255,255,255), size.Y, 0);

		// Top
		Vertices[8] = video::S3DVertex(0,1,0, 0,1,0,
			video::SColor(255,255,255,255), size.Z, size.X);
		Vertices[9] = video::S3DVertex(0,1,1, 0,1,0,
			video::SColor(255,255,255,255), 0, size.X);
		Vertices[10] = video::S3DVertex(1,1,1, 0,1,0,
			video::SColor(255,255,255,255), 0, 0);
		Vertices[11] = video::S3DVertex(1,1,0, 0,1,0,
			video::SColor(255,255,255,255), size.Z, 0);

		// Bottom
		Vertices[12] = video::S3DVertex(0,0,0, 0,-1,0,
			video::SColor(255,255,255,255), size.X, size.Z);
		Vertices[13] = video::S3DVertex(1,0,0, 0,-1,0,
			video::SColor(255,255,255,255), 0, size.Z);
		Vertices[14] = video::S3DVertex(1,0,1, 0,-1,0,
			video::SColor(255,255,255,255), 0, 0);
		Vertices[15] = video::S3DVertex(0,0,1, 0,-1,0,
			video::SColor(255,255,255,255), size.X, 0);

		// Right
		Vertices[16] = video::S3DVertex(1,0,0, 1,0,0,
			video::SColor(255,255,255,255), size.Y, size.Z);
		Vertices[17] = video::S3DVertex(1,1,0, 1,0,0,
			video::SColor(255,255,255,255), 0, size.Z);
		Vertices[18] = video::S3DVertex(1,1,1, 1,0,0,
			video::SColor(255,255,255,255), 0, 0);
		Vertices[19] = video::S3DVertex(1,0,1, 1,0,0,
			video::SColor(255,255,255,255), size.Y, 0);

		// Left
		Vertices[20] = video::S3DVertex(0,0,0, -1,0,0,
			video::SColor(255,255,255,255), size.Z, size.Y);
		Vertices[21] = video::S3DVertex(0,0,1, -1,0,0,
			video::SColor(255,255,255,255), 0, size.Y);
		Vertices[22] = video::S3DVertex(0,1,1, -1,0,0,
			video::SColor(255,255,255,255), 0, 0);
		Vertices[23] = video::S3DVertex(0,1,0, -1,0,0,
			video::SColor(255,255,255,255), size.Z, 0);

		u16 indices[] = {
			0,  1,  2,      0,  2,  3,    // front
			4,  5,  6,      4,  6,  7,    // back
			8,  9,  10,     8,  10, 11,   // top
			12, 13, 14,     12, 14, 15,   // bottom
			16, 17, 18,     16, 18, 19,   // right
			20, 21, 22,     20, 22, 23    // left
		};
I am trying to draw a cube in a custom scene node. The cube is displaying correctly but when i try a paralax map ontop it doesnt look correct. I think the normals are wrong.

Can anyone see the problem?
Post Reply