Forum

Doom 3 engine release and game code

Discuss programming topics for any language, any source base. If it is programming related but doesn't fit in one of the below categories, it goes here.

Moderator: InsideQC Admins

Re: Doom 3 engine release and game code

Postby revelator » Tue Oct 15, 2013 2:25 pm

Thanks frag :)

guess ill have to change my nick to stoney now... :shock:
Productivity is a state of mind.
User avatar
revelator
 
Posts: 2533
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: Doom 3 engine release and game code

Postby AluminumHaste » Sun Oct 20, 2013 3:23 am

Good luck with your surgery!
Time to change your diet? Or is this more of a genetic thing?
My uncle had gall stones for years, changed his diet and has been good ever since, I hope it's something simple like that for you. He used to complain about pains all the time.
AluminumHaste
 
Posts: 2
Joined: Sun Feb 21, 2010 12:29 am

Re: Doom 3 engine release and game code

Postby revelator » Sun Oct 20, 2013 10:19 am

Gallstones seem to be genetic in my Family :S so ouch.

Im the first to get kidneystones though, might just be a fluke but damn how unfortunate can you get...
Productivity is a state of mind.
User avatar
revelator
 
Posts: 2533
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: Doom 3 engine release and game code

Postby revelator » Fri Nov 15, 2013 11:54 am

Surgery done, cant say i enjoy it atm :S compared to gallstone surgery this is hell... damn it hurts. Hope the end result is worth the pain.

Also bought 2x radeon R9 270X and yup doom3 will not run :S strangely enough prey will :shock: guess humanhead fixed the doom3 engine problem.
Productivity is a state of mind.
User avatar
revelator
 
Posts: 2533
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: Doom 3 engine release and game code

Postby qbism » Fri Nov 15, 2013 6:00 pm

Hope your pain doesn't last long, and hopefully you have some pills.
Radeon forever has issues but a new card won't play it??
User avatar
qbism
 
Posts: 1236
Joined: Thu Nov 04, 2004 5:51 am

Re: Doom 3 engine release and game code

Postby leileilol » Fri Nov 15, 2013 9:26 pm

reckless wrote:Also bought 2x radeon R9 270X and yup doom3 will not run :S strangely enough prey will :shock:

Tried an older atioglxx.dll? I've heard about this problem regarding Doom3 BFG Edition and even HD Radeons...

qbism wrote:Hope your pain doesn't last long, and hopefully you have some pills.
Radeon forever has issues but a new card won't play it??

There's never been a video card with mature bug-free drivers at launch. There would be so much delay otherwise that the card would be DoA on release...
i should not be here
leileilol
 
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Re: Doom 3 engine release and game code

Postby revelator » Sat Nov 16, 2013 12:42 am

Havent really had time to yank around with the driver yet, but ill try when i feel a lil better :).

New Card seems to = old Card when it comes to this problem unfortunatly :S

Btw the R9 270X is based on the pitcairn GPU so its actually not new :) they just crammed more ram and a lil higher clock speed into it.

Mines a TOXIC edition from Sapphire so has really good cooling compared to stock models, unfortunatly its also massive in size (larger than a 285 GTX ultra :shock: ).
Productivity is a state of mind.
User avatar
revelator
 
Posts: 2533
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: Doom 3 engine release and game code

Postby qbism » Wed Nov 20, 2013 3:10 pm

Could it be glsl syntax? For example, Barnes wrote a shader fix for Q2xp for ATI, can see on sourceforge. My trusty Mobility died recently so memory of ATI tricks is fading. I keep getting burned by HP (literally, thanks to poor cooling) but reconditioned HP/radeon pavilions are so cheap I keep coming back.
User avatar
qbism
 
Posts: 1236
Joined: Thu Nov 04, 2004 5:51 am

Re: Doom 3 engine release and game code

Postby revelator » Wed Nov 20, 2013 6:16 pm

