FAQ  •  Register  •  Login

Doom 3 engine release and game code

Moderator: Inside3D Admins

<<

reckless

Posts: 1633

Joined: Thu Jan 24, 2008 12:04 pm

Location: inside tha debugger

Post Sat Nov 26, 2011 10:45 pm

Re: Doom 3 engine release and game code

hmm with all the different types and methods out there for doing the same thing without copying there part i wonder ... so the khronos group's own example for doing it might actually tread on copyrighted grounds :mrgreen:

had to do some guess work with your codepiece as the qglStencilOpSeparate seems to be an ATI extention i tried with standard two sided stencil but it needs some work.

  Code:
   
        if (external)
   {
      glDepthFunc (GL_LEQUAL);
      glEnable (GL_STENCIL_TEST_TWO_SIDE_EXT);

      // view outside the shadow volume
      qglActiveStencilFaceEXT(GL_BACK);
      qglStencilOp(GL_KEEP, tr.stencilIncr, tr.stencilIncr);
      qglStencilFunc(GL_ALWAYS, 0, ~0);

      // does the same as the GL_TwoSidedStencil functions part when checking for cull face.
      GL_Cull( CT_BACK_SIDED );

      qglActiveStencilFaceEXT(GL_FRONT);
      qglStencilOp(GL_KEEP, tr.stencilDecr, tr.stencilDecr);
      qglStencilFunc(GL_ALWAYS, 0, ~0);

      // does the same as the GL_TwoSidedStencil functions part when checking for cull face.
      GL_Cull( CT_FRONT_SIDED );

      RB_DrawShadowElementsWithCounters (tri, numIndexes);

      glDisable (GL_STENCIL_TEST_TWO_SIDE_EXT);
   }
   else
   {
      glDepthFunc (GL_GEQUAL);
      glEnable (GL_STENCIL_TEST_TWO_SIDE_EXT);

      // view inside the shadow volume
      qglActiveStencilFaceEXT(GL_BACK);
      qglStencilOp(GL_KEEP, tr.stencilDecr, tr.stencilDecr);
      qglStencilFunc(GL_ALWAYS, 0, ~0);

      // does the same as the GL_TwoSidedStencil functions part when checking for cull face.
      GL_Cull( CT_FRONT_SIDED );

      qglActiveStencilFaceEXT(GL_FRONT);
      qglStencilOp(GL_KEEP, tr.stencilIncr, tr.stencilIncr);
      qglStencilFunc(GL_ALWAYS, 0, ~0);

      // does the same as the GL_TwoSidedStencil functions part when checking for cull face.
      GL_Cull( CT_BACK_SIDED );

      RB_DrawShadowElementsWithCounters (tri, numIndexes);

      glDisable (GL_STENCIL_TEST_TWO_SIDE_EXT);
   }


its CT_TWO_SIDED when comming in here so face culling is off untill it hits this function.
Productivity is a state of mind.
<<

reckless

Posts: 1633

Joined: Thu Jan 24, 2008 12:04 pm

Location: inside tha debugger

Post Sat Nov 26, 2011 10:47 pm

Re: Doom 3 engine release and game code

hehe that might come in handy :)
Productivity is a state of mind.
<<

mh

User avatar

Posts: 2172

Joined: Sat Jan 12, 2008 1:38 am

Post Sun Nov 27, 2011 1:02 am

Re: Doom 3 engine release and game code

reckless wrote:qglStencilOpSeparate seems to be an ATI extention

Not if you've got OpenGL 2.0 or better, it's not even an extension in this case. You can just get the function pointer and use it.

  Code:
glStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC) GLimp_ExtensionPointer ("glStencilOpSeparate");

if (glStencilOpSeparate)
{
    // do stuff...
Like the fifth day of playing 24-hour Scrabble when you don't want to use any letters because each one means a world to you because you're so deranged.
<<

reckless

Posts: 1633

Joined: Thu Jan 24, 2008 12:04 pm

Location: inside tha debugger

Post Sun Nov 27, 2011 2:53 am

Re: Doom 3 engine release and game code

ok game crashes when using this atm which is imo weird since my card is opengl 4.1 capable :/ ill try again tomorrow.

the twosided version works but produces huge shadows (i think i need to turn of the last part of the old stencil code whoops).

ongoing work on widescreen formats and doing away with low res modes like 320x200 (heh ye its actually possible). lowest supported res will be 800x600 and upto the largest supported resolution today.
Productivity is a state of mind.
<<

leileilol

User avatar

Posts: 2400

Joined: Fri Oct 15, 2004 3:23 am

Post Sun Nov 27, 2011 4:15 am

Re: Doom 3 engine release and game code

I don't see the point of dropping low res. The FX5200 actually benefits alot from 320x240 in idtech4...
<<

r00k

Posts: 906

Joined: Sat Nov 13, 2004 10:39 pm

Post Sun Nov 27, 2011 6:04 am

Re: Doom 3 engine release and game code

Damn AND i just gave my fx5200 to the garbage man to use as a wedge to get the dumpster door open! Grr....
that card sucks more arse than a liposuction machine!
<<

leileilol

User avatar

Posts: 2400

Joined: Fri Oct 15, 2004 3:23 am

Post Sun Nov 27, 2011 7:04 am

Re: Doom 3 engine release and game code

Don't underestimate the large amount of self-entitled openBSD/freeBSD users that can't get a proper accelerated driver or even use modern video hardware
<<

Barnes

User avatar

Posts: 77

Joined: Thu Dec 24, 2009 2:26 pm

Location: Russia, Moscow

Post Sun Nov 27, 2011 10:18 am

Re: Doom 3 engine release and game code

mh wrote:Not if you've got OpenGL 2.0 or better, it's not even an extension in this case.


qglDisable(GL_CULL_FACE);

qglStencilOpSeparate(GL_BACK, GL_KEEP, GL_INCR_WRAP_EXT, GL_KEEP);
qglStencilOpSeparate(GL_FRONT, GL_KEEP, GL_DECR_WRAP_EXT, GL_KEEP);

RB_DrawShadowElementsWithCounters (tri, numIndexes);

qglEnable(GL_CULL_FACE);
<<

goldenboy

User avatar

Posts: 725

Joined: Fri Sep 05, 2008 11:04 pm

Location: Kiel

Post Sun Nov 27, 2011 11:33 am

Re: Doom 3 engine release and game code

There are downsides to ripping out stuff that was originally there for a reason.

For example the built-in editor's functionality is much better than standard Radiant. Anyone who makes Doom3 maps is going to use that editor. To be clear, GTK/Netradiant do NOT make the built in editor obsolete. If you rip it out, perhaps consider releasing a standalone Doom3 editor?

And why should people not run Doom3 in 640x480 windowed?
<<

mh

User avatar

Posts: 2172

Joined: Sat Jan 12, 2008 1:38 am

Post Sun Nov 27, 2011 12:21 pm

Re: Doom 3 engine release and game code

Barnes wrote:
mh wrote:Not if you've got OpenGL 2.0 or better, it's not even an extension in this case.


qglDisable(GL_CULL_FACE);

qglStencilOpSeparate(GL_BACK, GL_KEEP, GL_INCR_WRAP_EXT, GL_KEEP);
qglStencilOpSeparate(GL_FRONT, GL_KEEP, GL_DECR_WRAP_EXT, GL_KEEP);

RB_DrawShadowElementsWithCounters (tri, numIndexes);

qglEnable(GL_CULL_FACE);

That's the one. :D

The original used standard depth pass for cases where the view wasn't inside the volume (so that it could skip drawing the caps) so you need a test for that too, and you also need to flip the front and back faces if it's a mirror view.
Like the fifth day of playing 24-hour Scrabble when you don't want to use any letters because each one means a world to you because you're so deranged.
<<

Barnes

User avatar

Posts: 77

Joined: Thu Dec 24, 2009 2:26 pm

Location: Russia, Moscow

Post Sun Nov 27, 2011 12:32 pm

Re: Doom 3 engine release and game code

a schematic representation of the z-fail volumes (with caps) :)
z-pass (w/o caps) if i current remember

