Hello!

I'm doing my little Java3D project for a while now. My general idea is to
construct a big virtual world. From a height map I construct an
TriangleStripArray. Last few days I spent on problem of multitexturing with
several TextureUnitStates. From a height information at specific point I
want to apply different texture to my landscape. The thing works pretty
satisfactory, but I have big problems on transitions from one texture to
another. The triangle that connects textures becomes "blurry", being texture
clamped or warped. I think that main problem here is that triangles share
points, so how could I cut one texture and start another while both textures
share same point?

my filling texture coordinates code goes like this (I am working with one
big texture contains 4 basic textures (sand,grass,mud,stone):

    private void fillTextureCoordinates() {

        for (int i = 0; i < MagicWoods.MAP_RESOLUTION - 1; i += 1) {
            for (int j = 0; j < MagicWoods.MAP_RESOLUTION; j += 2) {
                if ((getHeightAt((float) i, (float) j) > 0f) &&
(getHeightAt((float) i, (float) j) < 10f)) {
                    texcoords1[i * MagicWoods.MAP_RESOLUTION * 2 + j + j] =
new TexCoord2f(0.5f, 0.5f);
                    texcoords1[i * MagicWoods.MAP_RESOLUTION * 2 + j + j +
1] = new TexCoord2f(1f, 0.5f);
                    texcoords1[i * MagicWoods.MAP_RESOLUTION * 2 + j + j +
2] = new TexCoord2f(0.5f, 1f);
                    texcoords1[i * MagicWoods.MAP_RESOLUTION * 2 + j + j +
3] = new TexCoord2f(1f, 1f);
                }

                if ((getHeightAt((float) i, (float) j) > 10f) &&
(getHeightAt((float) i, (float) j) < 15f)) {
                    texcoords1[i * MagicWoods.MAP_RESOLUTION * 2 + j + j] =
new TexCoord2f(0.5f, 0f);
                    texcoords1[i * MagicWoods.MAP_RESOLUTION * 2 + j + j +
1] = new TexCoord2f(1f, 0f);
                    texcoords1[i * MagicWoods.MAP_RESOLUTION * 2 + j + j +
2] = new TexCoord2f(0.5f, 0.5f);
                    texcoords1[i * MagicWoods.MAP_RESOLUTION * 2 + j + j +
3] = new TexCoord2f(1f, 0.5f);
                }
                if ((getHeightAt((float) i, (float) j) > 15f) &&
(getHeightAt((float) i, (float) j) < 22f)) {
                    texcoords1[i * MagicWoods.MAP_RESOLUTION * 2 + j + j] =
new TexCoord2f(0f, 0.5f);
                    texcoords1[i * MagicWoods.MAP_RESOLUTION * 2 + j + j +
1] = new TexCoord2f(0.5f, 0.5f);
                    texcoords1[i * MagicWoods.MAP_RESOLUTION * 2 + j + j +
2] = new TexCoord2f(0f, 1f);
                    texcoords1[i * MagicWoods.MAP_RESOLUTION * 2 + j + j +
3] = new TexCoord2f(0.5f, 1f);
                }
                if ((getHeightAt((float) i, (float) j) > 22f) &&
(getHeightAt((float) i, (float) j) < 100f)) {
                    texcoords1[i * MagicWoods.MAP_RESOLUTION * 2 + j + j] =
new TexCoord2f(0f, 0f);
                    texcoords1[i * MagicWoods.MAP_RESOLUTION * 2 + j + j +
1] = new TexCoord2f(0.5f, 0f);
                    texcoords1[i * MagicWoods.MAP_RESOLUTION * 2 + j + j +
2] = new TexCoord2f(0f, 0.5f);
                    texcoords1[i * MagicWoods.MAP_RESOLUTION * 2 + j + j +
3] = new TexCoord2f(0.5f, 0.5f);
                }


            }

        }


    }

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to