Mailing List
Home
Forum Home
Softimage
Carrara
trueSpace
Dir3d-l
Maya - a powerful 3D animation and visual effects software
Macromedia Flash Development
Subjects
Cameras
scaleDown command
black out solved
Aircraft Tutorial
Mathematical XYZ ?
Its done This vs That
Its done first week
recommendations for screen video captures?
3DExplorer "Oddity "
New Director
ProTeam renewals
Fuel 's new websites (X post)
Blue peter create a make toy
targeting groups question
XPost: Shockwave 3D game ( sort of )
RES: RES: RES: Fish Modeling
Emitting particles from object intersection
Fuel 's new websites (X post)
Texturing
Big Break Contest Videos
New Plugins
Models and Texture on my updated site
Error Installing Patch tS6 6
Plasma?
Looking for Inspiration
Weird EMail Q
It 's done first week ?
Cherry not cranberry
New game
Camera Animation Problem
Particle plugins?
 
Brute force lightmaps question

Brute force lightmaps question

2004-01-27       - By Anton-Pieter van Grootel

 Back
Reply:     1     2  

Hi,

I have problems converting the textureCoordinateList for lightmaps. I use
this brute force methods, but still there are some weird looking faces. Am I
doing something wrong, or could there be a problem with the Max setup?

Thanks,

Anton Pieter

global glTetxureCoords

on convertUV tScene,ShadowMember
 NumOfModels = ShadowMember.model.count
 glTetxureCoords = []
 tScene.resetworld()
 ShadowMember.resetworld()
 repeat with m = 1 to NumOfModels
   SourceModel = ShadowMember.model[m]
   SourceModelName = SourceModel.name
   SourceModel.addmodifier(#meshdeform)
   DestinationModel = tScene.model(SourceModelName)
   DestinationModel.addmodifier(#meshdeform)
   
   --    lTxtCoord = []
   lTxtCoord = DestinationModel.meshdeform.mesh[1].textureCoordinateList
   
   DestinationModelNumOfFaces =
DestinationModel.meshdeform.mesh[1].face.count
   repeat with i = 1 to DestinationModelNumOfFaces
     SourceModelNumOfFaces = DestinationModel.meshdeform.mesh[1].face.count
     if DestinationModelNumOfFaces < SourceModelNumOfFaces then
       alert("DestinationModelNumOfFaces < SourceModelNumOfFaces")
       abort
     end if
     DestinationModelFace = DestinationModel.meshdeform.mesh[1].face[i]
     DC1 =
DestinationModel.meshdeform.mesh[1].vertexList[DestinationModelFace[1]]
     DC2 =
DestinationModel.meshdeform.mesh[1].vertexList[DestinationModelFace[2]]
     DC3 =
DestinationModel.meshdeform.mesh[1].vertexList[DestinationModelFace[3]]
     repeat with n = 1 to SourceModelNumOfFaces
       SourceModelFace = SourceModel.meshdeform.mesh[1].face[n]
       SC1 = SourceModel.meshdeform.mesh[1].vertexList[SourceModelFace[1]]
       SC2 = SourceModel.meshdeform.mesh[1].vertexList[SourceModelFace[2]]
       SC3 = SourceModel.meshdeform.mesh[1].vertexList[SourceModelFace[3]]
       if (DC1 = SC1 OR DC1 = SC2 OR DC1 = SC3) AND (DC2 = SC1 OR DC2 = SC2
OR DC2 = SC3) AND (DC3 = SC1 OR DC3 = SC2 OR DC3 = SC3) then
         
         if DC1 = SC1 then lTxtCoord[DestinationModelFace[1]] =
SourceModel.meshdeform.mesh[1].textureCoordinateList[SourceModelFace[1]]
         if DC1 = SC2 then lTxtCoord[DestinationModelFace[1]] =
SourceModel.meshdeform.mesh[1].textureCoordinateList[SourceModelFace[2]]
         if DC1 = SC3 then lTxtCoord[DestinationModelFace[1]] =
SourceModel.meshdeform.mesh[1].textureCoordinateList[SourceModelFace[3]]
         
         if DC2 = SC1 then lTxtCoord[DestinationModelFace[2]] =
SourceModel.meshdeform.mesh[1].textureCoordinateList[SourceModelFace[1]]
         if DC2 = SC2 then lTxtCoord[DestinationModelFace[2]] =
SourceModel.meshdeform.mesh[1].textureCoordinateList[SourceModelFace[2]]
         if DC2 = SC3 then lTxtCoord[DestinationModelFace[2]] =
SourceModel.meshdeform.mesh[1].textureCoordinateList[SourceModelFace[3]]
         
         if DC3 = SC1 then lTxtCoord[DestinationModelFace[3]] =
SourceModel.meshdeform.mesh[1].textureCoordinateList[SourceModelFace[1]]
         if DC3 = SC2 then lTxtCoord[DestinationModelFace[3]] =
SourceModel.meshdeform.mesh[1].textureCoordinateList[SourceModelFace[2]]
         if DC3 = SC3 then lTxtCoord[DestinationModelFace[3]] =
SourceModel.meshdeform.mesh[1].textureCoordinateList[SourceModelFace[3]]
         
       end if
     end repeat
   end repeat
   NM =
tScene.cloneModelFromCastMember("LightMap"&i,SourceModelName,ShadowMember)
   LightmapShader = NM.shader.textureList[1]
   tScene.deleteModel(NM.name)

glTetxureCoords.append([#pModelDestinationModel.name,#pTextureCoordinateslTx
tCoord,#pTextureLightmapShader.name])
   setLM(DestinationModel,lTxtCoord,LightmapShader)
 end repeat
 sendAllSprites(#showElement)
end

on setLM CurrModel,lTxtCoord,LightmapShader
 tShader = CurrModel.shader
 tShader.textureList[2] = LightmapShader
 tShader.textureList[2].quality = #high
 tShader.textureList[2].renderFormat = #rgba8880 --8
 
 tShader.textureModeList = #none

 tShader.textureRepeatList[2] = 0
 CurrModel.meshDeform.mesh[1].texturelayer.add()
 CurrModel.meshDeform.mesh[1].texturelayer[2].texturecoordinatelist =
lTxtCoord
end

__ ____ ____ ____ ____ ____ ____ ____ ____ ____
Dir3d-l mailing list
Dir3d-l@(protected)
http://nuttybar.drama.uga.edu/mailman/listinfo/dir3d-l