Was the ol catalyst bug again :( rename Doom3.exe to something else and it works like a charm.
Wonder if they will ever fix that bug, its been haunting ATI since they changed the gui interface to NET.
Productivity is a state of mind.
User avatar
revelator
 
Posts: 2533
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: Doom 3 engine release and game code

Postby revelator » Wed Nov 20, 2013 6:18 pm

Btw radeonpro also fucks up doom3 (NET again sigh). If id know a bit more about gui coding i would change this crap to a QT interface and it cant go fast enough.
Productivity is a state of mind.
User avatar
revelator
 
Posts: 2533
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: Doom 3 engine release and game code

Postby revelator » Thu Nov 21, 2013 6:36 pm

Code: Select all
void RB_CreateSingleDrawInteractions(const drawSurf_t *surf, void (*DrawInteraction)(const drawInteraction_t *))
{
    const idMaterial   *surfaceShader = surf->material;
    const float         *surfaceRegs = surf->shaderRegisters;
    const viewLight_t   *vLight = backEnd.vLight;
    const idMaterial   *lightShader = vLight->lightShader;
    const float         *lightRegs = vLight->shaderRegisters;
    drawInteraction_t   inter;

    if (r_skipInteractions.GetBool() || !surf->geo || !surf->geo->ambientCache)
   {
      return;
   }

    // change the matrix and light projection vectors if needed
    if (surf->space != backEnd.currentSpace)
    {
        backEnd.currentSpace = surf->space;
        glLoadMatrixf(surf->space->modelViewMatrix);
    }

    // change the scissor if needed
    if (r_useScissor.GetBool() && !backEnd.currentScissor.Equals(surf->scissorRect))
    {
        backEnd.currentScissor = surf->scissorRect;

        glScissor(backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1,
                  backEnd.viewDef->viewport.y1 + backEnd.currentScissor.y1,
                  backEnd.currentScissor.x2 + 1 - backEnd.currentScissor.x1,
                  backEnd.currentScissor.y2 + 1 - backEnd.currentScissor.y1);
    }

    // hack depth range if needed
    if (surf->space->weaponDepthHack)
   {
      RB_EnterWeaponDepthHack();
   }

    if (surf->space->modelDepthHack)
   {
      RB_EnterModelDepthHack(surf->space->modelDepthHack);
   }
    inter.surf = surf;
    inter.lightFalloffImage = vLight->falloffImage;

    R_GlobalPointToLocal(surf->space->modelMatrix, vLight->globalLightOrigin, inter.localLightOrigin.ToVec3());
    R_GlobalPointToLocal(surf->space->modelMatrix, backEnd.viewDef->renderView.vieworg, inter.localViewOrigin.ToVec3());

    inter.localLightOrigin[3] = 0;
    inter.localViewOrigin[3] = 1;
    inter.ambientLight = lightShader->IsAmbientLight();

    // the base projections may be modified by texture matrix on light stages
    idPlane lightProject[4];

    for (int i = 0; i < 4; i++)
    {
        R_GlobalPlaneToLocal(surf->space->modelMatrix, backEnd.vLight->lightProject[i], lightProject[i]);
    }

    for (int lightStageNum = 0; lightStageNum < lightShader->GetNumStages(); lightStageNum++)
    {
        const shaderStage_t   *lightStage = lightShader->GetStage(lightStageNum);

        // ignore stages that fail the condition
        if (!lightRegs[lightStage->conditionRegister])
      {
         continue;
      }
        inter.lightImage = lightStage->texture.image;

        memcpy(inter.lightProjection, lightProject, sizeof(inter.lightProjection));

        // now multiply the texgen by the light texture matrix
        if (lightStage->texture.hasMatrix)
        {
            RB_GetShaderTextureMatrix(lightRegs, &lightStage->texture, backEnd.lightTextureMatrix);
            RB_BakeTextureMatrixIntoTexgen(reinterpret_cast<class idPlane *>(inter.lightProjection), backEnd.lightTextureMatrix);
        }
        inter.bumpImage = NULL;
        inter.specularImage = NULL;
        inter.diffuseImage = NULL;

        inter.diffuseColor[0] = inter.diffuseColor[1] = inter.diffuseColor[2] = inter.diffuseColor[3] = 0;
        inter.specularColor[0] = inter.specularColor[1] = inter.specularColor[2] = inter.specularColor[3] = 0;

        float lightColor[4];

        lightColor[0] = backEnd.lightScale * lightRegs[lightStage->color.registers[0]];
        lightColor[1] = backEnd.lightScale * lightRegs[lightStage->color.registers[1]];
        lightColor[2] = backEnd.lightScale * lightRegs[lightStage->color.registers[2]];
        lightColor[3] = lightRegs[lightStage->color.registers[3]];

        // go through the individual stages
        for (int surfaceStageNum = 0; surfaceStageNum < surfaceShader->GetNumStages(); surfaceStageNum++)
        {
            const shaderStage_t   *surfaceStage = surfaceShader->GetStage(surfaceStageNum);

            switch (surfaceStage->lighting)
            {
                case SL_AMBIENT:
                {
                    // ignore ambient stages while drawing interactions
                    break;
                }
                case SL_BUMP:
                {
                    // ignore stage that fails the condition
                    if (!surfaceRegs[surfaceStage->conditionRegister])
                    {
                  // fix for POM initialize the matrix even if no stage.
                  inter.bumpMatrix[0][0] = 1;
                  inter.bumpMatrix[0][1] = 0;
                  inter.bumpMatrix[0][2] = 0;
                  inter.bumpMatrix[0][3] = 0;

                  inter.bumpMatrix[1][0] = 0;
                  inter.bumpMatrix[1][1] = 1;
                  inter.bumpMatrix[1][2] = 0;
                  inter.bumpMatrix[1][3] = 0;
                        break;
                    }

                    // draw any previous interaction
                    RB_SubmitInteraction(&inter, DrawInteraction);

                    inter.diffuseImage = NULL;
                    inter.specularImage = NULL;

                    R_SetDrawInteraction(surfaceStage, surfaceRegs, &inter.bumpImage, inter.bumpMatrix, NULL);
                    break;
                }
                case SL_DIFFUSE:
                {
                    // ignore stage that fails the condition
                    if (!surfaceRegs[surfaceStage->conditionRegister])
                    {
                  // fix for POM initialize the matrix even if no stage.
                  inter.diffuseMatrix[0][0] = 1;
                  inter.diffuseMatrix[0][1] = 0;
                  inter.diffuseMatrix[0][2] = 0;
                  inter.diffuseMatrix[0][3] = 0;

                  inter.diffuseMatrix[1][0] = 0;
                  inter.diffuseMatrix[1][1] = 1;
                  inter.diffuseMatrix[1][2] = 0;
                  inter.diffuseMatrix[1][3] = 0;
                        break;
                    }

                    if (inter.diffuseImage)
                    {
                        RB_SubmitInteraction(&inter, DrawInteraction);
                    }
                    R_SetDrawInteraction(surfaceStage, surfaceRegs, &inter.diffuseImage, inter.diffuseMatrix, inter.diffuseColor.ToFloatPtr());

                    inter.diffuseColor[0] *= lightColor[0];
                    inter.diffuseColor[1] *= lightColor[1];
                    inter.diffuseColor[2] *= lightColor[2];
                    inter.diffuseColor[3] *= lightColor[3];
                    inter.vertexColor = surfaceStage->vertexColor;
                    break;
                }
                case SL_SPECULAR:
                {
                    // ignore stage that fails the condition
                    if (!surfaceRegs[surfaceStage->conditionRegister])
                    {
                  // fix for POM initialize the matrix even if no stage.
                  inter.specularMatrix[0][0] = 1;
                  inter.specularMatrix[0][1] = 0;
                  inter.specularMatrix[0][2] = 0;
                  inter.specularMatrix[0][3] = 0;

                  inter.specularMatrix[1][0] = 0;
                  inter.specularMatrix[1][1] = 1;
                  inter.specularMatrix[1][2] = 0;
                  inter.specularMatrix[1][3] = 0;
                        break;
                    }

                    if (inter.specularImage)
                    {
                        RB_SubmitInteraction(&inter, DrawInteraction);
                    }
                    R_SetDrawInteraction(surfaceStage, surfaceRegs, &inter.specularImage, inter.specularMatrix, inter.specularColor.ToFloatPtr());

                    inter.specularColor[0] *= lightColor[0];
                    inter.specularColor[1] *= lightColor[1];
                    inter.specularColor[2] *= lightColor[2];
                    inter.specularColor[3] *= lightColor[3];
                    inter.vertexColor = surfaceStage->vertexColor;
                    break;
                }
            }
        }

        // draw the final interaction
        RB_SubmitInteraction(&inter, DrawInteraction);
    }

    // unhack depth range if needed
    if (surf->space->weaponDepthHack || surf->space->modelDepthHack != 0.0f)
    {
        RB_LeaveDepthHack();
    }
}


Fix for Parallax occlusion mapping fucking up decals, also posted at doom3 world. It works but its not pretty. Does not fix the sliding some surfaces exhibit. Still need a new material stage for that so only surfaces fit for the parallax effect gets it.
Productivity is a state of mind.
User avatar
revelator
 
Posts: 2533
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: Doom 3 engine release and game code

Postby goldenboy » Fri Nov 22, 2013 11:23 am

Man, reckless, didn't see this earlier... hope you get well soon.
User avatar
goldenboy
 
Posts: 924
Joined: Fri Sep 05, 2008 11:04 pm
Location: Kiel

Re: Doom 3 engine release and game code

Postby revelator » Fri Nov 22, 2013 3:53 pm

Np gb :) surgery done and besides a rather unpleasant week im all ok again. Not looking forward to having the kateter removed though :S.

