News | Forum | People | FAQ | Links | Search | Register | Log in
Fitzquake Mark V
I wasn't planning on doing this mini-project, it started as an effort to address some Fitzquake issues, fix them the right way up to Fitzquake standards (i.e. do it right, once and properly versus continual releases) and donate it back.

FitzQuake Mark V Download:

http://quake-1.com/docs/utils/fitzquake_mark_v.zip

Short version: Eliminated most issues in FitzQuake thread, most issues I can even remember hearing of ever and marked every single one clearly with a very minimal implementation.

It may be the case that only metlslime and Quakespasm and engine coders may find this engine upgrade of interest.

Features: 5 button mouse support, single pass video mode, external mdl textures, alpha textures (like RMQ), record demo at any time, rotation support, video capture (bind "capturevideo toggle"), console to clipboard, screenshot to clipboard, entities to clipboard, tool_texturepointer, tool_inspector (change weapons to see different info), clock fix, contrast support, fov does not affect gun, gun displays onscreen, Quakespasm wrong content protection, external ent support, session-to-session history and .. (see readme).
First | Previous | Next | Last
@Baker 
Whoa ... what's this? Is there a size limitation of the mip textures of some sort?

No, no limit. You just need to be aware that the standard for both GL and D3D specifies round-down (so for a dimension of, say, 63, the next miplevel would become 31, not 32).

A simple way is to check "if ((width & 1) || (height & 1))" for a miplevel, then send it through GL_ResampleTexture instead of GL_MipMap. IIRC the stock Fitz code does some funky stuff with miplevel reduction (reducing each dimension separately) so you'll have some fun there.

I believe that the latest Quakespasm has non-power-of-two support so it'll probably be useful to cross-check with that.

For D3D9 the check is "if (!(d3d_DeviceCaps.TextureCaps & D3DPTEXTURECAPS_NONPOW2CONDITIONAL) && !(d3d_DeviceCaps.TextureCaps & D3DPTEXTURECAPS_POW2))" for full non-conditional support, and if memory serves it's the same in 8, so you can report that GL_ARB_texture_non_power_of_two is supported if they're met (everything else is done outside of the wrapper).

