qbismSuper8 builds

Discuss programming topics for the various GPL'd game engine sources.
leileilol
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Re: qbismSuper8 builds

Post by leileilol »

You know how sometimes a lightmap would appear jagged?

What if one of those popular scaler algorithms (i.e. HQ2X) worked in SurfMipBlock, creating straight lines of shadows and other curved smoothness? It would make updating dynamic lights very expensive though :P

btw qbism, any strange reason why you didn't use GrabColormap2 from qlumpy instead? Despite the "not used in quake" comment, that function actually is used to generate the colormap for Quake 1.0x.
i should not be here
qbism
Posts: 1236
Joined: Thu Nov 04, 2004 5:51 am
Contact:

Re: qbismSuper8 builds

Post by qbism »

I never paid attention the difference between GrabColormap2 and GrabColormap before:

GrabColormap
frac = 1.0 - (float)l/(levels-1);

GrabColormap2
frac = range - range*(float)l/(levels-1);

Super8
frac = 1.05 - (frac * frac);

Squaring frac gives a gamma boost to brightness component, which improves blending with the hue component in some places. The "1.05" was eyeballed at some point. It would be a good place for a cvar. (Super8 converts .lit RGB to indexed hues. )

Scaling algorithm would either be a speed hit or memory hit. Devote 4x memory to lightmap and hqx2 entire thing at time of upload.
mankrip
Posts: 924
Joined: Fri Jul 04, 2008 3:02 am

Re: qbismSuper8 builds

Post by mankrip »

Lightmaps are actually smaller than the textures; the engine scales them up when caching surfaces, so leileilol's suggestion makes sense. This wouldn't require more memory, but would make the lightmaps much slower to cache.
Ph'nglui mglw'nafh mankrip Hell's end wgah'nagl fhtagn.
==-=-=-=-=-=-=-=-=-=-==
Dev blog / Twitter / YouTube
qbism
Posts: 1236
Joined: Thu Nov 04, 2004 5:51 am
Contact:

Re: qbismSuper8 builds

Post by qbism »

I'm talking about reducing the block size to 8x8.
qbism
Posts: 1236
Joined: Thu Nov 04, 2004 5:51 am
Contact:

Re: qbismSuper8 builds

Post by qbism »

Image

Massively annoying "windowed mode stuck off-screen" bug fixed. http://sourceforge.net/projects/qbism/f ... p/download
Hope it works for everyone. Thanks to Mankrip and Baker discussion and improvement http://forums.inside3d.com/viewtopic.php?f=3&t=5087

new vid, Tormentarium map with custom palette (torment.lmp included in distro .pak) http://youtu.be/JC09stMpKSo

I don't know if it's a ddraw thing or just super8, but super8 requires entire draw window to be onscreen to avoid getting stuck, so it checks every frame.

One user reported a bug I can't duplicate... anyone had this problem: "It’s looking really good but for some strange reason I’m still getting that weird timing error when I mess with max framerate. I’ve cleared out all configs and settings between events but it seems once it’s stuck in ‘benny hill’ mode it just stays that way for a long time, then goes back to normal for a bit, then fast again. intel p6100 2.0ghz notebook processor, the computer is an Asus Notebook K52f running Windows 7 x64"
qbism
Posts: 1236
Joined: Thu Nov 04, 2004 5:51 am
Contact:

Re: qbismSuper8 builds

Post by qbism »

