   Milkshape 3D model - PS2 Vector Unit Help
  Anyone used this much? im using a model created in Milkshape for a PS2 project. I know this isnt really the forum to use but i cant get onto the official milkshape one and dont know where else to go. Basically im making a representation of the solar system with a point light where the sun is. So the light is in the centre of the sun model. In order for the sun to be illuminated so, i need to reverese the normals of the model. But i dont know how. I have the model as a text file and i tried changing the normals signs, but thgat didnt work. So, anyone know how to do this?[Edited by - discodowney on April 15, 2010 7:34:53 AM]
  Well, basically inverting a vector (which the normal is) means multiplying it by -1, i.e. the inverse of vector (-2,5,3) would be (2,-5,-3).Other than that, we need some more information. What doesn't work exactly?Can you post some code of the relevant sections (please remember to use the [source] tags).   ;  Okay, so ive tried changing the normals of the model to opposite signs when they are read in. So nMesh will always be 0 here.the for loop under //the normals reads in the normals. Then the next one inverts them. It is working, kinda. the normals are being inverted. I can tell cos the planets that are rotating the sun are being lit up back to front, i.e. the parts that should be light are dark and the parts that should be dark are lit.But the sun still isnt illuminated. Any ideas?m_pMeshes[nMesh].pNormals = new Vector3[m_pMeshes[nMesh].nNormals];// The normalsfor(int nNormal = 0; nNormal < m_pMeshes[nMesh].nNormals; nNormal++){GetNextLOC(strLine);// x, y, zsscanf(strLine, "%f %f %f",&m_pMeshes[nMesh].pNormals[nNormal].x,&m_pMeshes[nMesh].pNormals[nNormal].y,&m_pMeshes[nMesh].pNormals[nNormal].z);}for(int nNormal = 0; nNormal < m_pMeshes[nMesh].nNormals; nNormal++){m_pMeshes[nMesh].pNormals[nNormal].x *= -1;m_pMeshes[nMesh].pNormals[nNormal].y *= -1;m_pMeshes[nMesh].pNormals[nNormal].z *= -1;};  Could be wrong on this, but I think most renderers will skip lighting backfacing polygons.  What effect does enabling/disabling backface culling have?   ;  There is no back face culling. Anyone know anything about vector unit coding? i think my problem might be there.   ;  If there is no backface culling and your renderer isn't lighting backfacing polygons, the unlit polygons on the near side of the sun will block the lit polygons behind them.  Have you tried putting your camera inside the sun model?   ;  To render object as light, don't you have to set its emissive material property to render the object as the light?   ;  Its strange, if i translate the model by even as little as 0.01 plus or mius then half the model gets lit, Plus lights the right half and minus the left half. Ill be in college later and ill stick up the VU code because something has to be going wrong there i justs cant, for the life of me, see what it is.   ;  Heres the vector unit code. The modelthat isnt illuminating is at the origin so if anyone spots anything they think could be causing the problem thatd be great:lqNorm, NormStart(Counter); Load the normalMatrixMultiplyVertex Norm, fLightTrans, Norm; Transform the normal into world space (important that norm.w is 0)MatrixMultiplyVertex Vert, fLightTrans, Vert; Transform the vertex into world spacesub.xyzToLight, PtLightPos, Vert; Get the vector from the vert to the lightVectorNormalizeXYZ ToLight, ToLight; Normalise this vector (and it becomes the light direction, just as in directional lighting)VectorDotProduct  fIntensity, ToLight, Norm; Get the intensitylq.xyzfAmbient, LightCols+3(vi00);madd.xyzfIntensity, fAmbient, vf00[w]max.xfIntensity, fIntensity, vf00; Clamp to > 0mini.xfIntensity, fIntensity, vf00[w]; Clamp to < 1lqfLightCol, PtLightCol(vi00); Load the light colourmul.xyzfLightCol, fLightCol, fIntensity[x]; Scale the colour by the intensityloi128mulfLightCol, fLightCol, i; Scale the values from 0-1 to the range 0-128    ftoi0   iLightCol, fLightCol; Convert to intssq   iLightCol, NormStartOut(Counter); And write to the output buffer