Doom 3 engine release and game code
Moderator: InsideQC Admins
Re: Doom 3 engine release and game code
What is the target PC your are trying to boost performance for?
- motorsep
- Posts: 231
- Joined: Wed Aug 02, 2006 11:46 pm
- Location: Texas, USA
Re: Doom 3 engine release and game code
atm my own i7 950 +2x 560 gtx in sli and 24 gig system ram.
Yeah might seem like a lost cause with a monster like that
but with all the eyecandy on + sikkmod even this rig crawls hehe.
So im not lying when i say that crysis has no beat on the doom3 engine
in fact one might consider the crysis engine to be rather nicely optmized for the amount of detail its capable of.
Yeah might seem like a lost cause with a monster like that
So im not lying when i say that crysis has no beat on the doom3 engine
Productivity is a state of mind.
-

revelator - Posts: 2567
- Joined: Thu Jan 24, 2008 12:04 pm
- Location: inside tha debugger
Re: Doom 3 engine release and game code
Hmm spotted another bugger.
static bool R_ClipLineToLight( const idVec3 &a, const idVec3 &b, const idPlane frustum[4],
idVec3 &p1, idVec3 &p2 )
frustum[4] might lead to array owerflow the correct one is frustum[6] even if the function only uses 4 planes
static bool R_ClipLineToLight( const idVec3 &a, const idVec3 &b, const idPlane frustum[4],
idVec3 &p1, idVec3 &p2 )
frustum[4] might lead to array owerflow the correct one is frustum[6] even if the function only uses 4 planes
Productivity is a state of mind.
-

revelator - Posts: 2567
- Joined: Thu Jan 24, 2008 12:04 pm
- Location: inside tha debugger
Re: Doom 3 engine release and game code
Reckless:
I tried your stencil shadow code from an earlier post in my copy of Doom 3, however I had to make a slight revision to it because the flipping of GL_FRONT and GL_BACK during the two-sided stencil operations doesn't allow shadows to be rendered in mirrors, however the fallback code does. It's tricky, but I managed to figure it out and I have a little bit of revised code. It's just a matter of flipping the tr.stencilDecr and tr.stencilIncr operations instead of the stencil faces.
Also, I used some of my GLIntercept logs to re-order the stencil tests and re-create (most) of the original code. The following should be completely legal, as I used the depth-pass method as described in the workaround. I also ran a GL_Cull( CT_FRONT_SIDED ) after the draw operations due to that being the original behavior, not entirely sure if it is necessary or not.
I tried your stencil shadow code from an earlier post in my copy of Doom 3, however I had to make a slight revision to it because the flipping of GL_FRONT and GL_BACK during the two-sided stencil operations doesn't allow shadows to be rendered in mirrors, however the fallback code does. It's tricky, but I managed to figure it out and I have a little bit of revised code. It's just a matter of flipping the tr.stencilDecr and tr.stencilIncr operations instead of the stencil faces.
Also, I used some of my GLIntercept logs to re-order the stencil tests and re-create (most) of the original code. The following should be completely legal, as I used the depth-pass method as described in the workaround. I also ran a GL_Cull( CT_FRONT_SIDED ) after the draw operations due to that being the original behavior, not entirely sure if it is necessary or not.
- Code: Select all
// preload shadows -- patent free workaround with hardware acceleration
if ( glConfig.twoSidedStencilAvailable && r_useTwoSidedStencil.GetBool() ) {
// use standard OpenGL two-sided stencils
if ( !external ) {
qglActiveStencilFaceEXT( GL_BACK );
if ( backEnd.viewDef->isMirror ) {
// if we're looking into a mirror we must flip the counters
qglStencilOp( GL_KEEP, tr.stencilIncr, tr.stencilIncr );
} else {
qglStencilOp( GL_KEEP, tr.stencilDecr, tr.stencilDecr );
}
qglActiveStencilFaceEXT( GL_FRONT );
if ( backEnd.viewDef->isMirror ) {
qglStencilOp( GL_KEEP, tr.stencilDecr, tr.stencilDecr );
} else {
qglStencilOp( GL_KEEP, tr.stencilIncr, tr.stencilIncr );
}
qglEnable( GL_STENCIL_TEST_TWO_SIDE_EXT );
GL_Cull( CT_TWO_SIDED );
RB_DrawShadowElementsWithCounters( tri, numIndexes );
GL_Cull( CT_FRONT_SIDED );
qglDisable( GL_STENCIL_TEST_TWO_SIDE_EXT );
}
qglActiveStencilFaceEXT( GL_BACK );
qglStencilOp( GL_KEEP, GL_KEEP, backEnd.viewDef->isMirror ? tr.stencilDecr : tr.stencilIncr );
qglActiveStencilFaceEXT( GL_FRONT );
qglStencilOp( GL_KEEP, GL_KEEP, backEnd.viewDef->isMirror ? tr.stencilIncr : tr.stencilDecr );
qglEnable( GL_STENCIL_TEST_TWO_SIDE_EXT );
GL_Cull( CT_TWO_SIDED );
RB_DrawShadowElementsWithCounters( tri, numIndexes );
GL_Cull( CT_FRONT_SIDED );
qglDisable( GL_STENCIL_TEST_TWO_SIDE_EXT );
} else if ( glConfig.atiTwoSidedStencilAvailable && r_useTwoSidedStencil.GetBool() ) {
// this code will crash on anything but ATI
if ( !external ) {
if ( backEnd.viewDef->isMirror ) {
qglStencilOpSeparateATI( GL_BACK, GL_KEEP, tr.stencilIncr, tr.stencilIncr );
qglStencilOpSeparateATI( GL_FRONT, GL_KEEP, tr.stencilDecr, tr.stencilDecr );
} else {
qglStencilOpSeparateATI( GL_BACK, GL_KEEP, tr.stencilDecr, tr.stencilDecr );
qglStencilOpSeparateATI( GL_FRONT, GL_KEEP, tr.stencilIncr, tr.stencilIncr );
}
GL_Cull( CT_TWO_SIDED );
RB_DrawShadowElementsWithCounters( tri, numIndexes );
GL_Cull( CT_FRONT_SIDED );
}
qglStencilOpSeparateATI( GL_BACK, GL_KEEP, GL_KEEP, backEnd.viewDef->isMirror ? tr.stencilDecr : tr.stencilIncr );
qglStencilOpSeparateATI( GL_FRONT, GL_KEEP, GL_KEEP, backEnd.viewDef->isMirror ? tr.stencilIncr : tr.stencilDecr );
GL_Cull( CT_TWO_SIDED );
RB_DrawShadowElementsWithCounters( tri, numIndexes );
GL_Cull( CT_FRONT_SIDED );
} else {
// fall-back method if two-sided stencils are unavailable or disabled
if ( !external ) {
qglStencilOp( GL_KEEP, tr.stencilDecr, tr.stencilDecr );
GL_Cull( CT_FRONT_SIDED );
RB_DrawShadowElementsWithCounters( tri, numIndexes );
qglStencilOp( GL_KEEP, tr.stencilIncr, tr.stencilIncr );
GL_Cull( CT_BACK_SIDED );
RB_DrawShadowElementsWithCounters( tri, numIndexes );
}
qglStencilOp( GL_KEEP, GL_KEEP, tr.stencilIncr );
GL_Cull( CT_FRONT_SIDED );
RB_DrawShadowElementsWithCounters( tri, numIndexes );
qglStencilOp( GL_KEEP, GL_KEEP, tr.stencilDecr );
GL_Cull( CT_BACK_SIDED );
RB_DrawShadowElementsWithCounters( tri, numIndexes );
}
- mikehayes85
- Posts: 2
- Joined: Mon Aug 27, 2012 1:19 am
- Location: Louisville, KY
Re: Doom 3 engine release and game code
Oups guess i forgot to mention i did some fixups to that code :S
my new code looks like this
was from an idea of mh so far it works just honky dory
my new code looks like this
- Code: Select all
/* new code start */
// patent-free work around ?
if ( !external )
{
// traditional depth-pass stencil shadows
if (glConfig.twoSidedStencilAvailable && r_useTwoSidedStencil.GetBool())
{
qglStencilOpSeparate( backEnd.viewDef->isMirror ? GL_FRONT : GL_BACK, GL_KEEP, tr.stencilDecr, GL_KEEP );
qglStencilOpSeparate( backEnd.viewDef->isMirror ? GL_BACK : GL_FRONT, GL_KEEP, tr.stencilIncr, GL_KEEP );
GL_Cull( CT_TWO_SIDED );
RB_DrawShadowElementsWithCounters( tri, numIndexes );
}
else
{
// "preload" the stencil buffer with the number of volumes
// that get clipped by the near or far clip plane
qglStencilOp( GL_KEEP, tr.stencilDecr, tr.stencilDecr );
GL_Cull( CT_FRONT_SIDED );
RB_DrawShadowElementsWithCounters( tri, numIndexes );
qglStencilOp( GL_KEEP, tr.stencilIncr, tr.stencilIncr );
GL_Cull( CT_BACK_SIDED );
RB_DrawShadowElementsWithCounters( tri, numIndexes );
}
}
else
{
// traditional depth-pass stencil shadows
if (glConfig.twoSidedStencilAvailable && r_useTwoSidedStencil.GetBool())
{
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 );
GL_Cull( CT_TWO_SIDED );
RB_DrawShadowElementsWithCounters( tri, numIndexes );
}
else
{
qglStencilOp( GL_KEEP, GL_KEEP, tr.stencilIncr );
GL_Cull( CT_FRONT_SIDED );
RB_DrawShadowElementsWithCounters( tri, numIndexes );
qglStencilOp( GL_KEEP, GL_KEEP, tr.stencilDecr );
GL_Cull( CT_BACK_SIDED );
RB_DrawShadowElementsWithCounters( tri, numIndexes );
}
}
/* new code end */
was from an idea of mh so far it works just honky dory
Productivity is a state of mind.
-

revelator - Posts: 2567
- Joined: Thu Jan 24, 2008 12:04 pm
- Location: inside tha debugger
Re: Doom 3 engine release and game code
Atm uploading an installer for my engine with wrapper executables for starting the game with sikkmod by default.
Hang on to yer gfx and run for your life
its seriously detailed.
Also seems i somehow got parallax occlusion mapping working by reordering a few things ->
me.
Will be ready sometime tomorrow.
Hang on to yer gfx and run for your life
Also seems i somehow got parallax occlusion mapping working by reordering a few things ->
Will be ready sometime tomorrow.
Productivity is a state of mind.
-

revelator - Posts: 2567
- Joined: Thu Jan 24, 2008 12:04 pm
- Location: inside tha debugger
Re: Doom 3 engine release and game code
Ok one bug report for mh in regards to mapbufferrange. Seems it causes some problems on ATI cards got several reports of the engine dropping fps to 2 with that codebit.
strangely enough its actually sppeds up nvidia cards (not by alot but around 6 - 7 frames) well everything counts
.
strangely enough its actually sppeds up nvidia cards (not by alot but around 6 - 7 frames) well everything counts
Productivity is a state of mind.
-

revelator - Posts: 2567
- Joined: Thu Jan 24, 2008 12:04 pm
- Location: inside tha debugger
Re: Doom 3 engine release and game code
I've a new chunk of code that handles that cleaner but it'll be a coupla days before I can post it.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
We knew the words, we knew the score, we knew what we were fighting for
-

mh - Posts: 2292
- Joined: Sat Jan 12, 2008 1:38 am
Re: Doom 3 engine release and game code
No rush m8
atm im working like a dog on a new glsl backend but its a bitch to get running (ported from mc faddens engine but it uses opengl / ES arrrrrgh)
still no material shaders but his backend has some nifty things also it uses a strict uniforms in draw_common.cpp and tr_renderer.cpp (callbacks to the glsl renderer).
Some of the ES functions are quite a headache though :S
still no material shaders but his backend has some nifty things also it uses a strict uniforms in draw_common.cpp and tr_renderer.cpp (callbacks to the glsl renderer).
Some of the ES functions are quite a headache though :S
Productivity is a state of mind.
-

revelator - Posts: 2567
- Joined: Thu Jan 24, 2008 12:04 pm
- Location: inside tha debugger
Re: Doom 3 engine release and game code
Try this for size: http://pastebin.com/rHrwP0nA
It'll need some work to integrate into any other codebase, but it should be obvious what was done.
Currently in GLSL version hell.
It'll need some work to integrate into any other codebase, but it should be obvious what was done.
Currently in GLSL version hell.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
We knew the words, we knew the score, we knew what we were fighting for
-

mh - Posts: 2292
- Joined: Sat Jan 12, 2008 1:38 am
Re: Doom 3 engine release and game code
Thanks m8
I know the feeling urgh
would be rather funny if it wasnt so sad #version 120 works for some extentions need higher for others and lower agin for some
Currently in GLSL version hell
I know the feeling urgh
would be rather funny if it wasnt so sad #version 120 works for some extentions need higher for others and lower agin for some
Productivity is a state of mind.
-

revelator - Posts: 2567
- Joined: Thu Jan 24, 2008 12:04 pm
- Location: inside tha debugger
Re: Doom 3 engine release and game code
Ok tested it and seems to work rather nicely
one remark though the r_reuseVertexCacheSooner was set to the debug value which i guess was not intended ? so i changed it to 1.
Productivity is a state of mind.
-

revelator - Posts: 2567
- Joined: Thu Jan 24, 2008 12:04 pm
- Location: inside tha debugger
Re: Doom 3 engine release and game code
Any significant gain in performance?
- motorsep
- Posts: 231
- Joined: Wed Aug 02, 2006 11:46 pm
- Location: Texas, USA
Re: Doom 3 engine release and game code
a bit
10 or so frames with the heavy stuff on.
i toyed a bit with the constants and static const int FRAME_MEMORY_BYTES = 0x4000000; // upped to 64 mb from 2 mb
proved to gain me a massive speedup
60 fps with pom and ssao woaaa.
i toyed a bit with the constants and static const int FRAME_MEMORY_BYTES = 0x4000000; // upped to 64 mb from 2 mb
proved to gain me a massive speedup
Productivity is a state of mind.
-

revelator - Posts: 2567
- Joined: Thu Jan 24, 2008 12:04 pm
- Location: inside tha debugger
Re: Doom 3 engine release and game code
Is there a wiki for the doom3 gamecode? I really havent even looked at the source, but would like to tinker with a quake1 mod in doom3-land.
id Tech3 is fueling QuakeLive, but if one was to make a doom3 mod worthy and popular I think using Quake1 gameplay would beat QuakeLive, at the next level.
Kinda like making Quake%Redux backwards, by releasing the multiplayer 1st then work on singleplayer if acceptance is positive. Or if anything just to showcase a modded D3Engine.
Ack! now i need to learn c++
Wait ive had too much vitamin B, I should just use DP/FTE :O
id Tech3 is fueling QuakeLive, but if one was to make a doom3 mod worthy and popular I think using Quake1 gameplay would beat QuakeLive, at the next level.
Kinda like making Quake%Redux backwards, by releasing the multiplayer 1st then work on singleplayer if acceptance is positive. Or if anything just to showcase a modded D3Engine.
Ack! now i need to learn c++
Wait ive had too much vitamin B, I should just use DP/FTE :O
Last edited by r00k on Sat Sep 01, 2012 5:55 am, edited 6 times in total.
- r00k
- Posts: 1110
- Joined: Sat Nov 13, 2004 10:39 pm
Who is online
Users browsing this forum: No registered users and 1 guest