Hide Triangle

Blitz3D Forums/Blitz3D Beginners Area/Hide Triangle

YellBellzDotCom(Posted 2007) [#1]
I know, I know, this is the 76th post Ive made on this subject...

I need to hide a triangle on a character mesh, period.
I am trying to find out what kinda of things you can do to a triangle. There is a nice pickedtriangle function, but what kind of things can I do with it once its picked?

Can I color a picked triangle?
Cain I hide a picked triangle?

Thanks for any help.


D4NM4N(Posted 2007) [#2]
You could color it with vertex color and hide it with vertex alpha, by effecting all 3 tri-verts. Only problem is, unless the mesh is un-welded you would get a fade out effect with ajacent verticies, which may/may not be what you want.


YellBellzDotCom(Posted 2007) [#3]
Thanks for the suggestion D4NM4N, thats about the conclusion I came up with also, after I colored a few triangles and noticied the 3 vertex color blending. Vertex Alpha wont work on my b3d animated models either.

Im going to make an attempt at using a mesh clone that I can unweld, alpha or delete the triangles as needed.

Thanks for the help


YellBellzDotCom(Posted 2007) [#4]
Ok, thanks to the Unweldmesh code by Stevie G, I can copy a mesh in which all the triangles are unwelded (I think, havent tested yet, hehehe).

The problem is, this code is copying the base mesh triangle by triangle, along with vertex color info but the new unwelded mesh is grey. So I guess my question would be, does a textured mesh contain the color info at the vertex level? Or are the vertex colors grey underneath the texture.

Function MESHunweld( Mesh )
	;by Stevie G
	Copy = CreateMesh()
	ns = CreateSurface( Copy )
	For su = 1 To CountSurfaces( Mesh )
		s = GetSurface( Mesh , su )
		For t = 0 To CountTriangles( s ) - 1
			v0 = TriangleVertex( s, t, 0 )
			v1 = TriangleVertex( s, t, 1 )
			v2 = TriangleVertex( s, t, 2 )
			Nv0 = AddVertex( ns , VertexX( s , v0 ) , VertexY( s, v0 ) , VertexZ( s, v0 ) )
			Nv1 = AddVertex( ns , VertexX( s , v1 ) , VertexY( s, v1 ) , VertexZ( s, v1 ) )
			Nv2 = AddVertex( ns , VertexX( s , v2 ) , VertexY( s, v2 ) , VertexZ( s, v2 ) )
			VertexColor ns, Nv0 , VertexRed( s, v0 ) , VertexGreen( s, v0 ) , VertexBlue( s, v0 )
			VertexColor ns, Nv1 , VertexRed( s, v1 ) , VertexGreen( s, v1 ) , VertexBlue( s, v1 )
			VertexColor ns, Nv2 , VertexRed( s, v2 ) , VertexGreen( s, v2 ) , VertexBlue( s, v2 )
			AddTriangle ns , Nv0 , Nv1 , Nv2
		Next
	Next
	FreeEntity Mesh
	Return Copy

End Function


Im thinking I understand this a little better, never had to think about texturing like this before. The vertex colors are a default color because the texture retains its own colors and it gets stretched over the mesh.

An unwelded mesh will lose the texture because the triangles are unwelded? So all UVW info is lost? Is it possible to texture an unwelded mesh?


YellBellzDotCom(Posted 2007) [#5]
Ok, I found some different Triangle functions in the code archives here

http://www.blitzbasic.co.nz/codearcs/codearcs.php?code=433

This allows me to unweld a textured mesh, alter the triangles and reweld it if needed.