Demo of Carmacks reversed with source

I’ve put up a demo on my site utilizing Carmacks reversed to create dynamic per-pixel lighting with properly overlapping shadows. I suppose some of you guys would be interested in this, knowing how many topics about Carmacks reversed that was posted not too long ago Source is included. It should work on the Radeon series and GF3/4.
http://esprit.campus.luth.se/~humus/?page=OpenGL

Hm… funny…


Missing extensions

The following required OpenGL extensions isn’t supported by the graphic card and driver you’re using:

GL_ARB_multitexture

This application will now exit.

OK

Will take a look at the code in a few hours…

Ooops, you may want to redownload it, or just compile it
Seams I forgot to recomile after I checked that the extension check worked and cleanly exited if there were any missing extensions. I just set
GL_ARB_multitexture = false;
Guess I didn’t recompile are I removed that line after I saw that it worked

That’s great!

I haven’t had time to test it though, it shouldn’t run on my card though (GF2MX).

FXO, if you enable NV20 emulation it should. Albeit with significantly degraded performance.

Originally posted by Humus:
Ooops, you may want to redownload it, or just compile it

Well, I still had to do a recompile because GL_EXT_blend_func_separate isn’t available for my GeForce3 Ti 200 (?)

The info pages @ Delphi3D say that it’s only available for the Radeon 8500…

why only make your engine demo work on huge machine ?
It would be appreciatly if it works on each machine that support OpenGL.

this is just a note.

jide

Wouldn’t run on mine at all , even when i put gf3 emulation on. I got an unhandled exception, running XP…

But i have the source code , i’ve tried implementing these shadows, with this code and the new docs out from NVIDIA, maybe ill have a chance this time.

Thanks guys, you rock!

[This message has been edited by robert (edited 03-13-2002).]

Originally posted by richardve:
[b] Well, I still had to do a recompile because GL_EXT_blend_func_separate isn’t available for my GeForce3 Ti 200 (?)

The info pages @ Delphi3D say that it’s only available for the Radeon 8500…[/b]

Noticed that as well… Does anyone know why this extension isn’t implemented on nVIDIA hardware ?

I’ll try to find a workaround when I have some time !

Regards.

Eric

Originally posted by richardve:
[b] Well, I still had to do a recompile because GL_EXT_blend_func_separate isn’t available for my GeForce3 Ti 200 (?)

The info pages @ Delphi3D say that it’s only available for the Radeon 8500…[/b]

Uhm, I don’t get how GL_EXT_blend_func_separate comes into the picture? It’s not used by this demo. Well, I have support for it in my TextureHandler class, but it wont use it unless it’s neccesary, which I can’t see it being with this demo.

I’ve heard results from nVidia cards now. I’ve reports on crashes on GF3, not working on GF4, but then I also have reports of it working for some guys on these cards. I guess it’s variates with drivers.

Originally posted by jide:
[b]why only make your engine demo work on huge machine ?
It would be appreciatly if it works on each machine that support OpenGL.

this is just a note.

jide[/b]

Well, I want it to look good I also made it somewhat similar to my primary project so that I can more easily transfer it into that engine later on.

If you want it to work on lower end cards you can strip out the bumpmapping code in the drawLit() method and use straight texturing with glLight() or something. Also strip out the call to createVectorField().

Originally posted by Humus:
[b] Uhm, I don’t get how GL_EXT_blend_func_separate comes into the picture? It’s not used by this demo. Well, I have support for it in my TextureHandler class, but it wont use it unless it’s neccesary, which I can’t see it being with this demo.

I’ve heard results from nVidia cards now. I’ve reports on crashes on GF3, not working on GF4, but then I also have reports of it working for some guys on these cards. I guess it’s variates with drivers.[/b]

Well, those crashes are because you are really calling glBlendFuncSeparateEXT(), but it can’t be used because it points NULL (ie. The famous crash dialog comes up)

You’re calling this function in texture.h @ Line 753

I’ve currently fixed this by just using the normal glBlendFunc() instead of glBlendFuncSeperateEXT()

btw. May I ask you why you’re (almost) only using headers?
Just wondering…

Well, that’s just an old bad habit, I personally would have preferred if some stuff were more like java. Guess I’ll never learn to do it the right way until I get a job and are forced to use the convention

Anyway, I found the bug why that function was called. A small little error in the if-statement, the last selectedAlphaSrcFactor should be selectedAlphaDestFactor of course.

Updated the files btw …

Do you guys with GF3/4 get very bright screen? A guy sent me a sceenshot which looked way too bright, and this time it’s not the inconsistency between ATi and nVidia in the GL_ARB_texture_env_dot3 that’s to blame, I’m using the EXT now :stuck_out_tongue:

Since I can’t upload files anymore (F2S has kicked me) I’ve send you an email with a screenshot…

Doesn’t look too bright to me…

It works perfectly on my machine (GF3). Perhaps the other guy is using old (or the most recent !) drivers…

Regards.

Eric

That is very nice!
It works perfectly on my geforce3 ti500 (dual p3 733’s) with the latest official detonator drivers.
I was only getting 40fps (on average), though - maybe there’s room for some optimisations - or maybe it’s just plane old stencil fill rate problems.

All i get is a pure white screen (full screen too). I had to use Task Manager to close the app cuz it stoped responding. I have a GeForce 256 DDR w/ newest XP det drivers, p3 600, 256 ram, etc. At least the source looks good.

-SirKnight

BTW, Humus, are you saying that you developed this (the perpixlighting etc.) without a gf3 to test it on (only your rad8500) ?!
That’s very good work, then.

It works (partially) in NV20 emulation mode for me, but very very very slowly. About 10 to 15 seconds per frame. The image ends up being very dark and littered with artifacts, but I can make out the shadows, just barely. I went into the source and changed the drawLit function to not use 3D textures and it worked much better for me, around 20 FPS.