Forum

Antialiased dx9 texture

i wish, i wish…
is it possible or absolutely impossible to antialias the contents of a renderer for output as a texture?
Normally, I would render double size and then scale down with photoshop, but as I’m trying to serve a png directly out of vvvv that’s not an option.

Or with other words: Can anyone confirm there is a graphic card vendor who ever implemented the Minification modes of the texture sampler?

on the other hand, sven used to have a shader which did this explicitly by looking up four texture coordinates for each pixel from a double sized bitmap and manually averaging these.

oschatz remember: minification filters do work! you were surprised with your cellular-automata-thing.

so i think rendering double size and scaling down in a second pass which is then written out as a png should do.

my graphikkard (ati mobility firegl v5000) for example even offers anisotropic minification. maybe linear does not look soo cool.

what is this minification filter ? the filter node ?

and is sven’s shader available somewhere ?

ja. texture filtering modes are adjusted via the Filter (EX9.SamplerState) node. it provides different modes of pixel-interpolation when magnifying or minifying a texture.

@joreg: its not perfect, but the result is clearly better with the second renderer. thanks!

what about a workaround using the screenshot node ? … if u just want to save png’s and the renderer is in fullscreen.

…and sometimes u guys confuse me…magnifying/minifying ? any reason for not calling it ‘scaling’ ;)

DirectX internally distinguishes between minification and magnification. Although both can be considered as scaling, this distinction makes sense, as there are different algorithms behind each case. Note that you can select minification and magnification filters in the Filter node separately.

With magnification you´d usually use four texels to create an arbitrary large amount of screen pixels (depending on the scale factor), minification bascially needs an arbitrary number of texels to create each screen pixel (depending on the minification). So minification is actually the more complex technique. E.g. when doing naive minification you´d need e.g. 65536 texture lookups to calculate the image pixel of an 256x256 pixel texture which was minified to 1 screen pixel. In a game, where a starship occurs way back on the horizon this is usually quite a waste, as you would not care about the exact color of that pixel. On the other hand when doing high end antialiased typography you want to have complete control about all the contributing pixels.

i’m always happy to learn. cheers for the details!

But how come, I can already see the content antialiased via hardware in my dx9 window but I just can’t output it antialiased and forward it as a texture. The antialiased content obviously is stored somewhere - but where?

that’s some crazy directx thing.
you can render antialised into a window, but for some reason it is not possible to render antialised into a texture.

so when using a renderer and a dx9texture, the content is rendered twice. once to display it in the window and once into a texture to be able to put it onto a geometry.
you might ask if it is stupid to render the complete scene twice. this sounds like it is much slower than just render it once and then copy it from the swapchain-surface (renderer-window) to the texture?
but in fact you would have to get that image from the graphics card into the system memory and then back into graphics card memory. and also the render flow of the graphics card has to be interrupted during this operation (GPU and CPU have to wait for each other). so most time it is faster to just render the complete scene twice.
on the other hand it would be nice to have an option to be able to be able to test that copy thing (i think we had that once?)…

So vvvvs fullscreen is nothing but a window? How do you achieve double-buffering then? Where is that memory?
confused…

This would solve the depth buffer issue I’ve experienced on nvidia cards too, I have to render off on an ATI card for 3d scenes at the moment.

cat

nono. vvvvs fullscreen is more than a window. it is using directx’s special fullscreen mode.

which has nothing to do with double buffering, that is also done in windowed mode. memory for all the things you see is always on the gpu. probably using the screenshot node could be an option? it can take portion of a screen (antialiased renderer window) and via texture-writer you could write that image to disk…not suitable for a general purpose antialiased dx9-texture of course.