qglStencilOpSeparate(GL_BACK, GL_KEEP, GL_KEEP, GL_INCR_WRAP_EXT);
qglStencilOpSeparate(GL_FRONT, GL_KEEP, GL_KEEP, GL_DECR_WRAP_EXT);
<<

New Horizon

Posts: 6

Joined: Sat Nov 26, 2011 3:24 am

Post Sun Nov 27, 2011 1:03 pm

Re: Doom 3 engine release and game code

goldenboy wrote:There are downsides to ripping out stuff that was originally there for a reason.

For example the built-in editor's functionality is much better than standard Radiant. Anyone who makes Doom3 maps is going to use that editor. To be clear, GTK/Netradiant do NOT make the built in editor obsolete. If you rip it out, perhaps consider releasing a standalone Doom3 editor?

And why should people not run Doom3 in 640x480 windowed?


I know quite a few mappers have used our Dark Radiant to build D3 maps rather than D3Edit, but then again Dark Radiant has been heavily rewritten compared to what it was when we started working with the old GTK Radiant source code. It's a completely different beast now.
<<

reckless

Posts: 1633

Joined: Thu Jan 24, 2008 12:04 pm

Location: inside tha debugger

Post Sun Nov 27, 2011 2:39 pm

Re: Doom 3 engine release and game code

  Code:
   if (external)
   {
      qglDepthFunc (GL_LEQUAL);

      // view outside the shadow volume
      qglStencilOpSeparate (backEnd.viewDef->isMirror ? GL_FRONT : GL_BACK, GL_KEEP, GL_KEEP, tr.stencilIncr);
      qglStencilOpSeparate (backEnd.viewDef->isMirror ? GL_BACK : GL_FRONT, GL_KEEP, GL_KEEP, tr.stencilDecr);

      RB_DrawShadowElementsWithCounters (tri, numIndexes);
   }
   else
   {
      qglDepthFunc (GL_GEQUAL);

      // view inside the shadow volume
      qglStencilOpSeparate (backEnd.viewDef->isMirror ? GL_FRONT : GL_BACK, GL_KEEP, GL_KEEP, tr.stencilDecr);
      qglStencilOpSeparate (backEnd.viewDef->isMirror ? GL_BACK : GL_FRONT, GL_KEEP, GL_KEEP, tr.stencilIncr);

      RB_DrawShadowElementsWithCounters (tri, numIndexes);
   }


was the latest i tried before going to bed.

in regards to ripping out low res modes i could easily leave them in but i doubted anyone with recent hardware would see them as anything but an annoyance if thats not the case ill just leave them and then addd high res modes.
Productivity is a state of mind.
<<

toneddu2000

Posts: 320

Joined: Tue Feb 24, 2009 4:39 pm

Location: Italy

Post Sun Nov 27, 2011 7:01 pm

Re: Doom 3 engine release and game code

Is already possible to compile doom3 under Linux? And if yes, how? Little tutorial for newbiez? t*h*a*n*k*s! :)
<<

mh

User avatar

Posts: 2172

Joined: Sat Jan 12, 2008 1:38 am

Post Sun Nov 27, 2011 7:48 pm

Re: Doom 3 engine release and game code

Instructions are in the Readme. I can't say any more as I don't use Linux.
Like the fifth day of playing 24-hour Scrabble when you don't want to use any letters because each one means a world to you because you're so deranged.
PreviousNext

Return to General Programming

Who is online

Users browsing this forum: No registered users and 1 guest

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.
Icons provided by Aha Soft