Conditional support means that the address mode must be clamp and you can't use mipmaps which is broadly equivalent to GL_ARB_texture_rectangle (although the GL extension is weird in that it uses integer texcoords). You'll want full non-conditional support in the general case, although conditional might be OK for MDLs (provided you're still doing the Fitz thing of not mipmapping them).

D3D should also not suffer from crap like "we'll say we support non-power-of-two textures but will emulate everything in software if you try to actually use them". 
OpenGL Issue 
Here is a screenshot of what the game looks like for me with the vs2008 build. Skyboxes, liquids and teleport surfaces are totally screwed.

http://i.imgur.com/Q3KPRbA.jpg 
 
That gives me something useful to work with.

I use a stencil operation to draw the sky. All my computers even my Mac are ATI/Intel, apparently Nvidia does not like. 
 
Why not just draw the sky, clear the depth buffer, and move on? I understand it's probably an optimization thing, but ... 
 
r_mirroralpha support. Has to draw the sky twice. 
 
Also sky needs to draw on top of other things depending on the map 
Like Jam2_mfx.. 
 
@NightFright 
In Mark V r15, what happens if you do r_shadows 1 (do the shadows look right?)? Mark V uses the stencil for shadows and has since 2013.

Although stencil operations seem the prime suspect to the Open GL compatibility, it might not be the case. 
R_shadows 1 In Mk V R15 
I was using r15 just before I switched to the new builds of yours. No problems there at all.

Proof (screen taken with r15):
http://i.imgur.com/LiAxUXb.jpg 
 
That's helpful. I'm sure I'll figure it out, I see from my sky drawing function I had some varying opinions about the drawing, which since it worked fine on my graphics card I have since forgotten ...

Maybe if I reflect on this a bit, I can come up with a resolution.

void Sky_Stencil_Draw (void)
{
int i;
msurface_t *s;
texture_t *t;

// Baker: Direct3D doesn't have stencil at this time
if (!renderer.gl_stencilbits || vid.direct3d)
return;

// Baker: No sky to draw
if (!level.sky /*|| !frame.has_sky*/)
return;

// Baker: Where drawn (doesn't z-fail), replace with 1
// in the stencil buffer.
eglStencilFunc (GL_ALWAYS, 1, ~0 );
eglStencilOp (GL_KEEP, GL_KEEP, GL_REPLACE);
eglEnable (GL_STENCIL_TEST);

// Baker: A no draw pass of the sky brushes, does not even
// write to depth buffer (maybe it should?) that writes
// our stencil overlay.

eglColorMask (0,0,0,0);
// eglDepthMask (0); // Don't write depth to buffer
eglDisable (GL_TEXTURE_2D);
for (i=0 ; i<cl.worldmodel->numtextures ; i++)
{
t = cl.worldmodel->textures[i];

if (!t || !t->texturechain || !(t->texturechain->flags & SURF_DRAWSKY))
continue;

for (s = t->texturechain; s; s = s->texturechain)
// if (!s->culled)
{
DrawGLPoly (s->polys, 0); // Not here.
rs_brushpasses++;
}
}
eglEnable (GL_TEXTURE_2D);
eglColorMask (1,1,1,1);
// eglDepthMask (1);

// Baker: Keep any pixels where stencil wasn't drawn
// for this drawing pass.
eglStencilOp( GL_KEEP, GL_KEEP, GL_KEEP );
eglStencilFunc( GL_EQUAL, 1, ~0 );

// Baker: Now draw the stencil
Sky_DrawSky ();

// Turn it off
eglDisable (GL_STENCIL_TEST);
eglClear (GL_STENCIL_BUFFER_BIT);
 
Transparent textures on worldbrushes arent handled correct. This screenshot is not what it looks like ingame, there you actually see the pink color.

When doing this with func_illu/wall whatever, all is good. 
 
Transparent textures on worldbrushes arent handled correct. This screenshot is not what it looks like ingame, there you actually see the pink color.

When doing this with func_illu/wall whatever, all is good. 
This Screenshot 
I�m So Stupid 
ignore me as usual.. 
FYI 
QS 0.90 draws this "correct"
http://imgur.com/JYx8dDG 
 
Will fix.

I was going to remove alpha masked (fence) texture support on world brushes because it is technically wrong and leads to mapper newbie pain (a mapping newbie guy always says "I see void").

Then you guys made a map using it and then Quakespasm copied the Mark V implementation.

So now my "correction" becomes "bug".

Anyway, when I revisit I will "re-add" that back in. 
 
Its all cool Baker, i was trying to not overuse func_illusionaries for performance reasons, but yeah, its wrong to do it like this i know..
Thanks for your precious work anyway, it is very appreciated! 
Imo 
I would just make them func_wall/func_illusionary on new maps, and consider the fences-as-world-geometry support in qs deprecated / not recommended for future use.

arguably I shouldn't have added that to qs 0.90, because you'll get HOMs/a view in to the void if the brush touches the rest of the world, plus vis might cull stuff behind the fence texture because it thinks they are opaque. 
Oops, Redundant Post 
Anyways, sorry for this Baker, I take responsibility for spreading the mis-feature :P

mfx, it should be safe to go crazy with a lot of func_illusionary, unless you're measuring a performance hit.

In glquake/fitzquake the brushmodel drawing does a bunch of setup per-poly of the model, so you want to avoid a single very complex func_wall (this is fixed in qs 0.90 though, and probably engines with more advanced renderers). But on the other hand, I'd expect drawing a lot of simple func_walls/illusionaries should be fairly fast on all engines. They're vis-culled too, so even having several hundred spread around the map should be fine. (famous last words.. ) 
Yup 
the visculling is another thing that prevents this usage. My nooby brains was thinking "when i keep this brushes small and "freefloating" and use them like decals for wall deco and such, that would be cool for blending textures..." 
Func_wall/func_illusionary 
An option - if you want to have better performance but still let people go nuts on them - is to merge them into the world model.

As a general rule this is safe to do. Inline brush models only appear once each, are already in the worldmodel surfaces/textures/etc lumps, and if they have the same animation frame as the world, and origin and angles of {0|0|0}, you can add them to the world model texture chains quite safely.

For id1 maps there is no measurable performance gain, but for cases where using lots of them is a bottleneck, it works well. The only cost you'll pay is in overdraw, but you can set up the chains so that the inlines are drawn first and then you'll get early-Z rejection on the world polys.

The exception of course is when someone post-processes a compiled BSP to allow sharing of surfaces between inlines and inlines, or inlines and the world. But that would be evil and we'll assume nobody does that, right?

(As an aside: the way stock Fitz handles texture chains doesn't permit this optimization. I can't remember right now if it also sorts it's chains back-to-front (like stock GLQuake does) rather than front-to-back (which would also run faster).) 
Another Opinion(ated) Mapper 
If the user wants to make bad content with a feature, let them. No engine coder ever blocked the use of, say, fog 1.

Protecting the newbs seems like a strange reason to limit the feature as well. Why not disable map hacks while you're about it, just in case.

mh's solution sounds good, basically handling the process better. Just disabling stuff seems like prohibition.

Yes, my last map did have a couple of wafter thin parts of void clipping caused by this issue, but it was my fault :) 
Mh 
thanks for the tips, will play with the merging brush models into the world sometime.

Fitz walks through the surfaces in the order of the cl.worldmodel->nodes array - there's no R_RecursiveWorldNode - then reverses the order per-texture from the chaining. Not sure if cl.worldmodel->nodes has any meaningful order to it.

ijed, that's a good point. 
Yeah... 
the idea was that iterating a list is much better on CPU than walking a tree, and the order wasn't that important. This idea was taken from darkplaces at the time.

I have no idea if it's the correct tradeoff with current hardware. If GPU bound I guess front to back would be best. 
Fitz Walks Through The Surfaces... 
Fitz walks through the surfaces in the order of the cl.worldmodel->nodes array

The big problem is that it only regenerates texture chains when the PVS changes. Merging brush models really requires texture chains to be regenerated each frame.

It's actually quite trivial to write a GL renderer that runs twice as fast as Fitz on ID1 maps (much more on big maps), but much of that is down to batching rather than BSP tree traversal (this isn't including dynamic lighting which is it's own separate problem).

So adding some good batching and accepting the CPU overhead of building the chains each frame is a reasonable tradeoff that you're going to come out on the good side of on any hardware (unless you're totally fillrate or ROP bound, which the original 1996 hardware was, and therefore none of this was a problem back then), and then you get the ability to merge as a bonus. 
First | Previous | Next | Last
This thread has been closed by a moderator.
Website copyright © 2002-2024 John Fitzgibbons. All posts are copyright their respective authors.