3 Replies Latest reply on Aug 8, 2007 6:12 AM by tedalde2

    Using text as a texture issues

      Recently I was working on using text (members) as textures in my 3d member (users can enter their name ingame). It was working, but horribly slow and unpredictable. I didn't find any good solutions or tips on this, so I ended up coding a simple copypixels solution and this worked much faster and better than I expected.
      However, what is the correct way of setting up text(members) as textures without all the problems?
        • 1. Re: Using text as a texture issues
          tedalde2 Level 2
          Yes, taking the image of a text member is probably best. Here's an example script I clipped from my projects (took out some pieces so check it if you try to use it). The handler formats the passed string and returns a custom "nametag" texture. You'd format the text size, etc to however it best fit what you're doing:
          • 2. Re: Using text as a texture issues
            PpHammer Level 1
            Hi tedalde2,

            Thanks for your reply. Your script is surely more advanced then mine currently ;)
            The current solution i have now works perfectly. So I like to wait with implementing an other solution. However I definetely will keep this for future reference! I get it from your reply you don't have any good experience with getting a texture from a textmember directly either. How did you test and try this initially?
            Anybody else with their experiences?
            • 3. Using text as a texture issues
              tedalde2 Level 2
              That's the only way to get text members into textures; simply take the image of the text member and create a texture with it. Perhaps #fromCastMember works with text members, but I haven't tried it. My handler is just longer due to some formatting and creating the "nametag" matte. Remember that all textures should be powers of 2, so text cast members that are used to directly create textures should have a length and width that are powers of 2. Otherwise your text will get interpolated and look jagged.

              I'd test the bitmap/image results by putting my results into test bitmap members: member("someBmpMem").image = vImgNametag.duplicate() etc... To test applying the texture to a shaderlist and model, I'd just look at the model and use 3DPI to adjust the texture. 3DPI is a must-have for creating advanced 3D scenes.