1 Reply Latest reply on Oct 18, 2009 8:07 AM by _lw

    Change texture for an object in a w3d scene



      I am trying to swap out the texture on a set of objects in my 3d scene with a cast member.

      So I have a bunch of images as cast members and then in my script I do like this:


      <inside a loop with "i" as the iterator>

      lModel = p3Dmember.model[i]

      tex = p3Dmember.newTexture(i, #fromCastMember, member("Wood"))

      lModel.shader.texture = tex


      All this results in is that the previous texture vanishes from the model and is replaced with a solid gray color. I only seem to have this problem with my w3d scene. Because if i create a box manually in Director and map the texture onto that then it works without any problems.

      Can't really find any information as to why I am having so much trouble with this.


      The models I am trying to re-texture are just simple boxes made in 3d studio max and exported to w3d.


      Any replies would be much appreciated.

        • 1. Re: Change texture for an object in a w3d scene
          _lw Level 1

          First of all, you have to check the texturelayer you want to change. Referring to "mymodel.shader.textur" is the same as "mymodel.shader.texturelist[1]".


          If you open the objectinspector ( window -> obejctinspector ) and drag the 3d member from the cast into it (best idea is to undock it, so you have it as a single window) you can browse through the 3D file and also see what is going on when you change shaders and textures.