Blyss Sarania





Imaginary Goddess

Threads: 400

Joined: Sep 2013

Reputation:

Location: 私の夢の中 Posts: 21.707Threads: 400Joined: Sep 2013Reputation: 472 Location: 私の夢の中 #1





First, let's explain aliasing and why people are so keen on removing it with anti-aliasing. Let's start with some math



In the real world, signals are often "continuous." If you take two points A and B and A is very close to B then F(A) is very close to F(B). But a screen is not continuous. If you take two pixels side by side, one can be white while the other is black.



Typical example of some continuous/discrete signals:





It is very easy and accurate to transform a continuous signal into a non continuous signal. You just need to sample it, i.e. take a subset of values. It is often used in computer science to reduce the quantity of information compared to the original signal. Otherwise it simply requires to much power to process it.



The thing is that later, when you render it, you need to do the reverse transformation. Human senses expect continuous video and sound. The transformation above is very easy, but this time things are much more complicated. If you need a value exactly at a sample point - it's fine, you have it But what happens if you need a value that is between two samples? It doesn't exist, so you need to create it. This is called aliasing - any random value is an alias of the original value.



The purpose of anti aliasing is to predict a value between samples that is as close as possible to what the original value would have been by using the samples that you do have to estimate what is missing.



For example, let's imagine that sample 1 is white and sample 2 is black. What will the value of a pixel between sample1 and sample 2 be? It could be white or black (Nearest filtering.) It could be a mixture of both, so gray (Linear filtering.) Note that nothing prevents the true value of that pixel from being red, blue, yellow or anything, but it is impossible to predict that based on the data we have.





Let's get back to GS emulation now.



Primitives sent to the GPU/GS are continuous. For example, you ask the GPU to draw a triangle, not to draw N pixels. However due to limited resources, your GPU will only compute the colors of N pixels on your screen/framebuffer. The rendering will be exactly the same as if you had asked the GPU to draw N pixels in a triangle shape. Nobody will see the "holes." However, if you increase the frequency of the sampling (i.e. use a bigger resolution) you will see those holes. If your screen had infinite resolution you would be able to see that the rendering is various points shaped like a triangle - not a real triangle.



The PS2 does something similar. It sends various rectangles that fill the screen, but they have holes. Due to aliasing you never see them at native resolution. Upscaling however increases the frequency of sampling because it is "emulating" a higher resolution output. As with the previous example, the holes become visible. In the case of Namco games they manifest as black vertical lines.



In other words, when upscaling, the emulation of the GS is more accurate than the real GS that the PS2 has. Unfortunately, humans don't like their images full of pointless black lines. So to fix it, we added another hack. The hack will detect rectangle primitives that are too small and then extend them half a pixel to fill the hole. It does the job well and it doesn't impact speed much.





Now let's explain the other new hack. Primitives have only color information - this is enough for a small surface but not efficient to draw a big surface. In order to reduce computational load they just map a texture on to the primitive. You just need to provide the texture coordinates. Instead of a lengthy explanation, let's just use an example.











As you can see in the picture, you will sample an invalid value at 2x resolution. Generally games use a texture atlas so you inadvertently sample from the next texture. This is quite noticeable on font textures. The idea of this hack is to shift and round the texture size to better fit the intended behavior of the game. There are various corner cases so it is difficult to have something both fast and accurate. Many games are better but they're not perfect.







The hack also disables extra linear filtering. Globally the upscaling issue is caused by a texture that is too small. This was likely done on purpose to reduce memory usage (PS2 video memory is only 4MB, compared to multiple gigabytes that we have today). Linear filtering allows interpolating a color based on the texels around it. But it requires that those texels exist So textures need to be one texel bigger than they are for linear interpolation. We don't have that possibility, unfortunately.



