7 Replies Latest reply on Oct 23, 2006 9:13 AM by duckets

    Texture problem

    magnus_andersson Level 1
      Hi!

      I'm having a strange problem with a texture in Shockwave 3d. It's a shadowplane, a PNG image with alpha channel, that shows a shadow that fades out. It works fine, until I move it a distance from the camera, then it disappears.

      Any ideas about why?

      Im running on Windows, using an ATI X800XT video-card. It seems to appear in the same way on other similar computers, but I havn't tested on MAC yet.

        • 1. Re: Texture problem
          duckets Level 1
          It could be a z buffer resolution issue, if your plane is positioned very near to another surface (i.e. the ground). You could try increasing your camera's "hither" property, which will make the near clipping distance further from the camera, therefore increasing the depth buffer resolution at further distances.

          For this reason, it's always a good idea to increase your camera's 'hither' property to as large a value as is visually tolerable.

          hope this helps!

          - Ben

          • 2. Texture problem
            magnus_andersson Level 1
            Unfortunately it didn't help. I've also tested to move the plane further from the ground, without result.
            Any other ideas? Any reason to belive that it has to do with the alphachannel? If the renderformat changes or something (I'm not doing it manually)

            Thanks anyway!
            • 3. Re: Texture problem
              magnus_andersson Level 1
              A short movie showing the problem can be viewed here:

              www.ravenproduktion.se/a9/bug.mov
              • 4. Re: Texture problem
                Necromanthus Level 2
                1) be sure the pivot is centered for that shadowplane model.
                2) if you have other alpha channel materials inside of that 3D world, detach the correspondent mesh parts and center the pivot for each one.
                3) if the above (1) and (2) are OK, try:

                member("W3D_name").texture("shadowplane_name").renderFormat = #rgba8888
                member("W3D_name").texture("shadowplane_name").quality = #lowFiltered

                cheers
                • 5. Re: Texture problem
                  magnus_andersson Level 1
                  The pivot is centered, and I have tried those last steps to.
                  • 6. Re: Texture problem
                    Necromanthus Level 2
                    quote:

                    Originally posted by: magnus_andersson
                    The pivot is centered, and I have tried those last steps to.


                    4) be sure all the vertices of that floor have the same height.
                    5) be sure the distance between the floor and the shadowplane is at least ONE unit (using the default 3D world scale)
                    6) replace that alpha channel texture with a NON transparent one (BMP or JPG) and see if disappears again.
                    If false, go back to step (2) and check out VERY CAREFULLY all the materials (shaders) and maps (textures)

                    p.s.
                    Study the priestess (the lower part) and/or the camp entrance from RtCW Reloaded to see a "working example"
                    • 7. Re: Texture problem
                      duckets Level 1
                      (originally posted in the doug forum, posting here for the archives too)

                      Necro is right - I think this might be the z-sorting with transparent shaders problem. Any object that has a shader with any kind of transparency is depth sorted against other models by its boundingsphere centre alone rather than proper depth buffer sorting. It is probably the case that the point where the shadow dissapears is the point where the shadow's centre becomes further from the camera than the floor model's centre.

                      However, for the problem you show to be occuring, your floor model's texture (or shader) must *also* have some kind of alpha channel too, since the problem only shows up between models with transparency. If your floor model shader or texture intentionally has some transparency, then you'll need to remove this for the depth sorting to work properly.

                      If not, then your floor shader or texture may have accidentally been saved with some alpha information present. If you created your scene in a 3d modelling app, check that your floor texture image doesn't have alpha information. If you're using image file types such as PNG for your textures in your 3d app, your 3d app may be exporting the texture with alpha information **even if the alpha channel is completely opaque!**. If this is the case, try re-saving your floor texture image in a format which doesn't support alpha channels (such as BMP), then re-import it to your 3d app, then re-export the scene as w3d.

                      Here's a quick demo I just made which demonstrates the problem:
                      http://robotduck.com/models/?file=alphatest&t=71&a=-719&d=1501&r=0

                      The purple diamonds are 50% opaque. Both are raised a small amount above the coloured strips. The red strip has a solid shader with no transparency, but the green strip is 95% opaque. The diamond above the red strip sorts properly and stays above the strip, but the diamond above the green strip appears to be 'behind' it, whenever the centre of the diamond is further from the camera than the centre of the strip. This is because the green strip and the diamond are both transparent to some degree.

                      Hope this helps solve your problem,

                      - Ben