Build 123 released. Fixed pixel aspect, shading in dark areas, and view direction on spawn. Added r_nolerp_list (torch animation doesn't lerp). The pak features bent palettes created by Amon26. Do "r_palette amon26_pal01" and "restart" for example.

Current super8 build:
https://sourceforge.net/projects/qbism/ ... urce=files
Image
ne_ruins with amon26_pal14
qbism
Posts: 1236
Joined: Thu Nov 04, 2004 5:51 am
Contact:

Re: qbismSuper8 builds

Post by qbism »

unrolling mips

Code: Select all

/*
================
R_DrawSurfaceBlock8_mip0
================
*/
void R_DrawSurfaceBlock8_mip0 (void)
{
    int		v, i, b, lightstep, lighttemp, light;
    int     colorleft, colorright; //qb: indexed lit
    byte	*psource, *prowdest;

    psource = pbasesource;
    prowdest = prowdestbase;

    for (v=0 ; v<r_numvblocks ; v++)
    {
        // FIXME: use delta rather than both right and left, like ASM?
        lightleft = r_lightptr[0];
        lightright = r_lightptr[1];
        r_lightptr += r_lightwidth;
        lightleftstep = (r_lightptr[0] - lightleft) >> 4;
        lightrightstep = (r_lightptr[1] - lightright) >> 4;
        colorleft = r_colorptr[0];
        colorright = r_colorptr[1];

        for (i=0 ; i<16 ; i++)
        {
            lighttemp = lightleft - lightright;
            lightstep = lighttemp >> 4;
            light = lightright;

            if (r_coloredlights.value)
            {
                prowdest[15] = vidcolmap[(light & 0xFF00) + lightcolormap[psource[15]*256 + colorright]];
                light += lightstep;
                prowdest[14] = vidcolmap[(light & 0xFF00) + lightcolormap[psource[14]*256 + colorright]];
                light += lightstep;
                prowdest[13] = vidcolmap[(light & 0xFF00) + lightcolormap[psource[13]*256 + colorright]];
                light += lightstep;
                prowdest[12] = vidcolmap[(light & 0xFF00) + lightcolormap[psource[12]*256 + colorright]];
                light += lightstep;
                prowdest[11] = vidcolmap[(light & 0xFF00) + lightcolormap[psource[12]*256 + colorright]];
                light += lightstep;

                prowdest[10] = vidcolmap[(light & 0xFF00)+ lightcolormap[psource[10]*256 + r_colorptr[dithercolor[light%41]]]];
                light += lightstep;
                prowdest[9] = vidcolmap[(light & 0xFF00)+ lightcolormap[psource[9]*256 + r_colorptr[dithercolor[light%41]]]];
                light += lightstep;
                prowdest[8] = vidcolmap[(light & 0xFF00)+ lightcolormap[psource[8]*256 + r_colorptr[dithercolor[light%41]]]];
                light += lightstep;
                prowdest[7] = vidcolmap[(light & 0xFF00)+ lightcolormap[psource[7]*256 + r_colorptr[dithercolor[light%41]]]];
                light += lightstep;
                prowdest[6] = vidcolmap[(light & 0xFF00)+ lightcolormap[psource[6]*256 + r_colorptr[dithercolor[light%41]]]];
                light += lightstep;
                prowdest[5] = vidcolmap[(light & 0xFF00)+ lightcolormap[psource[5]*256 + r_colorptr[dithercolor[light%41]]]];
                light += lightstep;

                prowdest[4] = vidcolmap[(light & 0xFF00) + lightcolormap[psource[4]*256 + colorleft]];
                light += lightstep;
                prowdest[3] = vidcolmap[(light & 0xFF00) + lightcolormap[psource[3]*256 + colorleft]];
                light += lightstep;
                prowdest[2] = vidcolmap[(light & 0xFF00) + lightcolormap[psource[2]*256 + colorleft]];
                light += lightstep;
                prowdest[1] = vidcolmap[(light & 0xFF00) + lightcolormap[psource[1]*256 + colorleft]];
                light += lightstep;
                prowdest[0] = vidcolmap[(light & 0xFF00) + lightcolormap[psource[0]*256 + colorleft]];
                light += lightstep;
            }
            else
            {
                prowdest[15] = vidcolmap[(light & 0xFF00) + psource[15]];
                light += lightstep;
                prowdest[14] = vidcolmap[(light & 0xFF00) + psource[14]];
                light += lightstep;
                prowdest[13] = vidcolmap[(light & 0xFF00) + psource[13]];
                light += lightstep;
                prowdest[12] = vidcolmap[(light & 0xFF00) + psource[12]];
                light += lightstep;
                prowdest[11] = vidcolmap[(light & 0xFF00) + psource[11]];
                light += lightstep;
                prowdest[10] = vidcolmap[(light & 0xFF00) + psource[10]];
                light += lightstep;
                prowdest[9] = vidcolmap[(light & 0xFF00) + psource[9]];
                light += lightstep;
                prowdest[8] = vidcolmap[(light & 0xFF00) + psource[8]];
                light += lightstep;
                prowdest[7] = vidcolmap[(light & 0xFF00) + psource[7]];
                light += lightstep;
                prowdest[6] = vidcolmap[(light & 0xFF00) + psource[6]];
                light += lightstep;
                prowdest[5] = vidcolmap[(light & 0xFF00) + psource[5]];
                light += lightstep;
                prowdest[4] = vidcolmap[(light & 0xFF00) + psource[4]];
                light += lightstep;
                prowdest[3] = vidcolmap[(light & 0xFF00) + psource[3]];
                light += lightstep;
                prowdest[2] = vidcolmap[(light & 0xFF00) + psource[2]];
                light += lightstep;
                prowdest[1] = vidcolmap[(light & 0xFF00) + psource[1]];
                light += lightstep;
                prowdest[0] = vidcolmap[(light & 0xFF00) + psource[0]];
                light += lightstep;
            }

            psource += sourcetstep;
            lightright += lightrightstep;
            lightleft += lightleftstep;
            prowdest += surfrowbytes;
        }
        r_colorptr += r_lightwidth; //qb: indexed colored

        if (psource >= r_sourcemax)
            psource -= r_stepback;
    }
}
leileilol
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Re: qbismSuper8 builds

Post by leileilol »

Why are you getting a cvar value within a loop


I would put the cvar check in R_DrawSurface then check appropriately for the pblockdrawer that would house the colored lighting mips, it's faster that way.

I would also turn that into a global int and have that int changed on the model.c loading functions for sanity checking
i should not be here
qbism
Posts: 1236
Joined: Thu Nov 04, 2004 5:51 am
Contact:

Re: qbismSuper8 builds

Post by qbism »

leileilol wrote:Why are you getting a cvar value within a loop


I would put the cvar check in R_DrawSurface then check appropriately for the pblockdrawer that would house the colored lighting mips, it's faster that way.

I would also turn that into a global int and have that int changed on the model.c loading functions for sanity checking
Thanks, I'll do both ideas. I used to have it even worse, the cvar was one loop deeper.
dreadlorde
Posts: 268
Joined: Tue Nov 24, 2009 2:20 am
Contact:

Re: qbismSuper8 builds

Post by dreadlorde »

Any chance of support for resolutions such as 1920x1080?
Ken Thompson wrote:One of my most productive days was throwing away 1000 lines of code.
Get off my lawn!
leileilol
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Re: qbismSuper8 builds

Post by leileilol »

type vid_describemodes. 1920x1080 should be like, vid_mode 21
i should not be here
taniwha
Posts: 401
Joined: Thu Jan 14, 2010 7:11 am
Contact:

Re: qbismSuper8 builds

Post by taniwha »

If a bit of code duplication doesn't bother you (and you have cvar callbacks), a global function pointer is better than a global int. Then the cvar can select the appropriate function. If you don't have callbacks, then checking the global (or cvar) before calling the function is almost as good. The less branches in your inner loop, the better (but certainly, don't go checking global vars, or worse, cvars!).

Also, if your compiler is good with inline functions, you can put most of the logic into a set of such and then the separate functions selected by the cvar are just a series of inlined calls to the functions, with the calls for the selectable functionality different.

eg: (functions selected by if for simplicity)

Code: Select all

static inline void func1() {...}
static inline void func2a() {...}
static inline void func2b() {...}
static inline void func3() {...}

void func_a ()
{
    while (condition) {
        func1();
        func2a();
        func3();
    }
}

void func_b ()
{
    while (condition) {
        func1();
        func2b();
        func3();
    }
}

void func()
{
    if (cvar) func_a();
    else func_b();
}
Leave others their otherness.
http://quakeforge.net/
qbism
Posts: 1236
Joined: Thu Nov 04, 2004 5:51 am
Contact:

Re: qbismSuper8 builds

Post by qbism »

Duplicating code indeed means faster execution here by pulling out the if-statement. In the case of colored lighting, a sanity check (locked cvar, global int, or boolean) is still required before selecting the function. Super8 doesn't have cvar callbacks but it would be handy in several areas.
qbism
Posts: 1236
Joined: Thu Nov 04, 2004 5:51 am
Contact:

Re: qbismSuper8 builds

Post by qbism »

Another incremental change to colored light dithering and rendering.
Build 134: https://sourceforge.net/projects/qbism/ ... urce=files
Image
map: tuhnu2 by zaka
r00k
Posts: 1111
Joined: Sat Nov 13, 2004 10:39 pm

Re: qbismSuper8 builds

Post by r00k »

:O looks NICE!
Post Reply