Grass Model with unwanted artefacts (milkshape).

Community Forums/Developer Stations/Grass Model with unwanted artefacts (milkshape).

Rick Nasher(Posted 2014) [#1]
Hi guys,

Please forgive my ignorance but I am stuck at the following:

I've created a grass/bush model in Milkshape, basically made out of a quad that I copied rotated and stuck together, then copied again and rorated 90 degrees, forming a star shape, stuck a grass PNG texture to it, copied and rotated 45 degrees and then looks ok to me:

But, when put into Blitz I see unwanted edges of the model appearing, above the model:

Hope anybody can enlighten me.

AdamStrange(Posted 2014) [#2]
which program did you use to create the png file?

I used to use photoshop cs4 and found that all exported png files suffered from edge issues

This was resolved by upgrading to photoshop cs6

RemiD(Posted 2014) [#3]
I would try 2 things :

1->When you load your texture, add the flag 16+32

2->Change the UV coords of the top vertices so that there are still some black/transparent pixels above them

xlsior(Posted 2014) [#4]
It's a know issue -- Basically it boils down to some image editors not storing alpha information properly at the edges of an image, allowing RGB info to bleed through.

See this thread for more info on the problem:

And here's a link to Yan's defringe executable, which can fix the bad images and fix their edges for you:

Alternatively, if you don't trust the EXE, here's some posted source code that's based on the defringe tool mentioned:

Rick Nasher(Posted 2014) [#5]
Many thanks guys, I'll check it out. Was ready to rip out my hairs. :-)

D4NM4N(Posted 2014) [#6]
check the texture for artifacts. Use the "offset"filter in PS to rotate the image on x&y then clean the edges.
and failing that - try and Clamp the uvs. its been a while but i think it is "TextureFilter(tex, 1 + 2 + 8 + 16 + 32)"

Rick Nasher(Posted 2014) [#7]
Ok, tried all that was suggested and finally found the cause/solution:

In DeleD's UV editor, I moved the texture on each surface a little bit upwards so that a blank line appeared at the bottom(root so to speak): Artefacts gone!
Apparently it was trying to wrap the texture incorrectly, causing the bottomline of the texture to repeat itself at the top.

Tried with different textures and all with the same results, so appears the texture wasn't the cause, but just faulty automatic mapping.
Many thanks for the suggestions.

Gabriel(Posted 2014) [#8]
Apparently it was trying to wrap the texture incorrectly, causing the bottomline of the texture to repeat itself at the top.

That's not really "incorrectly". UV coordinates are supposed to wrap/tile by default. If they didn't, tiling textures would not work properly. If you want them to NOT wrap, you need to set the texture flags to Clamp for both U and V, as suggested above.

Padding the UVs as you have is a perfectly serviceable solution but bear in mind that if you don't clamp the UVs, you may still get the effect. You see, with mipmaps enabled, you'll get different amounts of bleed depending on the difference in distance from the camera. So while what you've done now may work with the camera close, you may find that the effect comes back if you move the camera away a bit more or rotate to an oblique angle. Then you would need to go back and make the border at the top bigger. So clamping is definitely something you should do as well.

Rick Nasher(Posted 2014) [#9]
Thanks for your comments Gabriel. I'll need to check out how to do that. It really seems to make sense the way you explain it.