PDA

View Full Version : Demo of Carmacks reversed with source



Humus
03-12-2002, 09:29 PM
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 http://www.opengl.org/discussion_boards/ubb/smile.gif Source is included. It should work on the Radeon series and GF3/4.
http://esprit.campus.luth.se/~humus/?page=OpenGL

richardve
03-12-2002, 09:42 PM
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..

Humus
03-12-2002, 10:06 PM
Ooops, you may want to redownload it, or just compile it http://www.opengl.org/discussion_boards/ubb/smile.gif
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 http://www.opengl.org/discussion_boards/ubb/smile.gif

FXO
03-12-2002, 10:09 PM
That's great!

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

DFrey
03-12-2002, 10:21 PM
FXO, if you enable NV20 emulation it should. Albeit with significantly degraded performance.

richardve
03-12-2002, 11:36 PM
Originally posted by Humus:
Ooops, you may want to redownload it, or just compile it http://www.opengl.org/discussion_boards/ubb/smile.gif


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..

robert
03-12-2002, 11:44 PM
Wouldn't run on mine at all http://www.opengl.org/discussion_boards/ubb/frown.gif, even when i put gf3 emulation on. I got an unhandled exception, running XP..

But i have the source code http://www.opengl.org/discussion_boards/ubb/biggrin.gif, 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).]

jide
03-12-2002, 11:44 PM
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

Eric
03-13-2002, 12:43 AM
Originally posted by richardve:
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..

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

Humus
03-13-2002, 01:27 AM
Originally posted by richardve:
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..

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.

Humus
03-13-2002, 01:32 AM
Originally posted by jide:
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

Well, I want it to look good http://www.opengl.org/discussion_boards/ubb/smile.gif I also made it somewhat similar to my primary project (http://esprit.campus.luth.se/~humus/?page=OpenGL/GameEngine.html) 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().

richardve
03-13-2002, 01:55 AM
Originally posted by Humus:
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.

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.. http://www.opengl.org/discussion_boards/ubb/smile.gif

Humus
03-13-2002, 02:58 AM
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 http://www.opengl.org/discussion_boards/ubb/smile.gif

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.

Humus
03-13-2002, 03:05 AM
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 :p

richardve
03-13-2002, 03:50 AM
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..

Eric
03-13-2002, 05:34 AM
It works perfectly on my machine (GF3). Perhaps the other guy is using old (or the most recent http://www.opengl.org/discussion_boards/ubb/wink.gif !) drivers...

Regards.

Eric

knackered
03-13-2002, 07:40 AM
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.

SirKnight
03-13-2002, 08:08 AM
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. http://www.opengl.org/discussion_boards/ubb/wink.gif

-SirKnight

knackered
03-13-2002, 08:15 AM
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.

DFrey
03-13-2002, 08:20 AM
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.

zeckensack
03-13-2002, 08:53 AM
Nice http://www.opengl.org/discussion_boards/ubb/smile.gif ... but ... I'm getting all kinds of creeping artifacts on my oldschool Radeon. Wandering patterns of blackness all over the screen. Might be some kind of problem with insufficient precision or something.

Humus
03-13-2002, 07:24 PM
Originally posted by knackered:
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.

I'm not sure what you're trying to imply here ... would it be harder to develop perpixel lighting on a Radeon8500?
This demo takes the same path for GF3 and Radeon8500, it only uses ARB/EXT extensions.

Humus
03-14-2002, 09:20 AM
Originally posted by zeckensack:
Nice http://www.opengl.org/discussion_boards/ubb/smile.gif ... but ... I'm getting all kinds of creeping artifacts on my oldschool Radeon. Wandering patterns of blackness all over the screen. Might be some kind of problem with insufficient precision or something.

I've got that reported from some other guys too, not sure why it occures though. Looked like Z-fighting when I saw the screenshot. Looks like I don't get the exact same Z values when I draw it the second time even though it takes the exact same path the other time.

SirKnight
03-14-2002, 09:43 AM
Ya that sounds like a z-fighting thing to me. Before you render the shadow volumes do you set the depth func to GL_LESS and disable depth buffer writes?

-SirKnight

dginsburg
03-14-2002, 10:00 AM
Humus,

ARB_texture_env_dot3 was not doing the proper scale on the Radeon 8500. I have fixed this issue and the fix will be available in a future driver release.

The DOT3 RGB scale handling was changed from the EXT to ARB extension and I failed to notice that when I first implemented it.
Basically, the EXT version had:

4*DOT3

and the ARB version has:

RGBSCALE*4*DOT3

The most common case would be to do an RGB scale of 1, making it the same result as the EXT. I believe the change was made simply for orthogonality...

-- Dan

zeckensack
03-14-2002, 01:20 PM
Dan,

Any news on the 'DOT3 on third texture environment of R100' issue yet? I reported that a couple of weeks ago and Jeff Royle confirmed it.

Humus
03-14-2002, 10:31 PM
Originally posted by SirKnight:
Ya that sounds like a z-fighting thing to me. Before you render the shadow volumes do you set the depth func to GL_LESS and disable depth buffer writes?

-SirKnight

Yes, I do. It works just fine on both Radeon8500 and GF3/4, the problem only seams to occure on Radeon classic.

Humus
03-14-2002, 10:38 PM
Originally posted by dginsburg:
Humus,

ARB_texture_env_dot3 was not doing the proper scale on the Radeon 8500. I have fixed this issue and the fix will be available in a future driver release.

The DOT3 RGB scale handling was changed from the EXT to ARB extension and I failed to notice that when I first implemented it.
Basically, the EXT version had:

4*DOT3

and the ARB version has:

RGBSCALE*4*DOT3

The most common case would be to do an RGB scale of 1, making it the same result as the EXT. I believe the change was made simply for orthogonality...

-- Dan

Nice to here. One thought though, you say that it "was not doing the proper scale on the Radeon 8500", does that mean it did it right on Radeon classic? Asking because as far as I can remember it worked the same way on my old Radeon, just didn't know that it was wrong back then.

Humus
03-15-2002, 10:45 AM
Tested with the developer driver of today. Confirmed that it works fine now.