Simple Alpha Problem?
Blitz3D Forums/Blitz3D Programming/Simple Alpha Problem?
| ||
This is probably simple but I am stumped -.- Using EntityAlpha on a mesh the mesh is either completely invisible at alpha 0.0 or completely visible at anything higher e.g. 0.1-1.0 I have tried the same command on a cube and the cube is alphad correctly. I have even tried Function alphamesh(mesh%,alpha#) EntityAlpha mesh%,alpha# If CountChildren(mesh%)>0 For child=1 To CountChildren (mesh%) alphamesh(GetChild(mesh%,child),alpha#) Next EndIf End Function to make sure I get any child meshes but it still doesn't work. I am sure I have missed something obvious , plz tell me what it is ^^ |
| ||
That should work. So how is your mesh different from the cube? Did you paintmesh the cube with a surface brush from your mesh and then paintentity it with the meshes entity brush? You need to compare like for like. In short you could being doing all sorts of wierd and wonderful things to your mesh, which you have not told us about :) |
| ||
Is it possible that your mesh is using vertex colours. The entityalpha > 0 has no affect on the mesh but 0 does hide it. If this is the case then you'll need to set the alpha of each vertex using the alpha flag of the vertexcolor command. Just a thought .. |
| ||
Or maybe the mesh has set the Masked texture flag set internally. is it a .B3D? (cause you cannot override B3D flags, need to replace the brush) |
| ||
Is the mesh multitextured? Used to be that multitextured meshes would only respect an alpha of 0 or 1 but I think Mark changed it to be dependent on the GFX card. A couple of us ran across this (kind of) problem trying to do semi-transparent lightmapped floors. |
| ||
Thanks for the info guys. I've just got back to this after a hard drive crash -.- I can get the mesh to alpha using Stevie G's suggestion...I guess the problem is I am using vertex colours...didn't realise this would break entity alpha =/ Function alphamesh(mesh%,alpha#) For surf=1 To CountSurfaces(mesh%) thissurf=GetSurface (mesh%,surf) For v=0 To CountVertices(thissurf)-1 red#=VertexRed#(thissurf,v) green#=VertexGreen#(thissurf,v) blue#=VertexBlue#(thissurf,v) VertexColor (thissurf,v,red#,green#,blue#,alpha#) Next Next If CountChildren(mesh%)>0 For child=1 To CountChildren (mesh%) alphamesh(GetChild(mesh%,child),alpha#) Next EndIf End Function Cheers. |