Moved the fix to the material parser and set the initial stage for the matrices before parsing.
Still a few things to iron out the fix does not work for DDS textures hmm ???
Productivity is a state of mind.
User avatar
revelator
 
Posts: 2533
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: Doom 3 engine release and game code

Postby revelator » Sun Nov 24, 2013 9:59 pm

Ok Sikkpin helped getting the code working correctly heres the final version.

Code: Select all
static void RB_SubmitInteraction(drawInteraction_t *din, void (*DrawInteraction)(const drawInteraction_t *))
{
    if (!din->bumpImage)
    {
        // if no bumpmap then we dont have diffuse or specular either.
        // initialize the matrices to a default value.
        din->diffuseMatrix[0][0] = 1;
        din->diffuseMatrix[0][1] = 0;
        din->diffuseMatrix[0][2] = 0;
        din->diffuseMatrix[0][3] = 0;
        din->diffuseMatrix[1][0] = 0;
        din->diffuseMatrix[1][1] = 1;
        din->diffuseMatrix[1][2] = 0;
        din->diffuseMatrix[1][3] = 0;
        din->specularMatrix[0][0] = 1;
        din->specularMatrix[0][1] = 0;
        din->specularMatrix[0][2] = 0;
        din->specularMatrix[0][3] = 0;
        din->specularMatrix[1][0] = 0;
        din->specularMatrix[1][1] = 1;
        din->specularMatrix[1][2] = 0;
        din->specularMatrix[1][3] = 0;
        din->bumpMatrix[0][0] = 1;
        din->bumpMatrix[0][1] = 0;
        din->bumpMatrix[0][2] = 0;
        din->bumpMatrix[0][3] = 0;
        din->bumpMatrix[1][0] = 0;
        din->bumpMatrix[1][1] = 1;
        din->bumpMatrix[1][2] = 0;
        din->bumpMatrix[1][3] = 0;
        return;
    }

    if (!din->diffuseImage || r_skipDiffuse.GetBool())
    {
        din->diffuseMatrix[0][0] = 1;
        din->diffuseMatrix[0][1] = 0;
        din->diffuseMatrix[0][2] = 0;
        din->diffuseMatrix[0][3] = 0;
        din->diffuseMatrix[1][0] = 0;
        din->diffuseMatrix[1][1] = 1;
        din->diffuseMatrix[1][2] = 0;
        din->diffuseMatrix[1][3] = 0;
        din->diffuseImage = globalImages->blackImage;
    }

    if (!din->specularImage || r_skipSpecular.GetBool() || din->ambientLight)
    {
        din->specularMatrix[0][0] = 1;
        din->specularMatrix[0][1] = 0;
        din->specularMatrix[0][2] = 0;
        din->specularMatrix[0][3] = 0;
        din->specularMatrix[1][0] = 0;
        din->specularMatrix[1][1] = 1;
        din->specularMatrix[1][2] = 0;
        din->specularMatrix[1][3] = 0;
        din->specularImage = globalImages->blackImage;
    }

    if (!din->bumpImage || r_skipBump.GetBool())
    {
        din->bumpMatrix[0][0] = 1;
        din->bumpMatrix[0][1] = 0;
        din->bumpMatrix[0][2] = 0;
        din->bumpMatrix[0][3] = 0;
        din->bumpMatrix[1][0] = 0;
        din->bumpMatrix[1][1] = 1;
        din->bumpMatrix[1][2] = 0;
        din->bumpMatrix[1][3] = 0;
        din->bumpImage = globalImages->flatNormalMap;
    }

    if (r_lightMap.GetBool())
    {
        din->diffuseImage = globalImages->whiteImage;
        din->specularImage = globalImages->blackImage;
        din->bumpImage = globalImages->flatNormalMap;
    }

    // if we wouldn't draw anything, don't call the Draw function
    if (((din->diffuseColor[0] > 0 ||
          din->diffuseColor[1] > 0 ||
          din->diffuseColor[2] > 0) && din->diffuseImage != globalImages->blackImage) ||
        ((din->specularColor[0] > 0 ||
          din->specularColor[1] > 0 ||
          din->specularColor[2] > 0) && din->specularImage != globalImages->blackImage))
    {
        DrawInteraction(din);
    }
}


replace the old function with this and decals will look like they should again with parallax mapping :)

Does not however fix the sliding surfaces with parallax but sikkpins offset limited version looks really good now.
Productivity is a state of mind.
User avatar
revelator
 
Posts: 2533
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: Doom 3 engine release and game code

Postby raynorpat » Wed Feb 05, 2014 9:13 am

Mini-bump

Got most of the BFG GLSL backend merged into standard Doom 3.

https://github.com/raynorpat/morpheus

It won't work on integrated Intel GPUs just yet, I think Intel's compatibility context is being ass, but should work once most of the deprecated calls go away and the compatibility context is migrated to a core OpenGL context.
raynorpat
 
Posts: 27
Joined: Tue Feb 26, 2008 12:21 am
Location: USA

PreviousNext

Return to General Programming

Who is online

Users browsing this forum: No registered users and 1 guest