PDA

View Full Version : Quake1 with stencil shadow volumes & perpixel lighting



knackered
08-31-2002, 06:16 AM
Looks like someones doing something interesting with the Q1 source code, attenuated specular and diffuse bumpmapping replaces the lightmaps, and proper shadow volumes add the finishing touch:-
http://users.pandora.be/hollemeersch/blackrose/tenebrae/index.htm

Unfortunately I don't have Quake1, so I'll have to make do with the screenshots http://www.opengl.org/discussion_boards/ubb/frown.gif

davepermen
08-31-2002, 06:21 AM
you read the opengl.org news? http://www.opengl.org/discussion_boards/ubb/biggrin.gif cool..

yeah, its cool. i even have quake1, so i play it currently. but you can get away with the demo/shareware version, it works there as well.. i think.

yeah, it looks quite cool, thought the perpixellighing generally sucks on a gf2mx (simple specular on everything, without glossmap it is. and a low exponential, and just addet, so it gets nice white and thats it.. bah http://www.opengl.org/discussion_boards/ubb/biggrin.gif).

what scares me is the speed, it doesn't run smooth on 640x480 when there is some stuff on the screen.. and the perpixellighting has less features than the doom3 lighting => it is faster than the doom3 version. AND the geometry is simpler than the doom3 geometry..
i think i will not try doom3 on this pc http://www.opengl.org/discussion_boards/ubb/biggrin.gif

the ones that made it made a really cool job, quake looks so cool now. now some subdivision and displacementmapping on the whole geometry, and it would be perfect http://www.opengl.org/discussion_boards/ubb/biggrin.gif hehe

davepermen
08-31-2002, 06:33 AM
have to correct myself, it has colored specular and all in http://www.opengl.org/discussion_boards/ubb/biggrin.gif

hehe, its fun to play.. http://www.opengl.org/discussion_boards/ubb/biggrin.gif

knackered
08-31-2002, 06:51 AM
Bugger, no I didn't read about it on opengl.org news, I haven't checked that page in a few days. Found it mentioned on some other newsgroup just now.
Sorry if this is old news.
I'm wondering how the bump maps are created - are they converting the existing textures to greyscale height maps and generating normal maps from those? That would seem sensible.
You really should upgrade your card, davep - how can you manage with a gf2mx?

davepermen
08-31-2002, 07:04 AM
hehe, i've played it before the news on opengl.org, so i could have posted this as well http://www.opengl.org/discussion_boards/ubb/biggrin.gif

dunno how they generate the bumpmaps, but you could download the source as well to check it http://www.opengl.org/discussion_boards/ubb/biggrin.gif..

about my lovely card..
in one or two weeks i have
p4 2.8 giga with a radeon9700..

it should run bether then http://www.opengl.org/discussion_boards/ubb/biggrin.gif

PH
08-31-2002, 07:19 AM
The guy who wrote the Quake1 mod posts on this board ( under Pentagram ).

Pentagram
08-31-2002, 12:10 PM
Hello

(Here I am. I don't publicize my stuff on message boards.)
- The light equatiation is clearly explained in the techical section, it uses glossmaps for specular.
- Bumpmaps are generated from grayscaling the textures or can be supplied by the user (I made a lot of crappy bumpmaps for the obvious textures like bricks & stuff)
- Heh the 9700 version wil probably be very slow. It uses the generic (ARB_ & EXT_ only) path that requires 9 passes, but then again on a 2.8 ghz that will not matter anyway. http://www.opengl.org/discussion_boards/ubb/wink.gif
-The public version runs at 33fps on my PIII-900 gf4 4200 (my next version already runs at 41fps and I'm not done optimizing yet.)
-Opengl news was actually some days to late by that time lots of sites already had reported on it.

Has anyone good papers to do trueform-like things as a preprocessing step our something.
My idea was do split all edges in 2 edges ( thus every triangle becomes 4 triangles) and then do something with these verts by extruding them by the normals or something.

Charles

[This message has been edited by Pentagram (edited 08-31-2002).]

AdrianD
08-31-2002, 12:19 PM
Pentagram,

this feature from gamasutra.com is about the math behind N-patches (ATI calls them truform...)
http://www.gamasutra.com/features/20020715/mollerhaines_01.htm

davepermen
08-31-2002, 12:49 PM
pentagram, yes, you have all the stuff in, its just in the first level, first part, its all so white from the speculars http://www.opengl.org/discussion_boards/ubb/biggrin.gif anyways, i have to congratulate you, that stuff is awesome cool..

i currently play it with 320x240 and fsaa4x, it runs smoother than 640x480 that way and looks way bether (as the edges and shadowedges look terrible on both resolutions else..). the 320x240x4 is faster than the 640x480, don't ever ask me why http://www.opengl.org/discussion_boards/ubb/biggrin.gif cass? any fancy optimisations for fsaa on the gf2mx?

i hope you get some sweet r300 version with one pass for the whole lighting (and possibly bether lighting equation as well, as there you could do much more..) i would love to see that http://www.opengl.org/discussion_boards/ubb/biggrin.gif

you got me quaking again, thats cool http://www.opengl.org/discussion_boards/ubb/biggrin.gif

SirKnight
08-31-2002, 01:55 PM
Looks like dave learned about a new happy face icon! His posts, I've noticed, are riddled with them. lol. http://www.opengl.org/discussion_boards/ubb/wink.gif

Anyway, looks like I'll have to reinstall Quake 1 again to try this newer version of 'shadow-volume quake.' http://www.opengl.org/discussion_boards/ubb/smile.gif

-SirKnight

[This message has been edited by SirKnight (edited 08-31-2002).]

davepermen
08-31-2002, 02:07 PM
yeah, i moved from http://www.opengl.org/discussion_boards/ubb/wink.gif to http://www.opengl.org/discussion_boards/ubb/biggrin.gif about a month ago, or so.. hehe http://www.opengl.org/discussion_boards/ubb/biggrin.gif dunno why again.. but i think it was because of a girl.. hehe http://www.opengl.org/discussion_boards/ubb/biggrin.gif

yeah, when dave is happy, dave fills screen with them http://www.opengl.org/discussion_boards/ubb/biggrin.gif

yeah, reinstall it, its soooo coooooool http://www.opengl.org/discussion_boards/ubb/biggrin.gif

for example in the end of the first level of chapter two, there are two sources shooting rockets against you, that looks so cool as they fly trough a complex grid mesh.. i got shocked and run away as i did not understood first the heck is going on my screen http://www.opengl.org/discussion_boards/ubb/biggrin.gif then i moved back and have actually seen them, lighening rockets flying towards me, and i ran away again http://www.opengl.org/discussion_boards/ubb/biggrin.gif hehe http://www.opengl.org/discussion_boards/ubb/biggrin.gif great fun http://www.opengl.org/discussion_boards/ubb/biggrin.gif

Korval
08-31-2002, 02:09 PM
Has anyone good papers to do trueform-like things as a preprocessing step our something.

If this is a pre-processing step, look into Subdivision Surfaces (especailly for character models. They probably wouldn't help on the walls). They don't even need normals to work, and they can be made to work well over creases in the geometry.

Humus
08-31-2002, 04:49 PM
http://www.opengl.org/discussion_boards/ubb/biggrin.gif @ davepermen

zed
08-31-2002, 05:37 PM
>>Has anyone good papers to do trueform-like things as a preprocessing step our something.
My idea was do split all edges in 2 edges ( thus every triangle becomes 4 triangles) and then do something with these verts by extruding them by the normals or something.<<

no papers but i do something similar when i do displacement mapping. though IIRC u split the edges made from the texture coordinates data.also the division is a bit more flexable that is u can split a line into X number of ie not just split it half way + then split those halfs etc.
search for triangle (surface/polygon) tessleation theres prolly a lot of info about it (though it really is pretty straight forward)

FXO
09-01-2002, 03:22 AM
Pentagram:
Tenebrae rocks, good work.

I run it at 320x240x32 @ 41fps - demo1
on my TB1400 GF2MX.
Also, the bumpmapping adds a lot to the overall look (played an earlier version without it), the projected textures, smoke,.. ahh, its just great! http://www.opengl.org/discussion_boards/ubb/smile.gif

PH
09-01-2002, 03:47 AM
Pentagram,

Btw. the "blending problem" on Radeons is caused by glPolygonOffset with factor = 0. This is probably a driver bug. Yesterday, it occured to me that you had probably used the same polygon offset call that Cass used in his demo. His demo had that blending problem on Radeons too. Anyway, using a different glPolygonOffset setup solves the problem ( a temporary solution really ).
PolygonOffset has always been different across implementations but I assume NVIDIA's is correct ( zero is allowed, right ? )

GPSnoopy
09-01-2002, 03:52 AM
Oh! It's Quake I? Damn! I thought I was playing Doom III. http://www.opengl.org/discussion_boards/ubb/frown.gif

It looks really cool. But is it me or the first level (plus the Zoo map) are the only maps that have been optimized for it?
'cause other maps looks really dark.

Here it's playable in 640*480, due to the good old GF2U, but the P3-700 is unfortunatly getting too old for it. http://www.opengl.org/discussion_boards/ubb/wink.gif

PS: Hey! Another Pandora fella, no wonder he's making good stuff with OpenGL! http://www.opengl.org/discussion_boards/ubb/smile.gif

martin_marinov
09-01-2002, 04:15 AM
Originally posted by Pentagram:
Hello
Has anyone good papers to do trueform-like things as a preprocessing step our something.
My idea was do split all edges in 2 edges ( thus every triangle becomes 4 triangles) and then do something with these verts by extruding them by the normals or something.

Charles

[This message has been edited by Pentagram (edited 08-31-2002).]

Hi,
actually what you describe is called primal triangle subdivision. There are two famous subdivision schemes which work use this method:
Butterfly (Dyn, Levin, Gregory) - interpolates the initial geometry, C1 continuity, no need to project vertices after performing the refinment steps, analytical normals stencils, etc.. Cons: weird rules at the boundary, C1 is broken at irregular vertices (degree != 6). look for Modified Butterfly(Zorin).
Loop (Ch. Loop) - aproximates the initial geometry, C2 continuity!, analytical normal stencils, good rules at irregular points(no C2, but still bounded curvature and C1) Cons: must project vertices on the limit surface(one step needed more)

good sites for subidivision: http://multires.caltech.edu http://www.mrl.nyu.edu/ http://www.informatik.rwth-aachen.de/I8/research/research.html

During my master thesis I developed some fast implementations of the above algorithms, and other subdivsion schemes, if you are interested, let me know.

Regards
Martin

Pentagram
09-01-2002, 06:31 AM
- Yes that radeon problem seems to be a driver bug someone mailed me that with some beta drivers from ATI it works as it should.
- I will have to dig into the subdivision things I guess, all I know are bezier/nurbs patches. http://www.opengl.org/discussion_boards/ubb/wink.gif
- We (I found a decent designer on the net http://www.opengl.org/discussion_boards/ubb/smile.gif ) are working on a better demo map, what I've seen of it is really spectacular. (only 1 room 3 lights!) The guy actually can make bumpmaps that look good.

Charles

davepermen
09-01-2002, 07:55 AM
hehe. there is yet a map with, is that another demo map to play with?

btw, quake looks quite amazing like that, but, well, its terrible difficult to play, as you have to shoot around to actually see something.. i'm somehow scared how doom3 will play.. http://www.opengl.org/discussion_boards/ubb/biggrin.gif

best is still npr sketch.. that looks somehow awesome 3d and is very good playable http://www.opengl.org/discussion_boards/ubb/biggrin.gif

Lighthouse
09-01-2002, 09:05 AM
I would really appreciate a reliable mirror. It seems that the main site is not coping well with its newfound popularity.

FXO
09-01-2002, 10:32 AM
Pentagram, I have two suggestions to make tenebrae even better:

Perhaps you should make GL_LINEAR_MIPMAP_LINEAR default, it looks ten times better than GL_LINEAR_MIPMAP_NEAREST.

Another suggestion is interpolated animation, some of the other q1 mods have that, and it shouldn't take very long to implement.

Pentagram
09-01-2002, 10:50 AM
On gf3 it uses linear_mipmap_linear by default on other cards you can enable it by using "gl_texturemode linear_mipmap_linear"
or maybe "gl_texturemode gl_linear_mipmap_linear".
Interpolation is already in for the next version (looks nice http://www.opengl.org/discussion_boards/ubb/wink.gif ) my main concern for the first version was the speed but it is now actually faster with than wihtout interpolation. (Heh a little bit of volume caching can do wonders.)

h2
09-01-2002, 11:58 PM
Nice job, Pentagram!

Once upon time I was doing something like that, but with precomputed occlusion maps: http://www.cc.jyu.fi/~pturchy/dlt/
I have to admit that your approach gives more impressive results. But my is faster http://www.opengl.org/discussion_boards/ubb/smile.gif (screens were done on GF2)


[This message has been edited by h2 (edited 09-02-2002).]

LaBasX2
09-02-2002, 08:46 AM
I was thinking of how to do specular on generic hardware with GL_ARB_texture_env_combine in one pass and I have an idea for a solution. The function f(x) = (clamp[(x-0.77)*4])^2 seems to be a quite nice approximation of the x^16 function and it can be easily calculated with tex_env_combiners and destination alpha. Calculating (x-0.77)*4 wastes one texture unit but if you don't need the normalization cube map, you should be able to get nice specular intensity even on 2-texture hardware in one pass http://www.opengl.org/discussion_boards/ubb/smile.gif

LaBasX2

davepermen
09-02-2002, 08:51 AM
and never forget the blendsquare glBlendFunc(GL_SRC_COLOR,GL_ONE) to power it up again..

two passes should be enough, including correct specular.. in the rc's.. on a gf1.. how much passes does the gf2mx here do again? per light?

LaBasX2
09-02-2002, 11:32 AM
The advantage of the function I hacked out in a function plotter today is that you don't need RCs only TextureEnvCombine. I have implemented it using three texture units and it is looking great. Pentagram could use it in his Tenebrae to reduce the number of passes of the generic renderer from 9 to 6.

LaBasX2

Hull
09-02-2002, 11:42 AM
This is the way coolest thing Ive seen since Quake 1 replaced Duke Nukem 3D.....

Im all over the code trying to learn,
and I just LOVE the MatrixAffineInverse() function.

http://www.opengl.org/discussion_boards/ubb/wink.gif

davepermen
09-02-2002, 12:02 PM
Originally posted by LaBasX2:
The advantage of the function I hacked out in a function plotter today is that you don't need RCs only TextureEnvCombine. I have implemented it using three texture units and it is looking great. Pentagram could use it in his Tenebrae to reduce the number of passes of the generic renderer from 9 to 6.

LaBasX2


i think your hack should work with two general register combiners, in one pass. depending on the inputdata, thats where the problem is.. but no more than two passes needed, for sure..

FXO
09-03-2002, 04:44 PM
Great!, Im looking forward to testing the new version.

Nakoruru
09-03-2002, 05:43 PM
In other circles I am known as Phoenix (fenix@io.com). I was the one who implemented the animation interpolation that which everyone seems to use (probably because I came out with it 2 days after the source was released).

I was surprised that Tanebrae did not use it, but then I thought that it may complicate silouette determinations.

The animation interpolation was not that hard, I only had to change code in a few places, it was the movement interpolation which was really hard because there where several unrelated pieces of code that needed changing.

Actually, if you put in movement interpolation, it has a bigger effect on making things look smooth than animation interpolation. I really could not even tell that the animation was interpolated until I got the movement interpolated. It's because the models jump so far when they move it has a bigger effect in making them look choppy then the 10fps animation.

The nicest thing about it was that when I got it working, some of the monsters made me jump like they did way back when I first played. It was like they had come alive again.

FXO
09-04-2002, 11:14 AM
I was really impressed with how good Q1 looked with animation (and movement) interpolation.
However I cant remember the name of the mod I ran.

On the movement interpolation:
so the enemies moved in fixed steps?
I always thought that were the animated mesh moving..

Pentagram
09-04-2002, 11:51 AM
Hello

Hmm the pass saving idea for the generic version is wellcome http://www.opengl.org/discussion_boards/ubb/wink.gif as it is rather slow. I do 3 alpha square passes to archieve x^16.
Someone else mailed me with some info on using the EXT_blend_color extension to cut another pass on geforce2 hardware, I never really read about it here so it may be of interest to you: http://talika.fie.us.es/~titan/articles/blendcolor.html
Another one mailed me on doing interpolation in the register combiners instead of with textures.
(If enough people keep mailing me I might be able to do it in one pass on a geforce2 soon http://www.opengl.org/discussion_boards/ubb/wink.gif )
The only interpolation code I used from someone else was from quakeforge to determine the two frames to blend between. All the rest is "different" from the other quake blending codes. (It is all put into caches since doing 5 passes and blendng vertices every times would be "slow".) Shadow volumes are done by interpolating the plane equatations and then doing the normal stuff, tangent space is also blended between frames.
I also blend at about 40fps instead of full speed so that I can cache between frames if we go faster.
If you don't move your head too much everything comes out of caches most of the time.
I got 45 fps with this (public version is 33) but now it's 15 again since I added reflective-transparent water. http://www.opengl.org/discussion_boards/ubb/smile.gif (This will be off by default.)
Hmm movement interpolation, I suppose they are moved at the rate the server sends packets to the client. Wasn't there movement interpolation in QuakeWorld? It should be possible to lift it out of that.

Charles

FXO
09-07-2002, 04:28 AM
Ok, strangely I have never noticed that Q1 lacks movement interpolation, probably because Ive only played it over LAN.

The lack of movement interpolation shouldn't be visible in SP because Q1's server runs at the same rate as the client when playing SP, right?