Dark Bit Factory & Gravity
GENERAL => Projects => Topic started by: taj on May 12, 2007
-
Hi,
I wrote some code today but to get it under 1k I had to really push the limits of windows drivers. The code requires PS3.0 so if *anyone* has PS3.0 could you test this code and see if it works for you??? I am *amazed* it works for me.
Thanks.
Image included for non PS3.0 card holders which must be almost everyone here I guess.
-
I wish I would be able to see this moving. Looks really nice Taj! I don't know anyone (apart from you obviously) who can run PS3 stuff. Hope you find some testers.
-
works fine here taj ati x1550 looks the shit too i cant belive you got that down to 1k incredible!
-
Thanks Nino, thats cool. Thanks for the test. K++
Anyone with Nvidia?
Chris
-
I wish I would be able to see this moving. Looks really nice Taj! I don't know anyone (apart from you obviously) who can run PS3 stuff. Hope you find some testers.
I wish you could see it too shockie!
Chris
-
I get an orange screen
nvidia geforce 6600 gfx card
-
The same as CoDeMaN , Except white screen.
nVidia 5200FX GFX Card.
-
The same as CoDeMaN , Except white screen.
nVidia 5200FX GFX Card.
Emil, the 5200 is a PS2.0 card, not PS3.0, so it cant run the intro. Thanks for testing though.
Chris
-
I get an orange screen
nvidia geforce 6600 gfx card
Codeman,
Thats worrying. In theory it should work as 6600 has inifinite instructions and dynamic branching. I tested with 8800 and it works fine so certainly the later Nvidia cards work. Hmmm bloody shaders...they are all so incompatible and unpredictable currently.
OK well I wont rush to release any code fom this one then :-) Thanks very much for the test. K++
Chris
-
You're a long way ahead of most people's hardware Taj :)
It's probably impossible for you to make a safe version of this, I'm guessing there's no software fallback you can use?
-
Shock,
some drivers do support a software fallback but it could take maybe 1-2 minutes to draw one frame in some cases. I cant do anything Im afraid, even if it wasnt in 1k.
Chris
-
X1600, black screen :( It should work as this card is supposed to do PS3. App is still responding though, so it thinks it's rendering something!
Jim
-
whats the main diffrence between my x1550 and your 1600 jim? cause i would have thought it should work on yours with yours being a better model than mine.
-
Not a lot. Maybe you were right about driver troubles? Everything runs perfectly normally with this demo and your stuff, but right now I'm getting a lot of blank screens! :( I think I had trouble with AUX buffers before too.
Jim
-
Not a lot. Maybe you were right about driver troubles? Everything runs perfectly normally with this demo and your stuff, but right now I'm getting a lot of blank screens! :( I think I had trouble with AUX buffers before too.
Jim
Jim,
"everything runs fine with this demo". Does that mean it did work briefly?
Perhaps vista drivers are not yet stable in the less often used functionality or perhaps I'm not resetting things well enough. I had to add one line of code to get Nvidia 8800 to work under Vista.
Anyway, its a waste of my life now, I can see that things are simply not stable enough around ps3.0 to make it worth trying.
Chris
-
it really is a bit worrying as i was going to get the new vista but *if* there are still some driver problems from amd i might hold off for a while.
one thing i want to ask jim is that when you update the drivers could you let us know if any of the stuff that was giving you black screens runs.
cheers.
-
Shockie,
This might be of general interest Shockie...feel free to move the post if you feel its better elsewhere.
Nobody can run my 1k "hell" intro and that happens a lot with compo demos too (they run on the typically advanced compo machine and nowhere else).
So I did this.
1. Download kkapture 0.06b here http://www.farb-rausch.de/~fg/kkapture/
2. Captured the video at 800x600 (>1Gb)
3. Downloaded virtualdub from here http://skynet.liacs.nl/medialab/bin/showpage?doc=76
4. Followed instructions to resize but used "old format avi" instead and ignored warning
Result 160x120 avi , 25Meg in size. Its not great in terms of size (seems like it could be smaller).
Anyway you can get this video from http://scener.neostrada.pl/1ksmall.avi if you really want to see it.
Chris
-
Got a 404 with the link unfortunately.
I think it's time I updated my gfx card anyway, I was thinking about doing it soon. I have radeon X300 SE 128mb card at the moment.
What card would you reccomend? The processor in this machine is an intel Pentium 4 3.0ghz so it's quite up to date.
-
Got a 404 with the link unfortunately.
Hmm trying to fix this, could be a disk limit at my ftp server host. Looking into it...ok no I cant even have 25Meg on my server...I love Poland, this is the major operator and I pay 30quid a month for this service which is the equivalent (adjusting for cost of living etc) of you in the UK paying 90 pounds a month.
Sorry forget the video.
Chris
-
Hi Taj,
"runs fine" in this case means it hasn't crashed, remains responsive, but nothing is displayed, not even briefly. Screen mode is set, but the screen stays black. I've filed a bug report with ATI.
Don't waste your time on trying to fix it for me, there's either something wrong with my PC specifically, ATI Vista drivers specifically, Vista specifcally, or the X1600 specifically, or the code. I don't fancy debugging that lot frankly.
Nino, it's probably not Vista, it's probably something local to my setup. There's no way ATI would release drivers with a regression like this.
Jim
-
I think it's time I updated my gfx card anyway, I was thinking about doing it soon. I have radeon X300 SE 128mb card at the moment.
What card would you reccomend? The processor in this machine is an intel Pentium 4 3.0ghz so it's quite up to date.
O now theres a question! Well the truth in shaders is that each new generation of card is getting better at shaders much faster than at normal polygons - meaning, you get what you pay for. For example I had an x1600, upgraded to x1800 and shaders are 10x-20x faster. So...whats the budget?
Chris
-
tested on Intel DualCore Notebook with 2 GB DDR2 @ 800 RAM and ATI X1400 .... damn amazing!!!! it works here... even if it does not move smooth... amazing! dont know anything about shader coding and whats / how its possible... but what i see, its wonderfull!!
-
@shockwave:
if you want, i can do a divX video for you for d/l .... just tell me if you are interested... greetz
-
nVidia 7600GT is good bang for buck right now. I usually look here, because it changes every few weeks. They do a 'best of' at different price points each month.
http://www.tomshardware.com/graphics/graphicscards/ (http://www.tomshardware.com/graphics/graphicscards/)
The only reason to hold off right now would be to make sure you got a DirectX10 compatible part.
Jim
-
tested on Intel DualCore Notebook with 2 GB DDR2 @ 800 RAM and ATI X1400 .... damn amazing!!!! it works here... even if it does not move smooth... amazing! dont know anything about shader coding and whats / how its possible... but what i see, its wonderfull!!
a) Im pleased it worked
b) Thanks for the awesome review :-).
Here is the original in just 256b By Baze. This is one of the best ever 256b intros. By using shaders I can do much higher resolution, more dramatic lighting, make it faster etc but fundamentally the idea wasnt mine :-(. Mine is 4x the size though due to OGL/shaders. Frankly I always wanted to see lattice run quickly thats why I wrote the code.
http://www.intro-inferno.com/production.php?id=1299
Chris
-
@taj:
Screenies looks just awseome, Chris!!! Unfortunately I have PS2.0 only here. So a divX would
rock. Again, you make me being very interested in shaders again. Damn, why is time so limited.
Need definately more time. Anyway, well done !!!
@va!n:
A little sequence as a divX would truley rock !!!
-
Looking good, I'll test it at home...
-
I think I will go for the Radeon 7600XT, it seems straight forward enough to install and powerful and good value too :)
-
i got my radeon x1550 256mb for £55 and thats fairly easy to install and it runs just about everything you can throw at it.
although im thinking of updating to a nvidia 8800GTS
-
X1550 is a bit old now nino, it's a great card, but it's not in the bang-for-buck category any more. The X1600 and X1650 have filled that gap.
I've been buying a new card about once a year, but never the top of the range. I buy what was hot 12-18months ago, when they hit $150. Why? Because there's a worrying trend now that shows the top of the range video board at over $1000, when the dual core CPU is only $350! And they want you to by two so you can use SLI mode! There can't be any sense in buying that except for bragging rights. The games companies won't target those boards until everyone has them, and that means they need to trail the cutting edge by 12 months.
The 8800GTS is a monster, but it's nearly $500!
Jim
£1=$2.40
-
yeah jims right i would go for mabey the x1650 shockwave.
i know the guy at our local computer store quite well and hes going to do me a deal on a core 2 due and GTS for £300 saving me about £100. but thats with me trading my old parts in.
-
Shockie My 2 pennorth,
I agree with Jim for more general reasons. There isnt much to chose between AMD..er...Ati and Nvidia currently but as a big Nvidia fan (once upon a time) I have switched to Ati. Here are some reasons:
1. Nvidia dont follow glsl very well, meaning you can write incorrect shaders and they will work so its harder to learn proper glsl on Nvidia. I guess thats because Nvidia focus on cg.
2. Ati have the price edge, they are slightly cheaper.
3. Ati have the performance edge (check 8800 v HD 2900XT). http://www.digit-life.com/articles2/video/r600-part3.html
I had an x1600...no real problems, nice performer. If you can get to an x1800 by, say, selling your grandmother, do so as its 10x faster at shaders in some cases.
Chris
-
@Chris: I got an orange screen :(
I have an Nvidia Geforce 6600GT, as you know ps_3.0 should work here, "tracert" 1kb worked fine here, maybe an issue with GLSL for Nvidia ???
Anyway the screenshot looks amazing!
-
@Chris: I got an orange screen :(
I have an Nvidia Geforce 6600GT, as you know ps_3.0 should work here, "tracert" 1kb worked fine here, maybe an issue with GLSL for Nvidia ???
Anyway the screenshot looks amazing!
Thanks for that Rbraz. I have access to a 7XXX at work and it has the same problem (8800 doesnt). I'll try some stuff at work and see if I can figure out whats wrong. I think it might be numerical accuracy at this stage - which if it is, could be hard to fix (going all integer maybe?). I will try to fix because I'm curious as hell. This is a weird one.
Chris
-
Works ok here, x1650 amd64 3200.
-
Works ok here, x1650 amd64 3200.
Thanks dude, seems Ati handles it ok, Nvidia not.
-
Well, I have a few quid burning a hole in my pocket at the moment so I will be getting a new card. Probably I will go the Radeon route now after reading all the helpful posts so with luck I will b e able to comment properly on your work with shaders Chris :) I know it is going to be good, I expect it will be astounding and time will tell :)
Thank you for all the advice on GFX cards and sorry for sort of hijacking the topic but I think it was relevant.
-
Nvidia guys,
I found the NVidia problem. After I compiled and ran >20 versions of my code and found nothing I resorted to reading the web.
http://developer.download.nvidia.com/opengl/glsl/glsl_release_notes.pdf is very interesting.
It says:
Flow Control Limitations and Caveats
NVIDIA’s GLSL implementation does not (currently) provide for arbitrary branching and looping in the fragment domain on the NV30 and NV40 targets. Branching and looping is more general in the vertex domain. Loops will perform best when the iteration count can be determined statically at compile time. Loops based on uniforms are restricted to 255 iterations on NV40, and they are not supported on NV30. It may be best to compile multiple versions with constant loop counts rather than attempting to use a uniform value to control the loop count. The G80 target is significantly more capable with branching and dynamic flow control, so it does not face these caveats.
6XXX series cards are NV40 variants, meaning they cannot run real PS3.0 no matter what the marketing says.
I checked an 8800 and its G80 works fine with my code (as the document says it would).
I guess the 7XXX series with G70 have the same issue as g40 and explains why they dont run my code.
So , to cut a long story short, I dont currently see a way to get the code to work on Nvidia platforms <8800. That said, I will continue to think...as obviously, no point in writing code that doesnt run...
Chris
Chris
Chris
-
NVIDIA guys - help!!!
I coded round the nvidia problems and got an exe I think works on ati and nvidia. I had to drop colour and texture as it uses bytes (hmmm beginning to sound like rtrtrace from loonies).
Could you guys test?
Its meant to look like the picture - yeah I know nowhere near as good as the first version.
-
yeahh ... it just works fine on NVIDIA GeForce 6800 GT !!! Rulez!
Very well done, Chris !!!
-
yeahh ... it just works fine on NVIDIA GeForce 6800 GT !!! Rulez!
Very well done, Chris !!!
Excuse me here but ... oh thank god. That was *hard* to debug.
-
cool i know you need nvidia testers but it still works on my x1550 so good stuff.
so what was causing the problem taj?
-
Loops using a variable instead of a constant as the loop limit, by the sounds of things.
->Shockwave, been looking at graphics cards for myself recently, and was going to get a 7600GT, but now they've all vanished from the computer shops to be replaced with 8600GT for only a couple of quid extra.
Jim
-
Nino,
thanks for testing! It was a cracking problem I have to say. Jims basically right with the caveat that I must have a variable loop (or performance dies) so I had to find a way to do a variable loop on Nvidia hardware. The solution was easy once I knew the problem.
Heres the original code snippet that caused the problem:
float t=0.0;
do{
t+=0.01;
v = fract (p+0.5+t*d);
} while ( t<4.0 && length(v.xyz-0.5)<0.6 );
That while is the problem because the Nvidia cannot make branching decisions based on run time conditions.
The new version:
float t=0.0;
for ( int i=0; i<200; i++ ){
t+=0.02;
v = fract (p+0.5+t*d);
if (length(v.xyz-0.5)>0.65) i=200;
}
The surprise for me was that the "if" worked fine. Strictly this is dynamic branching but it seems that because the loop
can be completely unrolled and the total instruction count known, this if is ok. The second surprise was that I could "fake" dynamic looping decisions by setting i=200 in the middle of the code. Very dirty of course but I think it works because it doesnt affect the number of instructions in a completely unrolled loop.
The new version is about 10 more bytes after compression so I needed to drop colour and texture :-(.
In the end what I now know is I need an Nvidia and an ATi card...thanks to everyone here who tested for me to help me understand all this.
Chris
-
Neat :) You fail my software engineering course, but you pass the interview to be a games programmer!
Jim
-
cool! i guess sometimes you gota do what you gota do.
-
Works fine here (Geforce 6600GT), just a little bit slow but I guess I need a new PC and gfx board.
Well done man :)
-
Yeah baby! OK Ill work on speed too.
Thanks RB, U know u r the best at 1k so respect and thanks.
-
Ah, it pleases me to say that I have been able to run this now :D
Runs fine (about 20fps) Radeon X1650 256mb, P4 3.0 Ghz 512mb ram.
-
Ah, it pleases me to say that I have been able to run this now :D
Runs fine (about 20fps) Radeon X1650 256mb, P4 3.0 Ghz 512mb ram.
And? Did u like it or not?
-
No, I didn't like it... I loved it.
-
Here is a version that packs in a lot more which I hope works on NVIDIA. Can anyone with NVIDIA check?
- Requires GOOD ps3.0, so 5XXX and 6XXX series simply wont get good results if anything (but I hope 6XXX runs).
Its really experimental and pushes my x1800 to the limits. God knows if it will run anywhere else.
Chris
-
not nvidia here but works on X1650
-
StoneMonkey,
thanks for the test. I'm curious - on 1650 - I guess its < 10 frames per second yes? I know you have to guess as there is no counter.
Chris
-
Nice!
Run around 10 fps when the view is far from structure (like that image) and pretty fast when it's close.
GeForce 6600 GT
-
Thanks Rbraz for the test. I'm really pleased it runs on NVidia also, seems I'm getting the hang of shaders finally.
I'm impressed it runs on 6XXX series. Perhaps I underestimated Nvidia cards.
Chris
-
Will check this out later on the desktop :) The screenie looks nice though
-
The framerate went from about 15 fps right up to about 60 - 80 fps the lower frame rates happened when the scene was more zoomed out, as it zoomed in it became really smooth.
Colours look nice too, I am a big fan of Orange :D
(X1650 256mb)
-
Just to let you know, I've finally got my new PC with an nVidia 8600GT and all the demos in this thread run OK. The original version runs, is a bit choppy, and doesn't exit properly. The B&W one works fine, and the latest one runs pretty much like Shockie describes. I'm a very happy chap!
Jim
-
Thanks Jim.
As a sorta bonus for folks, here is the complete code of the intro. The program works by drawing a quad on the screen, the shader does almost all the rest of the work. Rbraz , you might be interested to note that I do a translate and rotate in my application code but I found its nearly twenty bytes smaller (!!!) to code that as glMultMatrixf with a static array of floats for the matrix than standard glRotate and glTranslate
// Chris Thornborrow (auld)... lalala credit would be nice ... lalala
// Example OGL + shaders in 1k
// Requires crinkler
// VS2005 modifications by benny!weltenkonstrukteur.de
#include <windows.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include "glext.h"
typedef void (*GenFP)(void); // any function ptr type would do
static GenFP glFP[7];
const static char* glnames[]={
"glCreateShader", "glCreateProgram", "glShaderSource", "glCompileShader",
"glAttachShader", "glLinkProgram", "glUseProgram"
};
// Draws the labyrinth using a pair of shaders...
// Vertex shader does NOT transform incoming vertex but stores that in p instead for later use
// The fragment shader is a complicated. It essentially raycasts into a constantly changing
// equation, similar in concept to chladni :-). Its carfully tuned so we dont crash into it as we move
// and so we get a feeling of depth. The for loop could be smaller when written as a do .. while but then
// it wouldnt work on NVidia cards of 7xxx series or below.
// Fragment shader has 2 lines for setup, 1 line for raycasting and function testing, 1 line for colour.
const char *labvsh="varying vec4 p;void main(){p=ftransform();gl_Position=gl_Vertex;}";
const char *labfsh="\
varying vec4 p;\
void main(){\
vec3 V=vec3(0,3.5*sin(p.z),p.z);\
vec3 D=vec3(p.x,p.y,0.5)*0.08;\
for(int i=800;i>0;i--,V+=D)if(length(fract(abs(sin(V))))>1.5+0.5*sin(V.z)*sin(p.z*0.4))i=0;\
gl_FragColor=vec4(1,0.8,0.8,0)*dot(vec3(0.4),fract(V))-length(V-p.xyz)*0.1;\
}";
static void setShaders() {
// 19. April 2007: "(GenFP) cast" added by benny!weltenkonstrukteur.de
for (int i=0; i<7; i++) glFP[i] = (GenFP)wglGetProcAddress(glnames[i]);
GLuint v = ((PFNGLCREATESHADERPROC)(glFP[0]))(GL_VERTEX_SHADER);
GLuint f = ((PFNGLCREATESHADERPROC)(glFP[0]))(GL_FRAGMENT_SHADER);
GLuint p = ((PFNGLCREATEPROGRAMPROC)glFP[1])();
((PFNGLSHADERSOURCEPROC)glFP[2]) (v, 1, &labvsh, NULL);
((PFNGLSHADERSOURCEPROC)glFP[2]) (f, 1, &labfsh, NULL);
((PFNGLCOMPILESHADERPROC)glFP[3])(v);
((PFNGLCOMPILESHADERPROC)glFP[3])(f);
((PFNGLATTACHSHADERPROC)glFP[4])(p,v);
((PFNGLATTACHSHADERPROC)glFP[4])(p,f);
((PFNGLLINKPROGRAMPROC)glFP[5])(p);
((PFNGLUSEPROGRAMPROC) glFP[6])(p);
}
static PIXELFORMATDESCRIPTOR pfd;
static DEVMODE dmScreenSettings;
// This is an approximation to rotation by 1 degree round z axis
// because its an approximation, it deteriorates in time!!
// and a small translation (0.04) down the z axis
static const GLfloat m[16]={1,-0.01f,0,0,0.01f,1,0,0,0,0,1,0,0,0,0.04f,1};
void WINAPI WinMainCRTStartup()
{
dmScreenSettings.dmSize=sizeof(dmScreenSettings);
dmScreenSettings.dmPelsWidth = 640;
dmScreenSettings.dmPelsHeight= 480;
//dmScreenSettings.dmBitsPerPel = 32;
// its risky to remove the flag and bits but probably safe on compo machine :-)
dmScreenSettings.dmFields=DM_PELSWIDTH|DM_PELSHEIGHT;
ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN);
// minimal windows setup code for opengl
// risky but tested on 2xati cards and 1xnvidia8800
//pfd.cColorBits = 32;
pfd.dwFlags = PFD_SUPPORT_OPENGL|PFD_DOUBLEBUFFER;
// "HDC hDC" changed 19. April 2007 by benny!weltenkonstrukteur.de
HDC hDC = GetDC( CreateWindow("edit", 0, WS_POPUP|WS_VISIBLE|WS_MAXIMIZE, 0,0,0,0,0 0,0,0));
SetPixelFormat ( hDC, ChoosePixelFormat ( hDC, &pfd) , &pfd );
wglMakeCurrent ( hDC, wglCreateContext(hDC) );
setShaders();
ShowCursor(FALSE);
//**********************
// NOW THE MAIN LOOP...
//**********************
// there is no depth test or clear screen...as we draw in order and cover
// the whole area of the screen.
do {
//move forward and rotate slightly each frame
//glMultMatrix is smaller (20 bytes) than glTranslatef and glRotatef!!
glMultMatrixf((const GLfloat*)&m);
glRecti(-1,-1,1,1);
SwapBuffers(hDC);
} while ( !GetAsyncKeyState(VK_ESCAPE) );
// necessary under vista it seems... :-( extra bytes required.
ExitProcess(0);
}
The cool thing is the intro works under XP/Vista, and all known Nvidia and ATi cards supporting PS3.0 (depsite all the quirks and bumps). Thats mostly thanks to help from DBF and some help from McZonk in Titan.
Chris
-
@taj:
Awesome. Thanks for sharing ... studying it in the next days ..
K++
-
...I found its nearly twenty bytes smaller (!!!) to code that as glMultMatrixf with a static array of floats for the matrix than standard glRotate and glTranslate...
That's cool, I will do some tests with glMultMatrixf this weekend :goodpost:
-
Posting the source was a very Karmic thing to do K+
-
sharing the source rocks ... K++ from me as well ...
-
You are most welcome, and thanks for the KKKKKs :updance: