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?
 
custom Mesh texturing problems

custom Mesh texturing problems

2003-12-17       - By matse@(protected)

 Back
Hi all,

I'm trying to create a plane mesh and texture it at runtime using Lingo,
because
I need planes with a centered pivot point AND Heigh/Width that can be defined
(scale is used to maintain aspect ratio whatever the distance from the camera
is).

So I found a solution that seemed quite simple to me : create a #plane
primitive
with the desired height/width, add a #meshDeform modifier on it and the use its
data to create a new mesh (I found that meshes had their pivot point
centered).

Mesh creation works great, trouble arises when it comes to texturing it... I
don't know why but I can't manage to get the texture properly on the mesh,
while it works perfectly with the default plane. The texture I'd like to
display comes from a text cast member, I thought maybe the problem was with the
alpha layer, but I have the same problem when I try to texture the mesh with a
bitmap without alpha... it's weird : the shader takes the color of the bitmap
but it seems like it displays just one pixel of it :/
What I mean here is if I create a 32*32 bitmap, fill it with grey, then add
some
red pixels on it I'll see the full bitmap when textured an a primitive plane,
but only grey when put on a mesh plane...

I hope I make myself understandable, I'm quite lost on this one... :/

here's my test code for the plane primitive :
-- ---- ---- ---- ---- ---- ---- ---- ---- --
 tMember = member("scene")
 tMember.resetWorld()
 
 tResource = tMember.newModelResource("Billboard", #plane, #front)
 tResource.widthVertices  = 2
 tResource.lengthVertices = 2
 tResource.width          = 100
 tResource.length         = 100

 tModel = tMember.newModel("test", tResource)

 tModel.transform.rotation = vector(180,0,180)
 
 tTxt         = new(#text)
 tTxt.color   = rgb(255,0,0)
 tTxt.text    = "blablabla"
 tTxt.boxType = #fixed
 tTxt.width   = 128
 tTxt.height  = 128
 tTex         = tMember.newTexture("test", #fromCastMember, tTxt)

 tModel.shader.texture = tTex
-- ---- ---- ---- ---- ---- ---- ---- ---- --
This one works perfectly on my system

And here is the code with the created mesh :
-- ---- ---- ---- ---- ---- ---- ---- ---- --
tMember = member("scene")
 tMember.resetWorld()
 
 tResource = tMember.newModelResource("Billboard", #plane, #front)
 tResource.widthVertices  = 2
 tResource.lengthVertices = 2
 tResource.width          = 100
 tResource.length         = 100
 
 -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
 -- Create new Mesh from Resource in order to center Pivot point
 tModel = tMember.newModel("dummyTemp", tResource)
 tModel.addModifier(#meshDeform)
 
 tVertexList = tModel.meshDeform.mesh[1].vertexList
 vertexCount = tModel.meshDeform.mesh[1].vertexList.count
 faceCount   = tModel.meshDeform.mesh[1].face.count
 
 tFaceVertices = []
 repeat with i = 1 to faceCount
   tFaceVertices.add(tModel.meshDeform.mesh[1].face[i])
 end repeat
 
 -- destroy original Resource and Model
 tMember.deleteModel(tModel.name)
 tMember.deleteModelResource(tResource.name)
 
 tMeshResource = tMember.newMesh("Billboard", faceCount, vertexCount)
 tMeshResource.vertexList = tVertexList
 repeat with i = 1 to faceCount
   tMeshResource.face[i].vertices = tFaceVertices[i]
 end repeat
 tMeshResource.generateNormals(#smooth)
 tMeshResource.build()
 --/Create new Mesh from Resource in order to center Pivot point
 -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
 
 tModel = tMember.newModel("test", tMeshResource)
 
 tModel.transform.rotation = vector(180,0,180)
 
 tTxt = new(#text)
 tTxt.color = rgb(255,0,0)
 tTxt.text = "blablabla"
 tTxt.boxType = #fixed
 tTxt.width  = 128
 tTxt.height = 128
 tTex = tMember.newTexture("test", #fromCastMember, tTxt)

 tModel.shader.texture = tTex
-- ---- ---- ---- ---- ---- ---- ---- ---- --

I'm quite new to the whole meshDeform/mesh creation stuff, so I must be missing
something obvious... I have quite the same problem in a level builder
application I'm developping, where I allow the user to set the shader for each
face of the Ground model : it works, but no texture displayed - it's like I was
only setting the shader's color :/

Any help greatly appreciated ! I cand send a small test movie to anyone
interested.

Please forgive any bad english ;)

Matse
http://www.newtgames.com


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