In conclusion, native resolution works because of aliasing issues. The holes and errors in the image are below the sampling rate of the PS2's traditional output and therefore you never see them. Once you enable some form of anti aliasing (linear filtering/upscaling/MSAA/**AA), they become visible as the sample rate is high enough to expose them. This explanation was originally written by Gregory First, let's explain aliasing and why people are so keen on removing it with anti-aliasing. Let's start with some mathIn the real world, signals are often "continuous." If you take two points A and B and A is very close to B then F(A) is very close to F(B). But a screen is not continuous. If you take two pixels side by side, one can be white while the other is black.Typical example of some continuous/discrete signals:It is very easy and accurate to transform a continuous signal into a non continuous signal. You just need to sample it, i.e. take a subset of values. It is often used in computer science to reduce the quantity of information compared to the original signal. Otherwise it simply requires to much power to process it.The thing is that later, when you render it, you need to do the reverse transformation. Human senses expect continuous video and sound. The transformation above is very easy, but this time things are much more complicated. If you need a value exactly at a sample point - it's fine, you have itBut what happens if you need a value that is between two samples? It doesn't exist, so you need to create it. This is called aliasing - any random value is an alias of the original value.The purpose of anti aliasing is to predict a value between samples that is as close as possible to what the original value would have been by using the samples that you do have to estimate what is missing.For example, let's imagine that sample 1 is white and sample 2 is black. What will the value of a pixel between sample1 and sample 2 be? It could be white or black (Nearest filtering.) It could be a mixture of both, so gray (Linear filtering.) Note that nothing prevents the true value of that pixel from being red, blue, yellow or anything, but it is impossible to predict that based on the data we have.Let's get back to GS emulation now.Primitives sent to the GPU/GS are continuous. For example, you ask the GPU to draw a triangle, not to draw N pixels. However due to limited resources, your GPU will only compute the colors of N pixels on your screen/framebuffer. The rendering will be exactly the same as if you had asked the GPU to draw N pixels in a triangle shape. Nobody will see the "holes." However, if you increase the frequency of the sampling (i.e. use a bigger resolution) you will see those holes. If your screen had infinite resolution you would be able to see that the rendering is various points shaped like a triangle - not a real triangle.The PS2 does something similar. It sends various rectangles that fill the screen, but they have holes. Due to aliasing you never see them at native resolution. Upscaling however increases the frequency of sampling because it is "emulating" a higher resolution output. As with the previous example, the holes become visible. In the case of Namco games they manifest as black vertical lines.In other words, when upscaling, the emulation of the GS is more accurate than the real GS that the PS2 has. Unfortunately, humans don't like their images full of pointless black lines. So to fix it, we added another hack. The hack will detect rectangle primitives that are too small and then extend them half a pixel to fill the hole. It does the job well and it doesn't impact speed much.Now let's explain the other new hack. Primitives have only color information - this is enough for a small surface but not efficient to draw a big surface. In order to reduce computational load they just map a texture on to the primitive. You just need to provide the texture coordinates. Instead of a lengthy explanation, let's just use an example.As you can see in the picture, you will sample an invalid value at 2x resolution. Generally games use a texture atlas so you inadvertently sample from the next texture. This is quite noticeable on font textures. The idea of this hack is to shift and round the texture size to better fit the intended behavior of the game. There are various corner cases so it is difficult to have something both fast and accurate. Many games are better but they're not perfect.The hack also disables extra linear filtering. Globally the upscaling issue is caused by a texture that is too small. This was likely done on purpose to reduce memory usage (PS2 video memory is only 4MB, compared to multiple gigabytes that we have today). Linear filtering allows interpolating a color based on the texels around it. But it requires that those texels existSo textures need to be one texel bigger than they are for linear interpolation. We don't have that possibility, unfortunately.In conclusion, native resolution works because of aliasing issues. The holes and errors in the image are below the sampling rate of the PS2's traditional output and therefore you never see them. Once you enable some form of anti aliasing (linear filtering/upscaling/MSAA/**AA), they become visible as the sample rate is high enough to expose them.

Intel i7 3770k @ 4.2Ghz | R9 290 | 16GB RAM | 480GB(240GB+240GB RAID0) SSD | 3 TB HDD | 1 TB HDD | 500GB HDD

Server: AMD FX 6300 @ 4.4Ghz | GTX 670 | 16GB RAM | 240GB SSD | 320GB HDD

PCSX2 General Troubleshooting FAQ Gaming:Server: Website Find Reply

Sponsored links



lyor

Newbie



Threads: 2

Joined: Oct 2014

Reputation: Posts: 9Threads: 2Joined: Oct 2014Reputation: 0 #2

none of your pics are shown to me...



Care to reupload it again to I think there is might be a problem with the image service.none of your pics are shown to me...Care to reupload it again to http://imgur.com Find Reply refraction





PCSX2 Coder

Threads: 398

Joined: Aug 2005

Reputation:

Location: England Posts: 19.227Threads: 398Joined: Aug 2005Reputation: 494 Location: England #3 the images are hosted on here and I can see them fine. Like our Facebook Page and visit our Facebook Group Website Find Reply Blyss Sarania





Imaginary Goddess

Threads: 400

Joined: Sep 2013

Reputation:

Location: 私の夢の中 Posts: 21.707Threads: 400Joined: Sep 2013Reputation: 472 Location: 私の夢の中 #4 Yeah they are PCSX2 forum attachments and they work fine for me too.

Intel i7 3770k @ 4.2Ghz | R9 290 | 16GB RAM | 480GB(240GB+240GB RAID0) SSD | 3 TB HDD | 1 TB HDD | 500GB HDD

Server: AMD FX 6300 @ 4.4Ghz | GTX 670 | 16GB RAM | 240GB SSD | 320GB HDD

PCSX2 General Troubleshooting FAQ Gaming:Server: Website Find Reply K.F





Posting Freak

Threads: 6

Joined: Apr 2013

Reputation: Posts: 1.666Threads: 6Joined: Apr 2013Reputation: 66 #5 I can't. When I try to open the image it shows me the "You do not have permission to access this page." page.



Nice to see more blog entries though. Find Reply Blyss Sarania





Imaginary Goddess

Threads: 400

Joined: Sep 2013

Reputation:

Location: 私の夢の中 Posts: 21.707Threads: 400Joined: Sep 2013Reputation: 472 Location: 私の夢の中 #6 Oh right. The attachments are in the bug squad forum so non members and non admins/mods can't see it.



Edit: Should be fixed.

Intel i7 3770k @ 4.2Ghz | R9 290 | 16GB RAM | 480GB(240GB+240GB RAID0) SSD | 3 TB HDD | 1 TB HDD | 500GB HDD

Server: AMD FX 6300 @ 4.4Ghz | GTX 670 | 16GB RAM | 240GB SSD | 320GB HDD

PCSX2 General Troubleshooting FAQ Gaming:Server: Website Find Reply refraction





PCSX2 Coder

Threads: 398

Joined: Aug 2005

Reputation:

Location: England Posts: 19.227Threads: 398Joined: Aug 2005Reputation: 494 Location: England #7 That would explain why i could see it Like our Facebook Page and visit our Facebook Group Website Find Reply K.F





Posting Freak

Threads: 6

Joined: Apr 2013

Reputation: Posts: 1.666Threads: 6Joined: Apr 2013Reputation: 66 #8 (06-04-2015, 01:27 AM) Blyss Sarania Wrote: Edit: Should be fixed.

Nope



Edit: Never mind NopeEdit: Never mind Find Reply ssakash





Bositman's Slave

Threads: 105

Joined: May 2014

Reputation:

Location: 127.0.0.1 Posts: 8.601Threads: 105Joined: May 2014Reputation: 168 Location: 127.0.0.1 #9 (06-04-2015, 12:19 AM) Blyss Sarania Wrote: As you can see in the picture, you will sample an invalid value at 2x resolution. Generally games use a texture atlas so you inadvertently sample from the next texture. This is quite noticeable on font textures. The idea of this hack is to shift and round the texture size to better fit the intended behavior of the game. There are various corner cases so it is difficult to have something both fast and accurate. Many games are better but they're not perfect.

why no mention of the Forumla which is needed to compute the texture coordinate of pixels, 0.5*(1-alpha) + alpha * 16.5 ?



that would make it even clear for the people on why it fetches Invalid data on the first place and cause some issues. also, you should mention that Invalid data is the cause of the upscaling issues in the article. why no mention of the Forumla which is needed to compute the texture coordinate of pixels, 0.5*(1-alpha) + alpha * 16.5 ?that would make it even clear for the people on why it fetches Invalid data on the first place and cause some issues. also, you should mention that Invalid data is the cause of the upscaling issues in the article. We're supposed to be working as a team, if we aren't helping and suggesting things to each other, we aren't working as a team.

- Refraction Website Find Reply lyor

Newbie



Threads: 2

Joined: Oct 2014

Reputation: Posts: 9Threads: 2Joined: Oct 2014Reputation: 0 #10 Strange, still can't see them Find Reply