Thread: Fixing the black triangles, without disabling black.

Page 1 of 3 123 LastLast
Results 1 to 10 of 25
  1. #1 Fixing the black triangles, without disabling black. 
    Registered Member Rememberm3's Avatar
    Join Date
    Aug 2013
    Posts
    1,716
    Thanks given
    56
    Thanks received
    108
    Rep Power
    129
    Some long time ago, I was browsing on these forums, trying to find a solution to the annoying black triangles.
    The solutions I found were mostly disabling the whole black color, but that would fuck up some customs I had, so I kept searching.
    In 1 of the reply's to these posts, I found a method and I tried implementing it. I logged in and the black triangles were gone.
    I am not sure if this works for the npcs, but it does work for the models.
    Let's start.

    Removing the black colour disabling
    Go into your client and open up model.java.
    Search for: "anIntArray1640[i2] == 0"
    If you can't find "anIntArray1640[i2] == 0" then just skip this step.
    You will see something like this:
    Code:
    for (int i2 = 0; i2 < numberOfTriangleFaces; i2++) {
    			if (anIntArray1640 != null && face_alpha != null)
    				if (anIntArray1640[i2] == 65535 //Most triangles
    				|| anIntArray1640[i2] == 0  //Black Triangles 633 Models
    				|| anIntArray1640[i2] == 16705 //Nezzy Green Triangles//GWD White Triangles
    				)
    Comment out: "|| anIntArray1640[i2] == 0"
    So you get this:
    Code:
    for (int i2 = 0; i2 < numberOfTriangleFaces; i2++) {
    			if (anIntArray1640 != null && face_alpha != null)
    				if (anIntArray1640[i2] == 65535 //Most triangles
    				//|| anIntArray1640[i2] == 0  //Black Triangles 633 Models
    				|| anIntArray1640[i2] == 16705 //Nezzy Green Triangles//GWD White Triangles
    				)
    Now you removed the old black triangles fix.

    Adding the method
    Still in model.java add this method:
    Code:
    public void filterTriangles() {
    		for (int triangleId = 0; triangleId < numberOfTriangleFaces; triangleId++) {
    			int l = face_a[triangleId];
    			int k1 = face_b[triangleId];
    			int j2_ = face_c[triangleId];
    			boolean b = true;
    			label2: for (int triId = 0; triId < numberOfTriangleFaces; triId++) {
    				if (triId == triangleId)
    					continue label2;
    				if (face_a[triId] == l) {
    					b = false;
    					break label2;
    				}
    				if (face_b[triId] == k1) {
    					b = false;
    					break label2;
    				}
    				if (face_c[triId] == j2_) {
    					b = false;
    					break label2;
    				}
    			}
    			if (b) {
    				if(face_render_type != null)
    				//	face_render_type[triangleId] = -1;
    				face_alpha[triangleId] = 255;
    
    			}
    		}
    	}
    If you get errors, then you need to rename some things:
    Code:
    anIntArray1631	=	face_a
    anIntArray1632	=	face_b
    anIntArray1633	=	face_c
    anIntArray1637	=	face_render_type
    anIntArray1639	=	face_alpha
    anInt1630		=	numberOfTriangleFaces
    Implementing the method
    You need to implement filterTriangles().
    You do this by adding it to the part where it reads the models.
    Look for: "read525Model".
    You will find this method:
    Code:
    public void read525Model(byte abyte0[], int modelID) {
    		Stream nc1 = new Stream(abyte0);
    		Stream nc2 = new Stream(abyte0);
    		Stream nc3 = new Stream(abyte0);
    		Stream nc4 = new Stream(abyte0);
    		Stream nc5 = new Stream(abyte0);
    		Stream nc6 = new Stream(abyte0);
    		Stream nc7 = new Stream(abyte0);
    		nc1.currentOffset = abyte0.length - 23;
    		int numVertices = nc1.readUnsignedWord();
    		int numTriangles = nc1.readUnsignedWord();
    		int numTexTriangles = nc1.readUnsignedByte();
    		Class21 ModelDef_1 = aClass21Array1661[modelID] = new Class21();
    		ModelDef_1.aByteArray368 = abyte0;
    		ModelDef_1.anInt369 = numVertices;
    		ModelDef_1.anInt370 = numTriangles;
    		ModelDef_1.anInt371 = numTexTriangles;
    		int l1 = nc1.readUnsignedByte();
    		boolean bool = (0x1 & l1 ^ 0xffffffff) == -2;
    		int i2 = nc1.readUnsignedByte();
    		int j2 = nc1.readUnsignedByte();
    		int k2 = nc1.readUnsignedByte();
    		int l2 = nc1.readUnsignedByte();
    		int i3 = nc1.readUnsignedByte();
    		int j3 = nc1.readUnsignedWord();
    		int k3 = nc1.readUnsignedWord();
    		int l3 = nc1.readUnsignedWord();
    		int i4 = nc1.readUnsignedWord();
    		int j4 = nc1.readUnsignedWord();
    		int k4 = 0;
    		int l4 = 0;
    		int i5 = 0;
    		byte[] x = null;
    		byte[] O = null;
    		byte[] J = null;
    		byte[] F = null;
    		byte[] cb = null;
    		byte[] gb = null;
    		byte[] lb = null;
    		int[] kb = null;
    		int[] y = null;
    		int[] N = null;
    		short[] D = null;
    		int[] triangleColours2 = new int[numTriangles];
    		if (numTexTriangles > 0) {
    			O = new byte[numTexTriangles];
    			nc1.currentOffset = 0;
    			for (int j5 = 0; j5 < numTexTriangles; j5++) {
    				byte byte0 = O[j5] = nc1.readSignedByte();
    				if (byte0 == 0)
    					k4++;
    				if (byte0 >= 1 && byte0 <= 3)
    					l4++;
    				if (byte0 == 2)
    					i5++;
    			}
    		}
    		int k5 = numTexTriangles;
    		int l5 = k5;
    		k5 += numVertices;
    		int i6 = k5;
    		if (l1 == 1)
    			k5 += numTriangles;
    		int j6 = k5;
    		k5 += numTriangles;
    		int k6 = k5;
    		if (i2 == 255)
    			k5 += numTriangles;
    		int l6 = k5;
    		if (k2 == 1)
    			k5 += numTriangles;
    		int i7 = k5;
    		if (i3 == 1)
    			k5 += numVertices;
    		int j7 = k5;
    		if (j2 == 1)
    			k5 += numTriangles;
    		int k7 = k5;
    		k5 += i4;
    		int l7 = k5;
    		if (l2 == 1)
    			k5 += numTriangles * 2;
    		int i8 = k5;
    		k5 += j4;
    		int j8 = k5;
    		k5 += numTriangles * 2;
    		int k8 = k5;
    		k5 += j3;
    		int l8 = k5;
    		k5 += k3;
    		int i9 = k5;
    		k5 += l3;
    		int j9 = k5;
    		k5 += k4 * 6;
    		int k9 = k5;
    		k5 += l4 * 6;
    		int l9 = k5;
    		k5 += l4 * 6;
    		int i10 = k5;
    		k5 += l4;
    		int j10 = k5;
    		k5 += l4;
    		int k10 = k5;
    		k5 += l4 + i5 * 2;
    		int[] vertexX = new int[numVertices];
    		int[] vertexY = new int[numVertices];
    		int[] vertexZ = new int[numVertices];
    		int[] facePoint1 = new int[numTriangles];
    		int[] facePoint2 = new int[numTriangles];
    		int[] facePoint3 = new int[numTriangles];
    		anIntArray1655 = new int[numVertices];
    		face_render_type = new int[numTriangles];
    		anIntArray1638 = new int[numTriangles];
    		face_alpha = new int[numTriangles];
    		anIntArray1656 = new int[numTriangles];
    		if (i3 == 1)
    			anIntArray1655 = new int[numVertices];
    		if (bool)
    			face_render_type = new int[numTriangles];
    		if (i2 == 255)
    			anIntArray1638 = new int[numTriangles];
    		else {
    		}
    		if (j2 == 1)
    			face_alpha = new int[numTriangles];
    		if (k2 == 1)
    			anIntArray1656 = new int[numTriangles];
    		if (l2 == 1)
    			D = new short[numTriangles];
    		if (l2 == 1 && numTexTriangles > 0)
    			x = new byte[numTriangles];
    		triangleColours2 = new int[numTriangles];
    		int[] texTrianglesPoint1 = null;
    		int[] texTrianglesPoint2 = null;
    		int[] texTrianglesPoint3 = null;
    		if (numTexTriangles > 0) {
    			texTrianglesPoint1 = new int[numTexTriangles];
    			texTrianglesPoint2 = new int[numTexTriangles];
    			texTrianglesPoint3 = new int[numTexTriangles];
    			if (l4 > 0) {
    				kb = new int[l4];
    				N = new int[l4];
    				y = new int[l4];
    				gb = new byte[l4];
    				lb = new byte[l4];
    				F = new byte[l4];
    			}
    			if (i5 > 0) {
    				cb = new byte[i5];
    				J = new byte[i5];
    			}
    		}
    		nc1.currentOffset = l5;
    		nc2.currentOffset = k8;
    		nc3.currentOffset = l8;
    		nc4.currentOffset = i9;
    		nc5.currentOffset = i7;
    		int l10 = 0;
    		int i11 = 0;
    		int j11 = 0;
    		for (int k11 = 0; k11 < numVertices; k11++) {
    			int l11 = nc1.readUnsignedByte();
    			int j12 = 0;
    			if ((l11 & 1) != 0)
    				j12 = nc2.method421();
    			int l12 = 0;
    			if ((l11 & 2) != 0)
    				l12 = nc3.method421();
    			int j13 = 0;
    			if ((l11 & 4) != 0)
    				j13 = nc4.method421();
    			vertexX[k11] = l10 + j12;
    			vertexY[k11] = i11 + l12;
    			vertexZ[k11] = j11 + j13;
    			l10 = vertexX[k11];
    			i11 = vertexY[k11];
    			j11 = vertexZ[k11];
    			if (anIntArray1655 != null)
    				anIntArray1655[k11] = nc5.readUnsignedByte();
    		}
    		nc1.currentOffset = j8;
    		nc2.currentOffset = i6;
    		nc3.currentOffset = k6;
    		nc4.currentOffset = j7;
    		nc5.currentOffset = l6;
    		nc6.currentOffset = l7;
    		nc7.currentOffset = i8;
    		for (int i12 = 0; i12 < numTriangles; i12++) {
    			triangleColours2[i12] = nc1.readUnsignedWord();
    			if (l1 == 1) {
    				face_render_type[i12] = nc2.readSignedByte();
    				if (face_render_type[i12] == 2)
    					triangleColours2[i12] = 65535;
    				face_render_type[i12] = 0;
    			}
    			if (i2 == 255) {
    				anIntArray1638[i12] = nc3.readSignedByte();
    			}
    			if (j2 == 1) {
    				face_alpha[i12] = nc4.readSignedByte();
    				if (face_alpha[i12] < 0)
    					face_alpha[i12] = (256 + face_alpha[i12]);
    			}
    			if (k2 == 1)
    				anIntArray1656[i12] = nc5.readUnsignedByte();
    			if (l2 == 1)
    				D[i12] = (short) (nc6.readUnsignedWord() - 1);
    			if (x != null)
    				if (D[i12] != -1)
    					x[i12] = (byte) (nc7.readUnsignedByte() - 1);
    				else
    					x[i12] = -1;
    		}
    		nc1.currentOffset = k7;
    		nc2.currentOffset = j6;
    		int k12 = 0;
    		int i13 = 0;
    		int k13 = 0;
    		int l13 = 0;
    		for (int i14 = 0; i14 < numTriangles; i14++) {
    			int j14 = nc2.readUnsignedByte();
    			if (j14 == 1) {
    				k12 = nc1.method421() + l13;
    				l13 = k12;
    				i13 = nc1.method421() + l13;
    				l13 = i13;
    				k13 = nc1.method421() + l13;
    				l13 = k13;
    				facePoint1[i14] = k12;
    				facePoint2[i14] = i13;
    				facePoint3[i14] = k13;
    			}
    			if (j14 == 2) {
    				i13 = k13;
    				k13 = nc1.method421() + l13;
    				l13 = k13;
    				facePoint1[i14] = k12;
    				facePoint2[i14] = i13;
    				facePoint3[i14] = k13;
    			}
    			if (j14 == 3) {
    				k12 = k13;
    				k13 = nc1.method421() + l13;
    				l13 = k13;
    				facePoint1[i14] = k12;
    				facePoint2[i14] = i13;
    				facePoint3[i14] = k13;
    			}
    			if (j14 == 4) {
    				int l14 = k12;
    				k12 = i13;
    				i13 = l14;
    				k13 = nc1.method421() + l13;
    				l13 = k13;
    				facePoint1[i14] = k12;
    				facePoint2[i14] = i13;
    				facePoint3[i14] = k13;
    			}
    		}
    		nc1.currentOffset = j9;
    		nc2.currentOffset = k9;
    		nc3.currentOffset = l9;
    		nc4.currentOffset = i10;
    		nc5.currentOffset = j10;
    		nc6.currentOffset = k10;
    		for (int k14 = 0; k14 < numTexTriangles; k14++) {
    			int i15 = O[k14] & 0xff;
    			if (i15 == 0) {
    				texTrianglesPoint1[k14] = nc1.readUnsignedWord();
    				texTrianglesPoint2[k14] = nc1.readUnsignedWord();
    				texTrianglesPoint3[k14] = nc1.readUnsignedWord();
    			}
    			if (i15 == 1) {
    				texTrianglesPoint1[k14] = nc2.readUnsignedWord();
    				texTrianglesPoint2[k14] = nc2.readUnsignedWord();
    				texTrianglesPoint3[k14] = nc2.readUnsignedWord();
    				kb[k14] = nc3.readUnsignedWord();
    				N[k14] = nc3.readUnsignedWord();
    				y[k14] = nc3.readUnsignedWord();
    				gb[k14] = nc4.readSignedByte();
    				lb[k14] = nc5.readSignedByte();
    				F[k14] = nc6.readSignedByte();
    			}
    			if (i15 == 2) {
    				texTrianglesPoint1[k14] = nc2.readUnsignedWord();
    				texTrianglesPoint2[k14] = nc2.readUnsignedWord();
    				texTrianglesPoint3[k14] = nc2.readUnsignedWord();
    				kb[k14] = nc3.readUnsignedWord();
    				N[k14] = nc3.readUnsignedWord();
    				y[k14] = nc3.readUnsignedWord();
    				gb[k14] = nc4.readSignedByte();
    				lb[k14] = nc5.readSignedByte();
    				F[k14] = nc6.readSignedByte();
    				cb[k14] = nc6.readSignedByte();
    				J[k14] = nc6.readSignedByte();
    			}
    			if (i15 == 3) {
    				texTrianglesPoint1[k14] = nc2.readUnsignedWord();
    				texTrianglesPoint2[k14] = nc2.readUnsignedWord();
    				texTrianglesPoint3[k14] = nc2.readUnsignedWord();
    				kb[k14] = nc3.readUnsignedWord();
    				N[k14] = nc3.readUnsignedWord();
    				y[k14] = nc3.readUnsignedWord();
    				gb[k14] = nc4.readSignedByte();
    				lb[k14] = nc5.readSignedByte();
    				F[k14] = nc6.readSignedByte();
    			}
    		}
    		if (i2 != 255) {
    			for (int i12 = 0; i12 < numTriangles; i12++)
    				anIntArray1638[i12] = i2;
    		}
    		anIntArray1640 = triangleColours2;
    		anInt1626 = numVertices;
    		numberOfTriangleFaces = numTriangles;
    		anIntArray1627 = vertexX;
    		anIntArray1628 = vertexY;
    		anIntArray1629 = vertexZ;
    		face_a = facePoint1;
    		face_b = facePoint2;
    		face_c = facePoint3;
    	}
    Add "filterTriangles();" at the end of the method.
    It will become this:
    Code:
    public void read525Model(byte abyte0[], int modelID) {
    		Stream nc1 = new Stream(abyte0);
    		Stream nc2 = new Stream(abyte0);
    		Stream nc3 = new Stream(abyte0);
    		Stream nc4 = new Stream(abyte0);
    		Stream nc5 = new Stream(abyte0);
    		Stream nc6 = new Stream(abyte0);
    		Stream nc7 = new Stream(abyte0);
    		nc1.currentOffset = abyte0.length - 23;
    		int numVertices = nc1.readUnsignedWord();
    		int numTriangles = nc1.readUnsignedWord();
    		int numTexTriangles = nc1.readUnsignedByte();
    		Class21 ModelDef_1 = aClass21Array1661[modelID] = new Class21();
    		ModelDef_1.aByteArray368 = abyte0;
    		ModelDef_1.anInt369 = numVertices;
    		ModelDef_1.anInt370 = numTriangles;
    		ModelDef_1.anInt371 = numTexTriangles;
    		int l1 = nc1.readUnsignedByte();
    		boolean bool = (0x1 & l1 ^ 0xffffffff) == -2;
    		int i2 = nc1.readUnsignedByte();
    		int j2 = nc1.readUnsignedByte();
    		int k2 = nc1.readUnsignedByte();
    		int l2 = nc1.readUnsignedByte();
    		int i3 = nc1.readUnsignedByte();
    		int j3 = nc1.readUnsignedWord();
    		int k3 = nc1.readUnsignedWord();
    		int l3 = nc1.readUnsignedWord();
    		int i4 = nc1.readUnsignedWord();
    		int j4 = nc1.readUnsignedWord();
    		int k4 = 0;
    		int l4 = 0;
    		int i5 = 0;
    		byte[] x = null;
    		byte[] O = null;
    		byte[] J = null;
    		byte[] F = null;
    		byte[] cb = null;
    		byte[] gb = null;
    		byte[] lb = null;
    		int[] kb = null;
    		int[] y = null;
    		int[] N = null;
    		short[] D = null;
    		int[] triangleColours2 = new int[numTriangles];
    		if (numTexTriangles > 0) {
    			O = new byte[numTexTriangles];
    			nc1.currentOffset = 0;
    			for (int j5 = 0; j5 < numTexTriangles; j5++) {
    				byte byte0 = O[j5] = nc1.readSignedByte();
    				if (byte0 == 0)
    					k4++;
    				if (byte0 >= 1 && byte0 <= 3)
    					l4++;
    				if (byte0 == 2)
    					i5++;
    			}
    		}
    		int k5 = numTexTriangles;
    		int l5 = k5;
    		k5 += numVertices;
    		int i6 = k5;
    		if (l1 == 1)
    			k5 += numTriangles;
    		int j6 = k5;
    		k5 += numTriangles;
    		int k6 = k5;
    		if (i2 == 255)
    			k5 += numTriangles;
    		int l6 = k5;
    		if (k2 == 1)
    			k5 += numTriangles;
    		int i7 = k5;
    		if (i3 == 1)
    			k5 += numVertices;
    		int j7 = k5;
    		if (j2 == 1)
    			k5 += numTriangles;
    		int k7 = k5;
    		k5 += i4;
    		int l7 = k5;
    		if (l2 == 1)
    			k5 += numTriangles * 2;
    		int i8 = k5;
    		k5 += j4;
    		int j8 = k5;
    		k5 += numTriangles * 2;
    		int k8 = k5;
    		k5 += j3;
    		int l8 = k5;
    		k5 += k3;
    		int i9 = k5;
    		k5 += l3;
    		int j9 = k5;
    		k5 += k4 * 6;
    		int k9 = k5;
    		k5 += l4 * 6;
    		int l9 = k5;
    		k5 += l4 * 6;
    		int i10 = k5;
    		k5 += l4;
    		int j10 = k5;
    		k5 += l4;
    		int k10 = k5;
    		k5 += l4 + i5 * 2;
    		int[] vertexX = new int[numVertices];
    		int[] vertexY = new int[numVertices];
    		int[] vertexZ = new int[numVertices];
    		int[] facePoint1 = new int[numTriangles];
    		int[] facePoint2 = new int[numTriangles];
    		int[] facePoint3 = new int[numTriangles];
    		anIntArray1655 = new int[numVertices];
    		face_render_type = new int[numTriangles];
    		anIntArray1638 = new int[numTriangles];
    		face_alpha = new int[numTriangles];
    		anIntArray1656 = new int[numTriangles];
    		if (i3 == 1)
    			anIntArray1655 = new int[numVertices];
    		if (bool)
    			face_render_type = new int[numTriangles];
    		if (i2 == 255)
    			anIntArray1638 = new int[numTriangles];
    		else {
    		}
    		if (j2 == 1)
    			face_alpha = new int[numTriangles];
    		if (k2 == 1)
    			anIntArray1656 = new int[numTriangles];
    		if (l2 == 1)
    			D = new short[numTriangles];
    		if (l2 == 1 && numTexTriangles > 0)
    			x = new byte[numTriangles];
    		triangleColours2 = new int[numTriangles];
    		int[] texTrianglesPoint1 = null;
    		int[] texTrianglesPoint2 = null;
    		int[] texTrianglesPoint3 = null;
    		if (numTexTriangles > 0) {
    			texTrianglesPoint1 = new int[numTexTriangles];
    			texTrianglesPoint2 = new int[numTexTriangles];
    			texTrianglesPoint3 = new int[numTexTriangles];
    			if (l4 > 0) {
    				kb = new int[l4];
    				N = new int[l4];
    				y = new int[l4];
    				gb = new byte[l4];
    				lb = new byte[l4];
    				F = new byte[l4];
    			}
    			if (i5 > 0) {
    				cb = new byte[i5];
    				J = new byte[i5];
    			}
    		}
    		nc1.currentOffset = l5;
    		nc2.currentOffset = k8;
    		nc3.currentOffset = l8;
    		nc4.currentOffset = i9;
    		nc5.currentOffset = i7;
    		int l10 = 0;
    		int i11 = 0;
    		int j11 = 0;
    		for (int k11 = 0; k11 < numVertices; k11++) {
    			int l11 = nc1.readUnsignedByte();
    			int j12 = 0;
    			if ((l11 & 1) != 0)
    				j12 = nc2.method421();
    			int l12 = 0;
    			if ((l11 & 2) != 0)
    				l12 = nc3.method421();
    			int j13 = 0;
    			if ((l11 & 4) != 0)
    				j13 = nc4.method421();
    			vertexX[k11] = l10 + j12;
    			vertexY[k11] = i11 + l12;
    			vertexZ[k11] = j11 + j13;
    			l10 = vertexX[k11];
    			i11 = vertexY[k11];
    			j11 = vertexZ[k11];
    			if (anIntArray1655 != null)
    				anIntArray1655[k11] = nc5.readUnsignedByte();
    		}
    		nc1.currentOffset = j8;
    		nc2.currentOffset = i6;
    		nc3.currentOffset = k6;
    		nc4.currentOffset = j7;
    		nc5.currentOffset = l6;
    		nc6.currentOffset = l7;
    		nc7.currentOffset = i8;
    		for (int i12 = 0; i12 < numTriangles; i12++) {
    			triangleColours2[i12] = nc1.readUnsignedWord();
    			if (l1 == 1) {
    				face_render_type[i12] = nc2.readSignedByte();
    				if (face_render_type[i12] == 2)
    					triangleColours2[i12] = 65535;
    				face_render_type[i12] = 0;
    			}
    			if (i2 == 255) {
    				anIntArray1638[i12] = nc3.readSignedByte();
    			}
    			if (j2 == 1) {
    				face_alpha[i12] = nc4.readSignedByte();
    				if (face_alpha[i12] < 0)
    					face_alpha[i12] = (256 + face_alpha[i12]);
    			}
    			if (k2 == 1)
    				anIntArray1656[i12] = nc5.readUnsignedByte();
    			if (l2 == 1)
    				D[i12] = (short) (nc6.readUnsignedWord() - 1);
    			if (x != null)
    				if (D[i12] != -1)
    					x[i12] = (byte) (nc7.readUnsignedByte() - 1);
    				else
    					x[i12] = -1;
    		}
    		nc1.currentOffset = k7;
    		nc2.currentOffset = j6;
    		int k12 = 0;
    		int i13 = 0;
    		int k13 = 0;
    		int l13 = 0;
    		for (int i14 = 0; i14 < numTriangles; i14++) {
    			int j14 = nc2.readUnsignedByte();
    			if (j14 == 1) {
    				k12 = nc1.method421() + l13;
    				l13 = k12;
    				i13 = nc1.method421() + l13;
    				l13 = i13;
    				k13 = nc1.method421() + l13;
    				l13 = k13;
    				facePoint1[i14] = k12;
    				facePoint2[i14] = i13;
    				facePoint3[i14] = k13;
    			}
    			if (j14 == 2) {
    				i13 = k13;
    				k13 = nc1.method421() + l13;
    				l13 = k13;
    				facePoint1[i14] = k12;
    				facePoint2[i14] = i13;
    				facePoint3[i14] = k13;
    			}
    			if (j14 == 3) {
    				k12 = k13;
    				k13 = nc1.method421() + l13;
    				l13 = k13;
    				facePoint1[i14] = k12;
    				facePoint2[i14] = i13;
    				facePoint3[i14] = k13;
    			}
    			if (j14 == 4) {
    				int l14 = k12;
    				k12 = i13;
    				i13 = l14;
    				k13 = nc1.method421() + l13;
    				l13 = k13;
    				facePoint1[i14] = k12;
    				facePoint2[i14] = i13;
    				facePoint3[i14] = k13;
    			}
    		}
    		nc1.currentOffset = j9;
    		nc2.currentOffset = k9;
    		nc3.currentOffset = l9;
    		nc4.currentOffset = i10;
    		nc5.currentOffset = j10;
    		nc6.currentOffset = k10;
    		for (int k14 = 0; k14 < numTexTriangles; k14++) {
    			int i15 = O[k14] & 0xff;
    			if (i15 == 0) {
    				texTrianglesPoint1[k14] = nc1.readUnsignedWord();
    				texTrianglesPoint2[k14] = nc1.readUnsignedWord();
    				texTrianglesPoint3[k14] = nc1.readUnsignedWord();
    			}
    			if (i15 == 1) {
    				texTrianglesPoint1[k14] = nc2.readUnsignedWord();
    				texTrianglesPoint2[k14] = nc2.readUnsignedWord();
    				texTrianglesPoint3[k14] = nc2.readUnsignedWord();
    				kb[k14] = nc3.readUnsignedWord();
    				N[k14] = nc3.readUnsignedWord();
    				y[k14] = nc3.readUnsignedWord();
    				gb[k14] = nc4.readSignedByte();
    				lb[k14] = nc5.readSignedByte();
    				F[k14] = nc6.readSignedByte();
    			}
    			if (i15 == 2) {
    				texTrianglesPoint1[k14] = nc2.readUnsignedWord();
    				texTrianglesPoint2[k14] = nc2.readUnsignedWord();
    				texTrianglesPoint3[k14] = nc2.readUnsignedWord();
    				kb[k14] = nc3.readUnsignedWord();
    				N[k14] = nc3.readUnsignedWord();
    				y[k14] = nc3.readUnsignedWord();
    				gb[k14] = nc4.readSignedByte();
    				lb[k14] = nc5.readSignedByte();
    				F[k14] = nc6.readSignedByte();
    				cb[k14] = nc6.readSignedByte();
    				J[k14] = nc6.readSignedByte();
    			}
    			if (i15 == 3) {
    				texTrianglesPoint1[k14] = nc2.readUnsignedWord();
    				texTrianglesPoint2[k14] = nc2.readUnsignedWord();
    				texTrianglesPoint3[k14] = nc2.readUnsignedWord();
    				kb[k14] = nc3.readUnsignedWord();
    				N[k14] = nc3.readUnsignedWord();
    				y[k14] = nc3.readUnsignedWord();
    				gb[k14] = nc4.readSignedByte();
    				lb[k14] = nc5.readSignedByte();
    				F[k14] = nc6.readSignedByte();
    			}
    		}
    		if (i2 != 255) {
    			for (int i12 = 0; i12 < numTriangles; i12++)
    				anIntArray1638[i12] = i2;
    		}
    		anIntArray1640 = triangleColours2;
    		anInt1626 = numVertices;
    		numberOfTriangleFaces = numTriangles;
    		anIntArray1627 = vertexX;
    		anIntArray1628 = vertexY;
    		anIntArray1629 = vertexZ;
    		face_a = facePoint1;
    		face_b = facePoint2;
    		face_c = facePoint3;
    		filterTriangles();
    	}
    If you have 622 models loaded, then you also need to add "filterTriangles();" to read622models method
    it works the same as read525Model.

    Finished
    Now when you get ingame, all black triangles should be gone.

    Credits:
    95% - The one who created the filtertriangles method.
    5% - To me for creating this tutorial.
    Attached image
    Reply With Quote  
     

  2. Thankful users:


  3. #2  
    Banned

    Join Date
    Apr 2013
    Posts
    1,456
    Thanks given
    341
    Thanks received
    148
    Rep Power
    0
    Code:
    	public void filterTriangles() {
    		for (int triangleId = 0; triangleId < anInt1630; triangleId++) {
    			int l = anIntArray1631[triangleId];
    			int k1 = anIntArray1632[triangleId];
    			int j2_ = anIntArray1633[triangleId];
    			boolean b = true;
    			label2: for (int triId = 0; triId < anInt1630; triId++) {
    				if (triId == triangleId)
    					continue label2;
    				if (anIntArray1631[triId] == l) {
    					b = false;
    					break label2;
    				}
    				if (anIntArray1632[triId] == k1) {
    					b = false;
    					break label2;
    				}
    				if (anIntArray1633[triId] == j2_) {
    					b = false;
    					break label2;
    				}
    			}
    			if (b) {
    				if(anIntArray1637 != null)
    					anIntArray1639[triangleId] = 255;
    
    
    			}
    		}
    	}
    Reply With Quote  
     

  4. Thankful user:


  5. #3  
    Registered Member
    Join Date
    Nov 2009
    Posts
    3,052
    Thanks given
    112
    Thanks received
    838
    Rep Power
    740
    U took this from my allantois release xD I remember writing the filtering method.

    Though its not 100% perfect.
    Reply With Quote  
     

  6. #4  
    Registered Member Rememberm3's Avatar
    Join Date
    Aug 2013
    Posts
    1,716
    Thanks given
    56
    Thanks received
    108
    Rep Power
    129
    Quote Originally Posted by Christian_ View Post
    Code:
    	public void filterTriangles() {
    		for (int triangleId = 0; triangleId < anInt1630; triangleId++) {
    			int l = anIntArray1631[triangleId];
    			int k1 = anIntArray1632[triangleId];
    			int j2_ = anIntArray1633[triangleId];
    			boolean b = true;
    			label2: for (int triId = 0; triId < anInt1630; triId++) {
    				if (triId == triangleId)
    					continue label2;
    				if (anIntArray1631[triId] == l) {
    					b = false;
    					break label2;
    				}
    				if (anIntArray1632[triId] == k1) {
    					b = false;
    					break label2;
    				}
    				if (anIntArray1633[triId] == j2_) {
    					b = false;
    					break label2;
    				}
    			}
    			if (b) {
    				if(anIntArray1637 != null)
    					anIntArray1639[triangleId] = 255;
    
    
    			}
    		}
    	}
    You can use that too.

    Quote Originally Posted by owner blade View Post
    U took this from my allantois release xD I remember writing the filtering method.

    Though its not 100% perfect.
    I don't know where the guy I took it from took it from, but I need to give you the credits?
    Attached image
    Reply With Quote  
     

  7. #5  
    Registered Member
    Join Date
    Nov 2009
    Posts
    3,052
    Thanks given
    112
    Thanks received
    838
    Rep Power
    740
    Quote Originally Posted by xX4m4zingXx View Post
    You can use that too.



    I don't know where the guy I took it from took it from, but I need to give you the credits?
    I don't really mind, but the thing about this method is, all triangles that aren't connected to anything will be made transparant.
    Which will make some gfx's fked up. Just a few though so its not all that bad.
    Reply With Quote  
     

  8. #6  
    Banned

    Join Date
    Apr 2013
    Posts
    1,456
    Thanks given
    341
    Thanks received
    148
    Rep Power
    0
    Quote Originally Posted by owner blade View Post
    I don't really mind, but the thing about this method is, all triangles that aren't connected to anything will be made transparant.
    Which will make some gfx's fked up. Just a few though so its not all that bad.
    i notice this never found a fix
    Reply With Quote  
     

  9. #7  
    Registered Member Rememberm3's Avatar
    Join Date
    Aug 2013
    Posts
    1,716
    Thanks given
    56
    Thanks received
    108
    Rep Power
    129
    Quote Originally Posted by owner blade View Post
    I don't really mind, but the thing about this method is, all triangles that aren't connected to anything will be made transparant.
    Which will make some gfx's fked up. Just a few though so its not all that bad.
    Okay,but this fixes much things, which I am happy about.

    Quote Originally Posted by Christian_ View Post
    i notice this never found a fix
    I think it's hard to find a fix for this.
    Attached image
    Reply With Quote  
     

  10. #8  
    Software Developer

    Tyrant's Avatar
    Join Date
    Jul 2013
    Age
    24
    Posts
    1,562
    Thanks given
    678
    Thanks received
    423
    Rep Power
    1060
    This fixes nothing.
    Reply With Quote  
     

  11. #9  
    Banned

    Join Date
    Apr 2013
    Posts
    1,456
    Thanks given
    341
    Thanks received
    148
    Rep Power
    0
    Quote Originally Posted by Dharokist View Post
    This fixes nothing.
    yes it does it fixed transparent black trinales ect
    Reply With Quote  
     

  12. #10  
    Software Developer

    Tyrant's Avatar
    Join Date
    Jul 2013
    Age
    24
    Posts
    1,562
    Thanks given
    678
    Thanks received
    423
    Rep Power
    1060
    Quote Originally Posted by Christian_ View Post
    yes it does it fixed transparent black trinales ect
    Nope I tried, I still got the same black triangles I had without this fix implemented.
    Reply With Quote  
     

Page 1 of 3 123 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 33
    Last Post: 03-15-2013, 09:18 PM
  2. Replies: 50
    Last Post: 06-03-2012, 03:45 PM
  3. Black triangle fix
    By Dust R I P in forum Help
    Replies: 7
    Last Post: 05-20-2012, 12:45 AM
  4. [PI] Black triangles fix
    By Xseil in forum Help
    Replies: 6
    Last Post: 10-28-2011, 03:22 AM
  5. Replies: 0
    Last Post: 01-24-2010, 01:30 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •