Dark Bit Factory & Gravity

GENERAL => Projects => Topic started by: Rbz on September 10, 2007

Title: Pixel Shader 2.0 - Test
Post by: Rbz on September 10, 2007
Since shaders started to dominate the tiny coding scene  :P , I've started learning those stuff for months already, it's really hard to make the change and understand what it is all about, but I guess it's worthy playing with it,  and finally I reach a point that I can do some tests  ;D

You will see some sort of "flag" effect based on sin and cos texture displacement running at 1024x768 screen resolution.

Requires pixel shader 2.0 capable graphics card and it uses d3dx9_32.dll that should be placed on your windows system32 path or on the same folder of executable.

http://www.rbraz.com/temp/rbraz_Shader_Test.rar

I'm just wondering if it works fine for you, if effect speed is ok etc...


Cheers,
Title: Re: Pixel Shader 2.0 - Test
Post by: Jim on September 10, 2007
Works very smoothly here.  I can't read the image ;), but technically it's excellent.

Jim
Title: Re: Pixel Shader 2.0 - Test
Post by: benny! on September 10, 2007
Runs very smooth and clean here !!! Well done.

@Jim:
I read "Ravebusters" - but might be wrong ???
Title: Re: Pixel Shader 2.0 - Test
Post by: Positron on September 10, 2007

@rbraz
Works fine and smooth.


Title: Re: Pixel Shader 2.0 - Test
Post by: slippy on September 10, 2007
Same for my computer - it runs smooth and in a good speed ... really nice stuff ... :)
Title: Re: Pixel Shader 2.0 - Test
Post by: Clyde on September 10, 2007
Welldone Rbraz dude :)
Title: Re: Pixel Shader 2.0 - Test
Post by: Shockwave on September 10, 2007
I see a beautiful tiled grey logo by the very talented H2o waving around very prettily.
Speed wise it runs nice and smooth :)

My guess is probably about 70fps.
ATI X1650

Ps. You should post your last 4kb too :) It is a great intro.
Title: Re: Pixel Shader 2.0 - Test
Post by: Tetra on September 10, 2007
Works fine and smooth on my old system :)
Title: Re: Pixel Shader 2.0 - Test
Post by: Rbz on September 10, 2007
Thanks for your tests ;D

About that image, it's the Ravebusters logo done by h2O :)


So far, working on Nvidia and ATI cards, cool  :kewl:
Title: Re: Pixel Shader 2.0 - Test
Post by: va!n on September 11, 2007
@rbraz.
works very smooth and with nice speed here... btw, i hear more and more people are using PS2 / PS3... and that there are the first graphiccards with PS4 still available O.o  One the one way it may be nice to have PS included in the graphiccards... But why does people not code such effects like your swabble (flag like) effect with direct pixel manipulation in memory which would be very fast too (> 200-300+ FPS if it is well coded) ;) Anyway nice fx!
Title: Re: Pixel Shader 2.0 - Test
Post by: Ghost^BHT on September 11, 2007
Won't run on my computer :(  I have correct dll installed.  Latest drivers for my ati radeon card etc.
Any ideas? 
I get nothing, no window just slows my machine down terrible.

Athlon 1.2 ghz / 512 ram/ ATI Radeon w 256 m
Will try it on my vista machine later
Title: Re: Pixel Shader 2.0 - Test
Post by: va!n on September 11, 2007
@Ghost^BHT:
Does your card supports PixelShader2 or better and have you tried to install "DX 9.0c August 2007" version?
Title: Re: Pixel Shader 2.0 - Test
Post by: Rbz on September 12, 2007
.... One the one way it may be nice to have PS included in the graphiccards... But why does people not code such effects like your swabble (flag like) effect with direct pixel manipulation in memory which would be very fast too (> 200-300+ FPS if it is well coded) ;) Anyway nice fx!
Shaders are very very fast, I assure to you, perhaps Shockwave can tells us how much fast is manipulating an image in 1024x768 screen size using software screen buffers ;)


Won't run on my computer :(  I have correct dll installed.  Latest drivers for my ati radeon card etc.
Any ideas? 
I get nothing, no window just slows my machine down terrible.

Athlon 1.2 ghz / 512 ram/ ATI Radeon w 256 m
Will try it on my vista machine later
Ghost, I guess that your graphics card does not support ps2.0, anyway try the attached file below I've added an error message if your card fail running it.
Title: Re: Pixel Shader 2.0 - Test
Post by: Ghost^BHT on September 12, 2007
test prog won't even open a window ? no error message - nothing
Title: Re: Pixel Shader 2.0 - Test
Post by: va!n on September 12, 2007
@Ghost^BHT:
Maybe you can tell us what's your system (Windows Version, CPU, GraphicCard, DX Version)?
Btw, is it possible you are running a anti virus software which will stop the exetution of the file? just an idea
Title: Re: Pixel Shader 2.0 - Test
Post by: taj on September 12, 2007
Hey Rbraz - oldskool in shaders - at last!!!! Well done mate. Runs fine on x600 Ati laptop.
I have code for a shader lens effect and code for a series of shader tunnel effects too. Soon we'll have a collection of oldskool effects.

Shaders *are* software. But faster, floating point and easier to write (more power in built in functions).

However next gen shaders will outpace mainstream processors by miles. Shaders are still very weak compared to how they can be. ATi are recommending games companies for next gen cards, don't bother with textures anymore but calculate everything as reading textures is too slow :-).

They are also smaller, especially in directx.


Title: Re: Pixel Shader 2.0 - Test
Post by: Ghost^BHT on September 12, 2007
reinstalled dx runtimes and it runs fine now. Smooth and fast
Title: Re: Pixel Shader 2.0 - Test
Post by: Rbz on September 13, 2007
@Ghost: Glad it worked for you now


@Chis: Thanks

Quote
Shaders *are* software. But faster, floating point and easier to write (more power in built in functions).
Yeah, it's software because we provide the program for the graphics pipeline ;)
It was hard for me to learn how they work, because I don't have good material about it on my language so I spend more time reading books in english language, no problem anyway, now that I know how they work I can second what you said  ;D

Quote
However next gen shaders will outpace mainstream processors by miles. Shaders are still very weak compared to how they can be. ATi are recommending games companies for next gen cards, don't bother with textures anymore but calculate everything as reading textures is too slow :-).
OMG  :o

Quote
They are also smaller, especially in directx.
That's why I will be focusing on directx for now just to do some 1ks in the future  :updance:
Title: Re: Pixel Shader 2.0 - Test
Post by: taj on September 13, 2007

Quote
They are also smaller, especially in directx.
That's why I will be focusing on directx for now just to do some 1ks in the future  :updance:


I'd pay real money for a 1k directX minimal framework to draw a quad and get shaders up and running (from C of course).

Chris
Title: Re: Pixel Shader 2.0 - Test
Post by: Rbz on September 14, 2007
I do accept PayPal payments  :2funny:


Seriously, if you like, I can send to you what I have, we can make it better and also post it here for everyone.

PM me if you like that idea...
Title: Re: Pixel Shader 2.0 - Test
Post by: Jim on September 15, 2007
I get 719 bytes for this (attached) using crinkler.  NO pixel shader yet though - maybe someone who can cut through the voodoo behind Microsoft's documentation can add it?

Right now it just draws a gouraud quad.

Jim
Title: Re: Pixel Shader 2.0 - Test
Post by: taj on September 15, 2007
I'm no dx programmer but looking at your code maybe we could do the following:

1. Declare your array of points as not static
2. Get rid of colour and use a default FVF for the points (you dont need colour for the shader)
3. Leave lighting on...it wont matter when using shaders

???

Chris
Title: Re: Pixel Shader 2.0 - Test
Post by: Jim on September 16, 2007
Still wading through the useless documentation.
You are right about all your 3 ideas, they will probably be wins.  If you use a Vertex Shader it will be possible to eliminate the FVF stuff.  Dunno if it's even possible to mix and FVF based vertex shader with a Pixel Shader.
Did I mention the docs are crap?  There isn't even an example of using conditional code in vertex shaders, and presently I reckon it's not possible to branch at all in a dx pixel shader.

Jim
Title: Re: Pixel Shader 2.0 - Test
Post by: Rbz on September 17, 2007
Nice work Jim

Anyway, as I told to Chris, I've "cleaned" my code, and here's the 1k Pixel Shader Framework ;D written in C.

It compress to 859 bytes (no IBO), added an example to load a texture from file, but of course you need to create your own tiny texture or color effect etc, the shader program example just draw the texture on the quad.

Well, 1k DX9 coded C is possible!


 :cheers:
Title: Re: Pixel Shader 2.0 - Test
Post by: Jim on September 17, 2007
Thanks Rbraz! K+.  It should be possible to simplify this even more.  Chris won't want UVs.  Is it possible to pre-compile the shader to binary?  Sometimes that will be smaller than the shader text.

Jim
Title: Re: Pixel Shader 2.0 - Test
Post by: taj on September 17, 2007
Thanks Rbraz...karma to you and Jim for this.

It looks like it can get smaller yet. There are several interesting things here. It seems with work, the setup for dx shaders on a quad will be ... 700-750 bytes...or close to it. For opengl this is more like 800. But something else. On my ATi cards using glsl, many of the parameters that should be available in pixel shaders dont seem to be unless you have a vertex shader too. This means, unless I'm going daft, you need a dummy vertex shader, wasting more bytes.  In the end OGL seems to be around 170-180 bytes free therefore before you begin your intro whereas DX, at least on the surface seems more like 270-320. Its early days but :

1. dx shaders are better at 1k with a clear advantage, possibly nearly double the space!
2. At 4k, it makes much less difference.

Chris

 
Title: Re: Pixel Shader 2.0 - Test
Post by: .:] Druid [:. on September 26, 2007
Excellent work Rbraz! Smooth and nice! 

Title: Re: Pixel Shader 2.0 - Test
Post by: mind on August 19, 2009
omg 200 days!! whatever.. nayways, you might wanna do a virus check on that archive.. might be the packer(wichever you use) but i figured i'd let you know, just in case..
http://www.synthesi.st/virus.jpg (http://www.synthesi.st/virus.jpg)
Title: Re: Pixel Shader 2.0 - Test
Post by: Jim on August 19, 2009
Your virus scanner is probably warning about crinkler packed exes.  This happens, periodically, when the anti-virus people mess up.  We had a whole saga with AVG 18months or so ago...

Jim
Title: Re: Pixel Shader 2.0 - Test
Post by: Jim on August 19, 2009
By the way, saw a neat trick the other day that could save a few more bytes.
No need to draw a quad, just draw a triangle that covers the whole screen.

Jim
Title: Re: Pixel Shader 2.0 - Test
Post by: Rbz on August 20, 2009
omg 200 days!! whatever.. nayways, you might wanna do a virus check on that archive.. might be the packer...
200 days spreading virus!
Yes, it's a false alert, avast was complaining also, anyway I've update this archive.
Title: Re: Pixel Shader 2.0 - Test
Post by: TinDragon on August 20, 2009
I guess getting a few false positives is better than false negatives, imagine how fast the real virus's could spread then  :o