1

I'm drawing a simple square in stage3D, but the quality of the numbers and the edges in the picture is not as high as it should be:

Square

Here's the example with the (little) source code, I've put the most in one file. http://users.telenet.be/fusion/SquareQuality/
http://users.telenet.be/fusion/SquareQuality/srcview/

I'm using mipmapping, in my shader I use "<2d, miplinear, repeat>", the texture is 256x256 jpg (bigger than on the image), also tried a png, tried "mipnearest" and tried without mipmapping. Anti-alias 4, but 10 or more doesn't help at all...

Any ideas? Greetings, Thomas

3 Answers3

2

Are you using antialiasing for backBuffer?

// Listen for when the Context3D is created for it
stage3D.addEventListener(Event.CONTEXT3D_CREATE, onContext3DCreated);

function onContext3DCreated(ev:Event): void
{
    var context3D:Context3D = stage3D.context3D;

    // Setup the back buffer for the context
    context3D.configureBackBuffer(stage.stageWidth, stage.stageHeight,
                                  0, // no antialiasing (values 2-16 for antialiasing)
                                  true);
}
DigitalD
  • 586
  • 3
  • 12
1

I think that the size of your resource texture is too high. The GPU renders your scene pixel by pixel in the fragment shader. When it renders a pixel of your texture, the fragment shader gets a varying that represents the texture UV. The GPU simply takes the color of the pixel on that UV coordinate of your texture.

Now, when your texture size is too high, you will lose information because two neighboring pixels on the screen will correspond with non-neighboring pixels on the texture resource. For example: if you draw a texture 10 times smaller than the resource, you will get something like this (were each character corresponds with a pixel, in one dimension):

Texture:  0123456789ABCDEFGHIJKLM
Screen:   0AK
Martijn Courteaux
  • 67,591
  • 47
  • 198
  • 287
1

I'VE FOUND IT!!!

I went to the Starling forum and found an answer from Daniel from Starling:

"If you're using TRILINEAR, you're already using the best quality available. One additional thing you could try is to set the "antialiasing" value of Starling to a high value, e.g. 16, and see if that helps."

So I came across this article that said trilinear is only used when you put the argument "linear" in your fragment shader, in my example program:

"tex ft0, v0, fs0 <2d, linear, miplinear, repeat>".

Greetings,
Thomas