PDA

View Full Version : Vector texture maps: demo and article



StefanG
02-16-2006, 10:54 AM
I just finished some work on vector texture maps implemented in GLSL - contour textures with arbitrary resolution rendered on the GPU.

A Windows demo with full source code and a PDF with a detailed explanation of the method is here:

http://staffwww.itn.liu.se/~stegu/GLSL-conics

My work is not significantly different from that presented last year by Ray, Cavin and LÚvy. I did my work independently but on low speed in my spare time, so I was overtaken by them, hence this will probably not be accepted anywhere as a research paper.

Still, it ought to be of interest to the community. It is a more direct approach that has very much better performance and is ready for use now, so I decided to post it here.

My demo should run on any GLSL-capable hardware, even older generation and budget cards. Please tell me if you have problems running it, and I'll try to fix it.

If you have any comments, feel free to post them here, or email me directly on the address in the article.

/Stefan

Jan
02-16-2006, 12:55 PM
My gfx-card: Radeon 9700 Mobility

When i run the demo, it says "rsqrt: no matching overloaded function found".

I changed it to "sqrt" instead of "rsqrt", and it compiles and runs, but only with 0.1 FPS and the result looks completely broken.

I don't have the most recent driver installed (Catalyst 5.11 or so), i will upgrade it soon and try again. I just wanted to let you know.

Jan.

Humus
02-16-2006, 06:00 PM
rsqrt() should rather be translated to inversesqrt() in GLSL. Once I did that change it compiled and ran fine on my X1800XL AIW.

Jan
02-17-2006, 01:08 AM
Ah, my fault, sorry. With the inversesqrt it does run and the result is correct, but still only with 0.1 FPS.

I assume with
"My demo should run on any GLSL-capable hardware, even older generation and budget cards."
you meant, that it does run on older cards, but not necessarily fast. Or should it run faster?

Anyway, interessting work.

Jan.

StefanG
02-17-2006, 02:26 AM
Sorry about the rsqrt(), my Nvidia driver constantly tricks me into writing non-stantard GLSL. I'll changed that ASAP. Sorry for the inconvenience.

Strange about that 0.1 fps on the Radeon 9700 Mobility. Perhaps that card does not support the automatic derivatives? Please try the alternate fragment shader "fragment_shader_noAA.frag" (just rename it ti "fragment_shader.frag" and edit my silly rsqrt() mistake). Does that run faster?

Stefan

StefanG
02-17-2006, 02:36 AM
I would be very interested in knowing of any other problems, and some performance numbers, with ATI hardware. This *should* run fine on ATI 9xxx and Nvidia 5xxx series cards, but I have only been able to test it on Nvidia hardware.

/Stefan

Heady
02-17-2006, 06:17 AM
Hi

P4 3GHz with old 9600 XT (Catalyst 5.7)
(works only HW-Acellerated with _NoAA-FragmentShader)

- 190-690 FPS with the origin windowsize
- 33-122 FPS at 1600x1200

Jan
02-17-2006, 07:00 AM
With the other shader it runs smooth at over 100 FPS. And it does have a colored background, which i don't have with the first shader. Is that intentional?

Korval
02-17-2006, 10:47 AM
Strange about that 0.1 fps on the Radeon 9700 Mobility. Perhaps that card does not support the automatic derivatives?I'm pretty sure that R300 class hardware doesn't have those opcodes natively. Since Humus got good performance on his R520 class hardware, I assume that they do. I don't know about R400 hardware, but since it was mostly a performance upgrade of R300's, I doubt it.

Humus
02-17-2006, 11:14 AM
The gradients are supported on R5xx but not on R4xx or earlier.
Got 2000-4500fps on an X1900XT at default res and 400-1000fps at 1600x1200.

Heady
02-17-2006, 04:30 PM
Athlon XP 2600
ATI 9800 Pro 256MB

(noAA):
default res: 355 - 1200
1280x1024: 88 - 310

zed
02-17-2006, 09:16 PM
runs well on a nv3x
"My work is not significantly different from that presented last year by Ray, Cavin and LÚvy. I did my work independently but on low speed in my spare time, so I was overtaken by them, hence this will probably not be accepted anywhere as a research pape"
im pretty sure i saw something very similar 3-4 years ago (on flipcode IIRC) though obviously not using glsl :)

Filip
02-18-2006, 12:35 AM
Ported and tried on my Mac.
Powerbook 1.25Ghz G4
Radeon 9600 Mobility (64MB)

noAA
fps at default res: 100 - 300 depending on window coverage

AA
more like spf

Obli
02-18-2006, 12:56 AM
Originally posted by zed:
runs well on a nv3xNV3x (slow) pixel shader 2.a with derivate support. RD3xx as far as I know is 2.b, which does not have it.

I've bookmarked the whole url (is this expected to remain persistent?) and I'll try out the demo soon.

Just as a reference, it recalled me of a much different algorithm from Loop-Blinn about curve rendering (which is in fact referenced in the paper). It's a much different problem but I wanted to point it out there.

OneSadCookie
02-18-2006, 02:42 AM
Ported to Mac and run on 17" iMac Core Duo (Radeon X1600).

The default shader gets 350-850fps depending on how many pixels are being shaded. It's just a black and white image.

The noAA shader gets about the same frame-rate (maybe 400-1000) but what was black with the previous shader is black/blue checked, and what was white with the previous shader is white/yellow checked, at 45 degrees to the other check pattern.

Should the two look the same?

Obli
02-18-2006, 07:56 AM
On 6600GT the performance are as follows:
980-510fps with AA, minor imperfections on closeups (quite hard to catch the eye).
1050-670fps with AA off but it blurs quite a bit.

As expected, the shader run eats only a bit of GPU in distant view (roughtly 40fps) but a lot on closeups (500fps).

I would say this thing is awesome!

StefanG
02-19-2006, 10:37 AM
> im pretty sure i saw something very similar 3-4 years ago (on flipcode IIRC) though obviously not using glsl

If you can find the reference, please e-mail me! I would be very interested indeed in seeing it.

As people have pointed out, the "_noAA" version has a checkerboard pattern in the blue channel to visualise the texels. (The code for that is in the other shader as well, but it is commented out.) The texture resolution is only 32x32 pixels, and as you can see, even the straight lines are not at right angles to the texel borders.

The demo in isolation does not really look like much, but please understand that it is intented as an illustration to the article, not the other way around.

Thanks for the info on ATI hardware not supporting derivatives. Is there some other way of doing AA in procedural shaders on those chipsets?

/Stefan

zed
02-19-2006, 10:25 PM
NV3x (slow) pixel shader 2.a with derivate support. RD3xx as far as I know is 2.b, which does not have it.it maybe slow but still runs ok for this ie ~100-400fps

sorry stefenG (youre the fella who made the noise shader aye, sweet) no further info, it may of only been 2 years ago, my minds a bit hazy. i had a seacrh but now since flipcode is no more theres no much to go on.

spasi
02-20-2006, 01:19 AM
Originally posted by StefanG:
Is there some other way of doing AA in procedural shaders on those chipsets?There's a chapter called "Fast Filter-Width Estimates with Texture Maps" in the first GPU Gems book. It describes how to calculate derivatives with clever texture sampling.

tigital
02-20-2006, 01:15 PM
...anyone care to post a link to one of the mac ports? I dislike wasting time re-porting projects...

Filip
02-21-2006, 02:59 AM
The only thing you have to do is to change the file reading function (filelength is windows stuff) and remove windows.h io.h glext.h and everything that has to do with wglGetProcAddress...

...and you need a glfw installed

compile with gcc -o GLSLconics GLSLconics.c -lglfw -framework Carbon -framework AGL -framework OpenGL

quick and dirty filelenth:
long getFileLength( File* f) {
fseek(f, 0, SEEK_END);
return ftell(f);
}

OneSadCookie
02-21-2006, 03:02 AM
http://onesadcookie.com/~keith/GLSL-conics.zip

You'll need to edit build.sh to point at your GLFW instead of mine.