Hosting by Solid Eight Studios ,PhotoTangler Collage Maker |
Texturing As In Unreal Question submitted by Li Sheng Yong (10 July 2000) |
Return to The Archives |
I had done my software rendering. But I got a problem that is I got blocky
sometimes because I have to magnify the texels. I know a bilinear sample
will be ok but I am afraid it is expensive. I heard that Unreal utilized the
*dither* tech to make it smoother. I watched Unreal carefully and seems it
is true. There is less blocky.
So I tried to do it too but failed. I used noisy filter. I utilize a random
table to add/sub a small random color value to each pixel on the screen. It
seems a little smoothy. That's true. But still blocky. Seems the *noisy*
filter can't help the blocky problem. The smooth is only for adjacent
frames, not for the blocky on the screen. So how can they do? Thanks in
advance. This question was originally submitted some time ago, to the Fountain Of Knowledge on flipCode. |
||
You're in for a real treat today! A few weeks ago, I asked Tim Sweeney (the
man behind the Unreal technology) if he would be willing to share a bit of
his time to answer specific Unreal-related questions that come my way. Being
a great sport, he agreed. Knowing how busy my schedule keeps me, I have to assume his schedule is worse, so I promised not to swamp him with questions. This is my polite way of letting you know that if I get an outpouring of Unreal questions, I'll just hold some back. Tim writes: Unreal's software renderer uses an ordered "texture coordinate space" dither, which (at high enough resolution) looks almost like bilinear filtering. The idea is simple: at each pixel, offset your texture u,v coordinates based on an ordered dither kernel (two 2x2 lookup tables, one each for U and V, indexed by the screen location (X&1),(Y&1), prior to texel lookup. My dither kernel looks something like this:
Paul writes: To clarify this, consider a texel coordinate at [72.37, 100.22] and a screen coordinate at [50, 31]. You start by finding the LSB (least significant bit) of your [X,Y] screen coordinate. In this example, our coordinate is [50, 31]. If we AND each number with 1, the result is [0, 1] (50&1 = 0, 31&1 = 1). This is our index into the lookup tables. With this index being [0, 1], we find that the table contains: "u+=.75,v+=.50". Adding .75 to U and .50 to V, we get: [72.37, 100.22] + [0.75, 0.50] = [73.12, 100.72]. As you can see, this causes us to grab a different texel then the one we're currently on. As you move from pixel to pixel through the screen, you'll find that the dither tables will alternate which texels are chosen based on how far you are to the bottom-right corner of a texel. Response provided by Paul Nettle |
|||
This article was originally an entry in flipCode's Ask Midnight, a Question and Answer column with Paul Nettle that's no longer active. |