PDA

View Full Version : My visulally enhanced renderer for Quake2



Chebmaster
29-07-2007, 03:27 PM
Home page >> (http://www.chebmaster.com/q2facelift/)


] ======= WHAT IT DOES ==================================== [

This MOD greatly enhances the visulal quality of Quake 2,
it upsamples all the game textures using the
powerful Lanczos filter specially designed
to increase the visual quality of the resampled image.

The original Quake2 renderer DOWNsamples the textures
to fit the weak 3d accelerators of its days,
using a visually degrading linear filter at that.
So, I can say, the original renderer
MUTILATES the game art turning it into a blurry crap.

It's not Carmack's fault, it's just the harsh reality
of the late 20th century hardware. Keep in mind that
the monsters of Quake2 were intended for *software*
rendering, their non-power-of-two skins are proof enough.

Screenshots comparing the original renderer with my enhancement:

http://host-17-99.imsys.net/_share/_001/q2_facelift.jpg



] ======= REQUIREMENTS ==================================== [

1. Original quake2.exe v3.21. Alternately, you can use
a custom-built quake2.exe, just don't forget to set the
stack limit to at least 16 Mbytes.

2. A video card that supports the S3 texture compression
and has 32Mbytes of memory or more.
I think, even GeForce 2 will do.

3. It works with all mission packs, including "Ground Zero"!




] ======= INSTALLATION ==================================== [

1. Back up your quake2.exe and ref_gl.dll, just in case.

2. Copy stackhack.exe and ref_gl.dll to your Quake 2 folder,
replacing the original ref_gl.dll

3. Run stackhack to patch quake2.exe. This should take
care of the stack overflow crash.

4. Start your Quake 2 and enjoy ^_^




] ======= NOTES ON USAGE ================================== [

1. The "use 8 bit textures" option switches off the texture filtering making the image look more pixellated.
The mipmapping is disabled, the gl_texturemode variable is ignored. Use the option above to switch between GL_LINEAR and GL_NEAREST.

2. The texture quality slider in Q2 (which does have 4 positions) greatly affects the texture quality, just like it does in the original renderer. The lowest setting limits texture size to 256x256 (just like the original).
At the maximum quality most of the wall textures and monster skins are upsampled to 1024x1024.
This setting also controls the power of the underwater warping/blurring effect.

3. The video modes below 640x480 are substituted with your desktop default.

4. The menus and GUI are scaled up in the high resolution video modes.



] ======= THANKS ========================================== [

1. To Jan Horn (R.I.P) and everyone who did the Quake2
to Delphi conversion. This renderer is compiled
using Turbo Delphi Explorer.

2. To Marek Mauder for his powerful Vampyre Imaging library,
native to Pascal and available as sources.

czar
29-07-2007, 07:31 PM
The image is not showing. I tried looking on your website but there seems to be nothing about quake 2.

Chebmaster
29-07-2007, 08:15 PM
Sorry, just now had a downtime due to fsck bitching that it should be started manually and having a good time checking my hard drive. It seems the Windows XP Ext2 driver often trashes my Linux partition.

Try again please. :oops:

It's not on my website yet, only in the temp dir on my home web server (that also holds a mirror of my home page).

The problem is I need to reboot in Windows (where Delphi lives) each time I need to recompile this stuff, then reboot back in Linux.

czar
29-07-2007, 08:25 PM
The enhancement is rather impressive. Nice work.

technomage
29-07-2007, 09:42 PM
Very impressive :)

Chebmaster
29-07-2007, 10:10 PM
I glad you liked it. :D It was my dream for many years to fix that bug-feature of Q2. And now I achieved that dream - using Pascal, not less! 8)

For the future, I plan, if I manage to find time for that, to add the replacement for the software shader used in Q1 and Q2 software mode under water (blur + distortion). It was also lost because Voodoos were unable to do such things...

I also plan to add a page on my web site for such things.
For now, here's the folder containing the before/after screenshots, for comparsion:
http://host-17-99.imsys.net/_share/_001/_q/

Chebmaster
29-07-2007, 10:23 PM
P.S. Just noticed, there is a minor bug with the sky being a bit too bright - It's because it was exempt from any processing but I put it through the same pipeline as the other textures, and it gets affected by the procedure that controls brightness... I'll fix that later.

Also note to self to move that brightening stage to *before* resampling, the loading times are unacceptably long as it is now.

P.P.S Also fixed the bug in original DelphiQuake caused by erroneous conversion ( += translated as := ) that caused corruption on the polygons affected by more than one light map.

Traveler
30-07-2007, 07:13 AM
Very impressive :)

ditto :thumbup:

wodzu
30-07-2007, 07:33 AM
Great job :shock:

User137
30-07-2007, 03:38 PM
Quake 2 shows blackscreen and ends without a message. Game did work before the replacement.

Copied all files and applied stackhack, used graphics card is Radeon 9200. (At least it runs World of Warcraft with my 512 memory and 933Mhz :twisted: Time to get new comp somepoint soon)

Chebmaster
30-07-2007, 04:53 PM
Well... I didn't apply any checks for extensions availability, neither any error reporting mechanism. For now it just blindly assumes and tries to use.

Or maybe it's the patch is incompatible with your *.exe.
I'll investigate this problem when I find some time. Hopefully, soon.

Chebmaster
30-07-2007, 05:02 PM
For the starters, is your quake2.exe 362,496 bytes in size, dated October 19, 1998 ? If it's some later version (I heard, there is .NET one floating around), the MOD won't fit.

