Mapping Pixels

Is there a way to apply pixel-exact textures (e.g. for screen overlays).
Utilizing the ‘Filter’ node to turn off hardware-smoothing and stuff helps, but still the textures get distorted and somehow shifted aside.

hi sven!

it’s neccessary that the quads with the textures are the same size (in pixels on the screen) as the applied texture. so every pixel of the texture finally is on one pixel of the renderer, and no interpolation has to be done…

therefore i usually use the ortho (off center) node to make the view space (which is usually from -1 to 1 by default) the size of the final resolution (e.g. for 800x600: left: -400 right: 400 top: 300 bottom: -300). then i scale the quad with the dimensions of the texture.

hope i made myself clear somehow :)

cheers.

crispycrisp.zip (6.5 kB)

Thanks Sagishi for your reply. Your method sounds interesting, but I was not refering to positioning textures in 3d space. I simply want to create an exact 2d projection of an image (e.g. by scaling a textured quad to x,y =2 and setting its ‘Space’ property to ‘Projection’).

Here’s a test patch.

pixelmapping.zip (7.7 kB)

although i’m not sure if you want to do it that way, i post my solution … because i think at least the result is what you’re looking for …

you’ll have to adjust the resolution of my patch to your needs. in fullscreen mode, the grid will be displayed correctly … (right now it’s at 1440x900)

i think it’s important to have the textures in dimensions of 2^n, so i made one with 256x256 …

furthermore i translated the textured quad 0.5 pixels in x and y direction … so that the pixels of the quad are aligned with the pixels of the screen.

maybe that’ll help, cheers.

pixelmapping2.zip (16.0 kB)

Sagishi,
sorry but that’s not the way i’d like to go. But thanks so much for your efforts.
I wouldn’t modify the viewport to adjust the scaling.
I guess the incorrect translation of the texture is due to some rounding error but I’m not sure on how to fix that. Shifting by .5 pixels might work in some cases, but I don’t think that this is a reliable method.
AFAIK the 2^n restriction only relates to memory issues concerning older graphic cards and does not affect the projection - but maybe I’m totally wrong.

Ok… Setting ‘Mip Map Count’ to ‘From File’ in FileTexture did the trick - though I have not a clue why… ; )

Strange, especially because I set MipMap Filter to None via Sampler State… hm…

If the FileTexture settings overwrite the Filter node settings I suspect this to be a bug.
BTW, what does the FileTexture property ‘Repair’ do?