Texture mapping and cloned models.

Ask a Question related to Macromedia Director 3D, Design and Development.

  1. #1

    Default Texture mapping and cloned models.

    Hi,

    I have been working in a project that, basically, it's a virtual scenario, it
    have a lot of chairs. i import the chair model with the diffuse texture from
    one cast member, and the chair model with the lightmap from another cast
    member.

    I apply the common method to map the light texture in the model:

    pChairShadow.addModifier(#meshDeform)
    pChair.addModifier(#meshDeform)
    pChair.meshDeform.mesh[1].textureLayer.add()
    pChair.meshDeform.mesh[1].texturelayer[2].textureCoordinateList=\
    pChairShadow.meshDeform.mesh[1].texturelayer[1].textureCoordinateList
    pChair.shader.diffuseLightMap=pSillaShadow.shader. texture
    pChair.shader.textureModeList[2]=#none

    when i execute this commands in a keydown script it works fine, but when i
    execute inmediately after clone the models, the lighmap mess up.

    Why did i do?, i created a timeOut object, so i wait 100 ms after call this
    commands, it works fine.

    When I call the commands in the first enterFrame, it works fine,

    If I insert a breakpoint (BKP) and then press F5, messed up.
    If I insert a BKP and hot F8 (command by command), messed up.
    If I insert a BKP and hot F8 (command by command) viewing the 3d cast member
    with the 3d viewer, fine.

    I Think it is a time problem. I discover that it must be a delay between
    cloning the model and apply the mesh modifier or assign the
    texturecoordinatelist, more specific, i believe that there must be a visual
    update of the cast member, Ive solved it by creating a timeout, but i like
    clean solutions, not this.


    EHHH, yes i preload all the members and its state is 4, at the moment of
    cloning.
    MMMM,

    ensamblador Guest

  2. Similar Questions and Discussions

    1. Cloned models
      Hi. I have a W3D scene where I created a lot of plants. They are all clones of the same model, so I figured it shouldn't make the file much...
    2. Mapping texture onto globe
      Hi! I have a globe model with each of the continents having a different shader - this works fine to set the diffuse color of each continent....
    3. 5 models with the same texture, how!!??
      i am a strager novice in director 3d and i have 5 models in my 3d world that need to have the same texture on them. i know how to apply on a model a...
    4. makeFixedRigidBody and cloned models
      My apologies for the repost. I thought I was creating a new thread but I accidentally responded to a very old one instead. Again, my apologies,...
    5. Havok and cloned models
      I saw that a few other people have had this problem, but didn't find any solutions that worked for me. I have a simple model, imported as a ..w3d....
  3. #2

    Default Re: Texture mapping and cloned models.

    ensamblador wrote:
    > Hi,
    >
    > I have been working in a project that, basically, it's a virtual scenario, it
    > have a lot of chairs. i import the chair model with the diffuse texture from
    > one cast member, and the chair model with the lightmap from another cast
    > member.
    >
    > I apply the common method to map the light texture in the model:
    >
    > pChairShadow.addModifier(#meshDeform)
    > pChair.addModifier(#meshDeform)
    >
    >
    > when i execute this commands in a keydown script it works fine, but when i
    > execute inmediately after clone the models, the lighmap mess up.
    Hi. What I did in this cases is to wait to the next frame. Kinda
    timeOut() solution but more clean. Here´s some not tested code just for
    getting the idea:

    on enterFrame me
    case pState of:
    #addMeshMod:
    pChairShadow.addModifier(#meshDeform)
    pChair.addModifier(#meshDeform)
    pState = #addLayer
    #addLayer:
    pChair.meshDeform.mesh[1].textureLayer.add()
    pChair.meshDeform.mesh[1].texturelayer[2].textureCoordinateList=\
    pChairShadow.meshDeform.mesh[1].texturelayer[1].textureCoordinateList
    pChair.shader.diffuseLightMap=pSillaShadow.shader. texture
    pChair.shader.textureModeList[2]=#none
    end case


    Try if a solution like that works for you. Hey, and be grateful that
    simply using chairShadow´s coordinates as they are on the chair works
    for you and you´re not needing to brute-force-copy the
    textureCoordinates of the shadowMesh by comparing vertex position and
    storing the UV data in a text member, which is slower.

    Regards,
    --
    Agustín María Rodríguez

    [url]www.onwine.com.ar[/url] > Macromedia Director demos & code
    Agustín María Rodríguez Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139