User137
31-07-2007, 01:43 PM
No this one is 291,328 bytes and dated 7.12.1997. Good point though, i'll try different patches:
q2-3.20-x86-full-ctf.exe for the moment under download, will keep this post updated.

edit: This patch made it work, like in your screenshots :) Only bothering thing is laggy main menu and long loading times.

Paizo
31-07-2007, 02:41 PM
good job dude :)

Chebmaster
31-07-2007, 05:49 PM
Only bothering thing is laggy main menu and long loading times.

The outrageous loading times - It could, and will, be easily corrected - when I get my hands free. Currently a bit too busy at my work. :(

The lags in main menu - I have some idea. The engine has procedures for loading all the GUI pieces into one texture for speed. Now, when they get upsampled x4, they probably won't fit anymore and get reloaded into the texture memory every frame. I'll look into it too.


No this one is 291,328 bytes and dated 7.12.1997
Whoopsie... :oops: I obviously need to make stackhack smarter, to at least check the exe before patching it.

Chebmaster
05-08-2007, 06:06 PM
:D A new home page of the project
http://www.chebmaster.com/q2facelift/


The version there is a new one.

- the menus/HUD are stretched larger in the high-res video modes
- the underwater warping/blurring effect is back! Welcome it, people :twisted:
- the particles rendering mechanism changed, now the particle effects' look doesn't depend on resolution anymore. The code had already been there, I just tweaked it a bit.
- the stackhack is smarter now.

Chebmaster
15-03-2017, 11:52 AM
A modification to Quake 2 Delphi that uses Vampyre Imaging to upsample textures using Lanczos filter.

The Lanczos filter gives most visually pleasing results of all upsampling filters. The performance hit is minimal as textures are upsampled during loading (which slows loading a lot).

Also fixed one bug with lighting caused by incorrect porting from C and added blurring / warping the view underwater similar to what happens in software renderer of Q2 and Q1.

I am sorry to say this but it doesn't recognize wide screen monitors, assuming it'll always be 4:3 :(

The current page
http://chebmaster.com/q2facelift/

http://chebmaster.com/q2facelift/samoreklama2.jpg

The most ancient fossil of that page
http://web.archive.org/web/20071203204023/http://chebmaster.narod.ru/q2facelift/index_ru.html

Sources are included, BUT in delta form, i.e. only the files modified relative to the original Quake2 Delphi sources which you'd have to get elsewhere. You also have to provide Vampyre imaging sources.
I haven't compiled this since 2008.
Needs Turbo Delphi (or, possibly, Delphi 2006?) to build.
Win32 renderer DLL included.

Chebmaster
15-03-2017, 12:02 PM
P.S. Oops, I forgot I already had a thread for it :( http://www.pascalgamedevelopment.com/showthread.php?4312-My-visulally-enhanced-renderer-for-Quake2

P.P.S. But... but... but... I used Search to make sure there was no such thread! :(...

SilverWarior
15-03-2017, 05:52 PM
P.S. Oops, I forgot I already had a thread for it :( http://www.pascalgamedevelopment.com/showthread.php?4312-My-visulally-enhanced-renderer-for-Quake2

I have merged your new thread with the old one.
There is still temporary redirect from new to merged thread that will disappear in 1 week time. So don't be alarmed if for now you still see both of them.

Ñuño Martínez
17-03-2017, 06:54 PM
Really impressive. Good work.

Chebmaster
02-12-2020, 10:10 AM
Full sources (including the entire Quake2 Delphi) found in one of my file dumps

http://chebmaster.com/_share/_001/_003/q_fclift_src/q_fclift_src.tgz

Forum pages detailing my modifications to the texture handling routines:
https://gamedev.ru/code/forum/?id=68117&m=1033063#m4
https://gamedev.ru/code/forum/?id=68117&m=1033065#m5
(other ones, like the underwater blur, are not listed)

Ñuño Martínez
04-12-2020, 10:34 AM
In Russian.;)

I played OpenArena (Quake3 based). That's all I can say. :P

[edit] I forgot that I yet commented in this thread. :-X

Chebmaster
06-12-2020, 07:14 AM
:)
I still use my modified renderer DLL with Quake2 in my Steam library. Sometimes it updates and I have to re-inject it.
Works with all expansions (DLCs people call them today) but glitches on some skyboxes.

I also had fixed one conversion bug in lightmap upload code, all places where there was a pre-baked dynamic light affecting the map, it looked ugly (only that light taking effect on almost-black polygons). That was because this:

for (i=0 ; i<size ; i++, bl+=3 )
{
bl[0] += lightmap[i*3+0];
bl[1] += lightmap[i*3+1];
bl[2] += lightmap[i*3+2];
}
was translated to this:

for i := 0 to size - 1 do
begin
bl[0] := lightmap[i * 3 + 0];
bl[1] := lightmap[i * 3 + 1];
bl[2] := lightmap[i * 3 + 2];
inc(pSingle(bl), 3);
end;
, which I corrected to this:

for i := 0 to size - 1 do
begin
bl[0] := bl[0] + lightmap[i * 3 + 0];
bl[1] := bl[1] + lightmap[i * 3 + 1];
bl[2] := bl[2] + lightmap[i * 3 + 2];
inc(pSingle(bl), 3);
end;
and the lightmaks worked as designed.

Jimmy Valavanis
20-12-2020, 08:49 AM
Thanks for sharing!