#1 posted by ericw [199.126.128.107] on 2015/01/13 09:25:57
Fabien Sanglard's doom3 code review has some interesting stuff on that:
http://fabiensanglard.net/doom3/renderer.php
Not really sure how state of the art engines do it though.
#2 posted by mh [213.233.149.29] on 2015/01/13 10:00:37
You could do something with hardware occlusion queries.
Beware that vis data is needed on both client and server. The server uses it for determining which entities to write to the client, but also for line-of-sight target checking in PF_newcheckclient and PF_checkclient.
 Easy,
#3 posted by beyon [79.102.30.69] on 2015/01/13 10:44:15
just render everything!
Is the question how to do Quake-vis in real time or more general? Saurbraten obviously uses different data structures...all depends on what your goal is?
 How State-of-the-art Engines Do It
#4 posted by mh [137.191.242.106] on 2015/01/13 13:15:13
Culling the Battlefield: http://www.slideshare.net/DICEStudio/culling-the-battlefield-data-oriented-design-in-practice
Uses software rendering to a low-resolution depthbuffer with artist-placed low-resolution occlusion geometry in order to determine what's visible and what's not. In other words that's not something you're going to be able to do with existing content (and I can confidently predict that you'd meet some resistance from mappers if you were to suggest them building occlusion geometry for new content too).
#5 posted by JneeraZ [174.109.106.46] on 2015/01/13 13:18:31
I don't know about that ... I think many mappers would build occlusion geo if the offset was they didn't have to spend 60 hours running VIS.
 Occlusion Geometry
Is that anything like hint brushes?
 Just Use Detail Brushes And Tyr's Compilers
#7 posted by Kinn [86.164.147.200] on 2015/01/13 13:30:41
 Rendering Everything
#8 posted by SleepwalkR [130.149.243.224] on 2015/01/13 14:28:25
is a viable option though. I do it in TrenchBroom and get 60 FPS even on large maps. I don't think that adding light maps will make much of a difference, but dynamic lights might pose a problem.
#9 posted by Spirit [80.187.100.204] on 2015/01/13 14:53:55
Wouldn't all the entities being visible and active be a problem?
 Wot Spirit Says
#10 posted by mh [137.191.242.106] on 2015/01/13 15:28:03
I mentioned this above, but PVS is not just used for rendering. Without PVS you'll also be sending all entities to the client each frame, and line of sight testing for targetting will also always succeed. You may be able to get away without PVS for rendering in a map editor, but you almost certainly can't get away without it for the latter two in the actual engine itself.
#11 posted by JneeraZ [199.255.40.36] on 2015/01/13 15:41:14
I'd wager it wouldn't matter all that much in the end. How many entities are actually doing anything each frame? Most monsters are standing around waiting for the player to show up. Everything else just animates statically.
So, really, how much additional network traffic is there going to be?
#12 posted by JneeraZ [199.255.40.36] on 2015/01/13 15:41:52
Err, by animates statically I obviously mean animates but doesn't move. :P
#13 posted by onetruepurple [93.105.42.55] on 2015/01/13 16:09:47
Most monsters are standing around waiting for the player to show up.
Not in a Tronyn map...
 What Problem Are We Trying To Solve Here?
#14 posted by Kinn [86.164.147.200] on 2015/01/13 16:24:20
Is it vis compile times?
 Yes...
#15 posted by Scragbait [70.53.106.192] on 2015/01/13 16:48:03
For me, VIS times on most of my Travial maps was beyond brutal and VIS ran for days. But I was also using a 1.3GHz Pentium 100. I added to the problem by designing maps without respecting the engine and its limitations. The burden of long VIS times cut into time and machine resources that could have been used for further creative work.
 Ok
#16 posted by Kinn [86.164.147.200] on 2015/01/13 16:58:18
So have you tried using func_detail and tyrann's tools?
 Yeah
#17 posted by ijed [186.9.130.222] on 2015/01/13 18:04:50
If vis takes longer than a couple of hours then you either need to update your tools, learn how to use them properly or both.
And, as Mh says, without PVS all enemies will wake on map start.
#18 posted by gb [46.142.83.139] on 2015/01/13 18:07:53
Or even Q3BSP and manually creating portals.
OK, OK, I'll stop it.
#19 posted by mh [137.191.242.106] on 2015/01/13 18:11:30
How many entities are actually doing anything each frame? Most monsters are standing around waiting for the player to show up.
And how do they know that the player's shown up? By doing a vis test, that's how (like I said, look at PF_checkclient and PF_newcheckclient, both of which use the PVS). So if you run with the "just draw everything" approach, ignoring vis data, then that vis test will always pass. And then they're no longer just standing around doing nothing.
 Network Traffic
#20 posted by mh [137.191.242.106] on 2015/01/13 18:12:29
Testing e1m2 with protocol 666, the network traffic difference is a factor of 10.
#21 posted by JneeraZ [199.255.40.36] on 2015/01/13 18:37:57
"And how do they know that the player's shown up? By doing a vis test, that's how (like I said, look at PF_checkclient and PF_newcheckclient, both of which use the PVS). So if you run with the "just draw everything" approach, ignoring vis data, then that vis test will always pass. And then they're no longer just standing around doing nothing."
Sure, but then you come up with a different method. :)
I'm just noodling around the ideas here. I think VIS was great 20 years ago ... not sure there aren't better solutions these days.
#22 posted by JneeraZ [199.255.40.36] on 2015/01/13 18:39:59
"Testing e1m2 with protocol 666, the network traffic difference is a factor of 10."
This only affects people playing across a network and ... well, I guess both of them would have to find a new hobby or something. :P
#23 posted by JneeraZ [199.255.40.36] on 2015/01/13 18:43:08
I guess where my brain is heading is a thinking exercise for engine programmers ... what if VIS didn't exist? Go.
#24 posted by Kinn [86.164.147.200] on 2015/01/13 18:51:45
I guess where my brain is heading is a thinking exercise for engine programmers ... what if VIS didn't exist? Go.
Just to be clear are we talking about something that requires no pre-processing step? Also, how much work should the designer have to do?
#25 posted by JneeraZ [199.255.40.36] on 2015/01/13 19:00:48
I don't know. I think anything is fair game ... LDs placing portals or totally automated. It's just interesting to think about.
#26 posted by Kinn [86.164.147.200] on 2015/01/13 19:05:23
I always thought Doom 3's system was pretty decent - designer places the portals, and the compile time is measured in seconds.
 Although
#27 posted by Kinn [86.164.147.200] on 2015/01/13 19:11:40
concerning bsp portals, the phrase "good luck with that" comes to mind once you get into the realm of Tronyn-style monstrosities (and I don't mean that word in a negative way).
#28 posted by Lunaran [216.188.254.244] on 2015/01/13 21:28:20
kinn, doom3's system is fucking horrible. try portaling anything that isn't room-corridor-room and there's no fucking way.
Run the existing vis algorithm as the map is played? In the first few unrendered spawn frames, vis only the leaf the player is in, assume all other portals closed. All the right monsters will still wake up, because portal visibility is a symmetric relationship. Keep up with the player's current position vising one leaf at a time as he runs around, use any spare frames to follow the bsp structure outward to try to keep ahead of him. Cache it all to the same PVS structure. Areas that players or monsters never go will get skipped naturally.
Then, if you've still got a poorly build monstrosity of stupidity that would have taken six hours to vis, the framerate will just be bad :P
#29 posted by Kinn [86.164.147.200] on 2015/01/13 21:48:35
kinn, doom3's system is fucking horrible. try portaling anything that isn't room-corridor-room and there's no fucking way.
I guess it is. I never tried doing anything fancy (layout-wise) when I was tarting about with D3.
 Lol
#30 posted by Tronyn [24.79.126.117] on 2015/01/13 22:32:07
this thread is awesome... it's probably my utter lack of knowledge on this subject that makes my maps such technical problems for vising (and despite the time-sink of trying to finish a degree, I hope to put out a couple more visbreakers yet...).
 I Had An Idea Once...
#31 posted by mh [213.233.149.18] on 2015/01/13 22:57:27
...to run vis using hardware occlusion queries at load time, rendering to a lower-res offscreen surface (you'd actually need a cubemap (or 6 renders) because vis is agnostic to orientation), which should have substantially speeded things up, as well as successfully dealing with map layouts that aren't amenable to the standard software vis.
A typical modern GPU that can handle Quake at 1000+ FPS should easily be able to crunch through most maps in seconds. The whole "portal flow" paradigm just doesn't scale, and the simpler option of "build a depth buffer and do a depth test" is more robust in the face of geometric complexity in a way that portals aren't.
The only gotcha lies in the fact that occlusion queries work from a single point, whereas leafs occupy a volume.
Even so, and if this can be overcome, an offline pre-processing tool using this idea should also work, and remove all of the burden of long vis times.
But the real appeal of run-time vis is being able to dynamically move around large sections of the world and still have valid visibility. Load-time or even accelerated pre-processing would lose that.
#32 posted by Lunaran [99.112.162.57] on 2015/01/14 04:55:27
And since we don't have dynamic sections of the world moving around ...
 Slightly Related
#33 posted by mh [137.191.242.106] on 2015/01/14 11:37:49
Since we're talking about dynamic stuff moving around, Quake 2's areaportals system would also be a useful addition to Quake, and would give you a good starting-point for run-time visibility.
 That I Would Like
#34 posted by Lunaran [99.112.162.57] on 2015/01/14 18:05:24
although, designwise, areaportals are a poor substitute for static limitations in visibility. An areaportal is only a good idea when the player for whom visibility is being limited is the one opening the door. If the thing that's stopping you from seeing into the next room and getting slow performance is just one door, and a monster comes through it while you've got everything in view, for at least part of the time that door effectively isn't there and performance is as bad as if you'd just left it open.
Whenever I get annoyed that I have to still build some kind of visblocker on one side or the other of a door, I remember that that's better design anyway and the lack of areaportals is simply reminding me of that.
 Q2 Bsp Format
#35 posted by qbism [174.46.145.250] on 2015/01/15 18:58:50
Surface flags instead of alpha entity, r_whatever alpha, and texture naming hacks. Also external textures.
On-topic: DP has built-in vis? Not sure if orealtime.
#36 posted by Spiney [91.176.179.138] on 2015/01/22 13:32:16
#37 posted by Baker [65.60.224.195] on 2015/01/22 20:58:01
Thanks for that link and perhaps I can use it to find others like it.
 GPU-accelerated Vis
#38 posted by mh [213.233.149.32] on 2015/05/04 15:51:21
I've been thinking more about the idea I mentioned above (using occlusion queries) and it seems to me that something may be possible by using a combination of the world bounds and reducing to the same 16-texel scale as lightmaps.
So what I'm thinking here is to divide the world into a grid of 16x16x16 boxes, then for each box do a Mod_PointInLeaf on the center. If it's in solid don't bother, otherwise run a 6-view-draw with occlusion queries and merge the resulting leafs into visibility for this leaf (which will have been cleared to nothing visible at initialization).
Obviously there are probably edge cases that I haven't fully thought through, but overall this is an interesting enough approach that I might even code something up.
#39 posted by JneeraZ [199.255.40.36] on 2015/05/04 15:59:59
I guess your only concern there is memory usage but these days, who cares?
#40 posted by metlslime [159.153.4.50] on 2015/05/04 22:59:03
what about the case where there is a point in between your chosen sample points that can see more than any of the neighboring sample points? That seems like a really common case.
 @metl
#41 posted by mh [213.233.148.15] on 2015/05/05 00:43:44
Like I say, I haven't really thought through everything yet. It may be possible to use a finer grid, or you may be able to say things like "if leaf A can see leaf B then leaf B can also see leaf A", or whatever.
I'm not going to let "what ifs" detract from putting together a proof of concept; at the very least I'm interested in comparative performance on a known vis-breaker, and if it runs well enough then it'll be worthwhile putting in the extra effort to deal with this stuff.
#42 posted by JneeraZ [174.109.106.46] on 2015/05/05 02:28:27
Might I suggest a certain UnVISable Qonquer map from the last map jam. :P
#43 posted by Baker [69.35.202.122] on 2015/05/05 06:48:30
(I've long wondered if vis doesn't intentionally show a little bit behind walls for WinQuake's dynamic lighting. Like a lavaball on the other side showing through. Because I'm not aware of anywhere that a dynamic light won't show through a wall, which means the server sent the rocket or lavaball to the client or a player with Quad.)
 @WarrenM
#44 posted by mh [213.233.148.7] on 2015/05/05 08:26:51
That's a good suggestion.
One other advantage I can think of to this approach is that it should no longer be necessary to seal a map.
@Baker: start.bsp in ID1 - if you go to the normal skill hall, stand near the left-hand wall and look towards the right-hand wall: no shine-through. It's easy enough to add an r_lockpvs cvar for testing purposes. Otherwise the answer is in SV_FatPVS.
#45 posted by JneeraZ [174.109.106.46] on 2015/05/05 12:06:27
I think you'd still need a seal BSP tho. Otherwise you'd have no way of knowing what is void and what is valid game space.
#46 posted by metlslime [159.153.4.50] on 2015/05/05 21:37:08
technically you don't, you'll just have tons more leafs, faces, marksurfaces, lightmaps, clipnodes, etc. I think vis can be modified to accept leaky maps as well, it will just take a lot longer due to all the extra leafs it needs to process.
#47 posted by JneeraZ [199.255.40.36] on 2015/05/05 21:48:19
I guess that's true ... there WOULD be void on the inside of brushes. But you'd have to basically place those vis sampler nodes he's talking about throughout the entire Quake world grid/cube since it would all be playable game space in a leaking map.
#48 posted by metlslime [159.153.4.50] on 2015/05/05 22:07:57
yeah true. With this technique, the processing time scales with the total volume of non-solid space, rather than the total number of leafs.
#49 posted by mh [213.233.149.18] on 2015/05/05 23:13:00
The point about the GPU-accelerated approach is that this shouldn't matter. It will still take longer because a lot of formerly CONTENTS_SOLID leafs will now be CONTENTS_EMPTY, but it should take significantly shorter than software vis because you're just rendering 6 views and reading back occlusion query results. The resulting visdata may also be much higher quality.
For release-quality maps sealing is of course a must, but as a development aid, faster vis times and a higher quality result should be a win.
#50 posted by Shamblernaut [203.161.90.29] on 2015/05/10 19:39:30
Why not just make a realtime raytracing engine. It's been done before (albeit with hardcore CPUs)
http://www.q3rt.de/
http://www.q4rt.de/
 Q3RT
#51 posted by onetruepurple [88.156.138.200] on 2015/05/10 19:50:03
 If I Have Time
#52 posted by ericw [199.126.128.107] on 2015/05/10 20:44:45
I want to try making a version of light.exe that runs on the gpu (OpenCL).
I'm pretty sure it's possible, only question is whether it will be much faster than the cpu version.
 Source Code
#53 posted by inertia [98.210.216.176] on 2015/05/10 21:16:04
Where can I find source code for modern vis tools? I'd like to learn how some of this stuff is implemented.
#54 posted by JneeraZ [174.109.106.46] on 2015/05/11 01:12:53
You probably don't. :) Modern tools are stapled on top of the old code. And the old code will drive you to drink, trust me.
#55 posted by inertia [172.56.32.182] on 2015/05/11 01:31:32
There's no hope for this project if the code is THAT bad :-)
#56 posted by JneeraZ [174.109.106.46] on 2015/05/11 01:37:22
He's talking about a whole new methodology ... something done at runtime. I haven't seen the game code itself so I don't know how hard it is to mod but I suspect it's been improved in the various engine code bases.
The tools ... not so much. :)
 It's A Hefty Task
#57 posted by Shamblernaut [203.161.90.29] on 2015/05/11 15:42:27
and shit, if you're re-writing engine code to vis during runtime, then you might as well make a whole new map format to boot.
 The Problem With Vis...
#58 posted by mh [137.191.242.106] on 2015/05/11 18:58:17
...is that it really operates on too fine-grained a level for a modern renderer. Like a lot of things in Quake, it made sense for a software renderer on a lower-specced PC, where every polygon you could save performance by not drawing was a win, but with even halfway reasonably decent hardware acceleration that just goes out the window.
Some relevant notes about the XBox 360 port of Quake 2: http://www.eurogamer.net/articles/digitalfoundry-2015-quake-2-on-xbox-360-the-first-console-hd-remaster - it just didn't bother using vis at all and still managed 60 fps with 4x MSAA at HD resolutions.
Culling of unseen polygons is also eliminated in the Xbox 360 version, deemed unnecessary due to the paltry number of triangles used per map - meaning that the entire world is drawn each and every frame.
That's fine for original content but is obviously going to fall down (badly) on some of the more brutal modern maps. But it does highlight that the really fine-grained per-leaf visibility is essentially disposable when dealing with more modern PCs than the original engines targetted.
if you're re-writing engine code to vis during runtime, then you might as well make a whole new map format to boot
This can seem to make sense on the surface, but you need to dig a little deeper. One of the reasons why BSP2 was successful is that it changed as little as possible in the format. There were discussions about what features it should have while it was being specced (and I did the original spec and implementation so I can be 100% certain about this) and it kept on coming back to making it as easy for other engine authors to implement as possible. So while it could have had features like built-in RGB lightmaps, 32-bit textures (or even a separate palette per-texture), or others, it didn't. It didn't even change the .map format so that mappers could continue using their favourite editors, and all that was required in the engine and tools was a few #defines, some new structs and a bunch of copy-and-paste code.
What's really required to make Vis more efficient is to change it's granularity from per-leaf to something like per-room. I have no idea what that would entail in terms of tool-work, but engine-side it could lead to better efficiencies from less BSP tracing while drawing and being able to build static batches from world geometry.
 Although
#59 posted by ericw [199.126.128.107] on 2015/05/11 19:47:37
we have per-room vis already, in a way, if the mapper makes heavy use of func_detail.
crazy idea, maybe you can recover the "leaf clusters" in the engine if you want coarser granularity vis data for rendering. Just group all leafs together that have the same visdata?
 Stuff
#60 posted by gb [46.142.28.125] on 2015/05/11 22:54:21
BSP2 was limited by the requirement that it needed to work with Worldcraft and a Fitzquake derived engine, because switching editors proved to be an unpopular idea and dropping our sympathic newborn engine for Darkplaces or FTE seemed too heartless even to me at the time, although it would have been the right thing to do in retrospect (and it was the first thing I did afterwards.)
In the big picture, BSP2 is a foul compromise but a nice thing if you want to keep the Q1BSP pipeline.
About reducing the VIS detail:
Add a compiler switch that lets the mapper disable automatic vising. Then add a new custom texture (like "trigger") that lets the mapper create portals manually.
I did a similar thing in my single-player maps (which are both very large and very detailed) when I still used FBSP and it resulted in a HUGE performance boost. Despite already using detail brushes. I inserted just enough portals to cull far away areas of the map, instead of going overboard with it like the Quake compilers do by default. Performance is then mostly limited by batching.
The performance increase was comparable to the improvement in Vis time after using func_detail.
I got the idea from looking at how Call of Duty (1) does it, since that's a Quake 3 based game with relatively large outdoor maps. Turns out they changed it completely and yes, the mapper has to manually portal the map in that game.
Quake 1 (and Quake 3) vising was developed for corridor shooters running on 90s consumer hardware. No wonder they tried to cull every little bit whenever possible. But hardware and Quake mapping have changed so much that this formerly very effective method has turned into an obstacle, and a massive obstacle at that.
It is probably less noticeable with deathmatch maps, and thus Quake 3 maps. But single player maps are bogged down by this massive amount of unnecessary info.
 Naive Musings...
#61 posted by Kinn [31.54.196.82] on 2015/09/23 11:14:36
So just for laughs I flew around jam6_ericwtronyn - which is about the heaviest thing I can throw at the quake engine right now (I think) - and noted that in the most epic view I could find, I was getting around 30,000 wpoly and 70,000 epoly. I think this map is unvised, but looking at the structure of it, I can't imagine vising it would bring those polycounts down much.
Now, unless I'm missing something, those kinds of polycounts shouldn't trouble any sort of even vaguely modern hardware (didn't Doom 3 have like 150,000 polys in a typical scene in 2004?)
So...questions...
I get a solid 60fps with jam6_ericwtronyn on a reasonably modern laptop running Quakespasm. Does anyone here get bad performance in this map, and if so - what hardware/engine you running it on?
Are there other factors at work that cause unvised quake maps to perform slowly that are not to do with polycount? Things like 400 monsters running LOS checks?
 Kinn
#62 posted by FifthElephant [178.101.142.218] on 2015/09/23 13:09:02
I got poor performance on some maps with Mark v on my surface pro. My pro can run dark souls, burnout paradise and some other decent games so it's no slouch.
Dark places and Rmq tend to be better performance for big maps
#63 posted by JneeraZ [174.109.106.46] on 2015/09/23 13:23:41
I think it's just the old rendering code. It probably spends more time figuring out what not to draw than it would take to just draw it...
 What Warren Said
#64 posted by SleepwalkR [80.187.104.142] on 2015/09/23 13:36:29
TB just renders everything in every frame and it's fairly smooth. I'm sure with proper optimization it could be faster by a factor of two.
#65 posted by Spirit [80.187.101.49] on 2015/09/23 15:14:16
Most engines were focused on features and that was many years ago. Modern engines that break some hardware compatibilities can do it. Iirc it's VBO, as mh did.
#66 posted by Kinn [31.54.196.82] on 2015/09/23 16:17:10
I think it's just the old rendering code. It probably spends more time figuring out what not to draw than it would take to just draw it...
So...in an engine that uses some reasonably modern rendering code, an unvised map would run quicker than the same vised map? Is this the case with Quakespasm?
#67 posted by JneeraZ [174.109.106.46] on 2015/09/23 16:46:12
Potentially. A lot of modern games are throwing around props in scenes that have more triangles than entire Quake levels.
#68 posted by metlslime [67.169.151.72] on 2015/09/23 17:07:51
an unvised map would not run quicker -- but it might run at nearly the same speed with the right engine code. The only way unvised would be quicker is if the engine detected this case and used different code to render it compared to a vised map.
But the main point still stands, polygons are not the bottleneck for quake on modern hardware, it's things like draw calls, lightmap uploads, and (perhaps) geometry uploads.
I believe the ideal quake renderer for modern hardware would reduce draw calls down to 1 per texture, put all geometry in vertex buffers (potentially ignoring vis to make this work,) and do lightstyle calculations in hardware.
#69 posted by JneeraZ [174.109.106.46] on 2015/09/23 17:27:28
It would definitely be a revolution to leave VIS behind ... imagine the iteration times if level designers only had to QBSP and LIGHT.
#70 posted by Spike [86.176.35.74] on 2015/09/23 20:05:32
Even if you stick the entire map into a single vbo and draw it with a single draw call (which is possible, except for sky+water), you will still suffer from overdraw.
those individual props with more polys than entire quake maps do not have 15 different rooms overlapping each other.
it might be interesting to throw the entire map at the screen in a single draw call, both with and without an early z pass...
 Kinn
#71 posted by ericw [108.173.17.134] on 2015/09/23 21:39:25
Quakespasm has upgraded world and mdl rendering paths vs Fitzquake, if I disable these with the "-novbo" option my framerate goes from 60 -> high 20s in that map.
However, I think QS would still run faster if this map were vised - it could skip drawing entities, and skip draw calls for the world (there's a draw call for each batch of polys that share a texture and a lightmap.)
IMO all maps should still be vised, if someone did develop an engine that was faster ignoring vis data, that engine could just ignore the visdata.
What would be interesting, I think, is an upgraded / state of the art vis tool that could give less exact results but finish in a reasonable time. I wonder if there's some off the shelf, open source vis algorithm that could be used. I tried to vis the jam version of jam6_ericwtronyn but the progress indicator got stuck at the end after 2 weeks, it didn't finish in the following week so I killed it.
Vis isn't going to do a ton on this map, but if it could just separate the cave and outdoor sections that would help.
it might be interesting to throw the entire map at the screen in a single draw call, both with and without an early z pass...
I'm curious how you'd handle the texture switches when drawing the world in 1 call, is there a better way than a texture atlas? When I read about atlases, they sounded like a big pain because you have to partially tile the textures in the atlas so texture filtering doesn't read into adjacent textures.
 Ericw
#72 posted by Kinn [31.54.196.82] on 2015/09/23 21:53:06
Thanks, some cool info there :)
I tried to vis the jam version of jam6_ericwtronyn but the progress indicator got stuck at the end after 2 weeks
o_O
To what extent were detail brushes used in that map? I figured that kind of solved the vis time problem, even for crazy bonkers tronyn stuff.
#73 posted by ericw [108.173.17.134] on 2015/09/23 21:58:40
It made good use of func_detail too, had something like 7k clusters, 24k leafs - so vis only had to be computed for the 7k clusters.
Could be it's just the map layout being open. For comparison I've tested ijed's telefragged.bsp and it full vises in about a minute!
 Jam6_ericwtronyn
#74 posted by Kinn [31.54.196.82] on 2015/09/23 22:08:17
I just realised the map source is provided so I fired it up in radiant, pressed Alt-2 to only show the world brushes, and...yes I see the problem :)
 #70
#75 posted by metlslime [166.137.242.84] on 2015/09/23 22:25:34
Yes, overdraw is the thing I forgot... Still need a good solution for that.
 Noob Question About Overdraw
#76 posted by Kinn [31.54.196.82] on 2015/09/23 22:48:49
I'm having some trouble understanding the technical bits - so I assume drawing X triangles that are all stacked behind each other (lots of overdraw) is slower than drawing the same number of triangles spread out on a sheet but still all in view (no overdraw) ?
#77 posted by rebb [91.35.102.153] on 2015/09/23 23:41:16
Carmack himself stated a while ago, you can ultimately throw brute force at every problem once the hardware is fast enough. Vis is a clever solution to a problem, precalculate instead of doing things during runtime.
Afaik the main problem with overdraw is related to shading, ie too many fragment-shader invocations per pixel ( scenes with many overlapping particles tend to show this, makes older GPUs rev up nicely ), but shouldn't early-Z take care of this for opaque surfaces ?
But it probably still overdraws during the z-phase as you end up trying to draw a lot of unnecessary polygons, so it depends on the player hardware.
Any software engine people want to chime in ? I guess it might be quite bad for them at least.
 How Do I Show FPS In Quakespasm?
#78 posted by mwh [103.23.18.41] on 2015/09/23 23:50:20
Everything seems to run well for me, I guess the intel GPUs are finally good with Broadwell :-)
#79 posted by JneeraZ [12.252.11.134] on 2015/09/24 00:06:28
"but shouldn't early-Z take care of this for opaque surfaces "
It does. If the depth buffer rejects a pixel, you won't eat the rendering.
Overdraw is really only a problem on systems without depth buffers or stacks of non-opaque surfaces - like particle systems or glass.
#80 posted by Spike [86.176.35.74] on 2015/09/24 00:28:10
The main reason to always use vis, even if an engine is faster by disregarding vis entirely, is serverside culling and networking bandwidth even if the client totally disregards it.
culling realtime lights via vis is also very useful, although I suppose you could also use oclusion queries for that.
@ericw
use GL_ARB_bindless_texture
atlasing or texture arrays are also an option, but more fiddly (but also more likely to be supported by hardware).
water+skys could be done with subroutines.
@Kinn
overdraw is when you draw the same pixel multiple times. the earlier times become redundant and are essentually become a waste of memory bandwidth.
typically, graphics cards utilize an 'early z' optimisation which massively reduces the cost of overdraw, so if you draw the only world's depth first, then draw it normally (with depthfunc gl_equal), then you're not wasting time calculating the colours+textures of geometry which will never be seen.
really the advanttage depends on how expensive your fragment shaders are (including the cost of texture lookups+bandwidth).
Quake's software renderer had a zero-overdraw strategy. vanilla glquake draws triangles as they come from the bsp tree (nearest first). all modern glquake ports instead batch by texture, which can result in excess overdraw.
it'd be nice to return to a single-draw-call nearest-first renderer. best of both worlds - assuming your hardware+drivers are recent enough...
#81 posted by metlslime [67.169.151.72] on 2015/09/24 02:31:49
it'd be nice to return to a single-draw-call nearest-first renderer
I don't know much about current hardware capabilities, but is this even possible, given that there are typically dozens to 100 textures in a bsp, plus a bunch of lightmaps that, even with atlassing, probably can't fit in a single texture? Are there enough texture units on modern cards to accommodate all of this?
 @metlslime
#82 posted by Spike [86.176.35.74] on 2015/09/24 05:23:36
GL_ARB_bindless_texture
no binding = no texture unit limit.
pass the texture via a vertex attribute.
GL_ARB_shader_subroutine
efficient branching, based upon vertex attributes.
both together and you have some serious dependancies on modern hardware... but should be able to draw the entire world in a single draw call - so long as your graphics card has enough memory (probably not an issue with vanilla textures, but will undoubtably be an issue with replacements).
I've not used either, so while I'm sure its possible, I'm not sure on the actual practicalities, but hey...
 New Vis Tool?
#83 posted by Kinn [86.151.102.31] on 2016/01/08 20:53:28
Post #38, quoting here (from mh)
I've been thinking more about the idea I mentioned above (using occlusion queries) and it seems to me that something may be possible by using a combination of the world bounds and reducing to the same 16-texel scale as lightmaps.
So what I'm thinking here is to divide the world into a grid of 16x16x16 boxes, then for each box do a Mod_PointInLeaf on the center. If it's in solid don't bother, otherwise run a 6-view-draw with occlusion queries and merge the resulting leafs into visibility for this leaf (which will have been cleared to nothing visible at initialization).
Obviously there are probably edge cases that I haven't fully thought through, but overall this is an interesting enough approach that I might even code something up.
Ignoring the realtime thing (the subject of this thread) - if an offline vis tool was developed that used such a GPU-based occlusion approach to create the vis data - would this theoretically lead to higher quality visdata than the current portal-based method?
It would certainly allow for much more open maps, surely?
#84 posted by ericw [108.173.17.134] on 2016/01/08 21:43:30
Kinn, it does sound like a tempting/cool idea.
I'm not sure if the vis quality difference would be noticeable.
The biggest advantage, I think, would be vis time being proportional only to the interior volume of the map. Also func_detail would be unnecessary.
The disadvantage is you'd be moving to a system that could, in corner cases, draw less than it should. I'm thinking a hole in the wall where you have to stand just in the right place to see through, and the sample points used by vis never line up with that spot. Probably a 16x16x16 grid would be fine enough that it'd never happen in practice.
The other concern is, how fast will it be? An 8192x8192x8192 box is the worst case. That's 512^3 vis sample points using a 16x16x16 grid, and if each vis sample point can be computed in 1ms (rendering all 6 views and getting the occlusion query results) that gives you 37 hours.
#85 posted by Lunaran [66.235.55.196] on 2016/01/08 23:45:08
The problem with open maps is not how vis tests visibility, it's how the world it's testing is split up into a tree. If the splits in the tree don't correspond to occlude-able pockets of geometry, it doesn't matter what method you use to determine which ones can see which ones, you're always going to be 'seeing' geometry you think you shouldn't.
The solution you're looking for is careful construction and planning of your big open map, and hint brushes.
 Or
#86 posted by ijed [190.22.101.140] on 2016/01/11 04:37:59
Hint the lot and trust the player has 256 allocated...
#87 posted by mh [137.191.242.106] on 2016/01/11 11:54:53
The biggest advantage, I think, would be vis time being proportional only to the interior volume of the map. Also func_detail would be unnecessary.
vis time was the main thing I was thinking of, and also that vis time would scale linearly with map size meaning that complex "vis breaker" maps would no longer be an issue.
 Right
#88 posted by Kinn [86.151.102.31] on 2016/01/11 13:29:00
I'd need to do some research to understand more how hint brushes work in order to apply them to a big open map.
Is there a way to visualise portals in quakespasm or another engine?
 Zendar Uses Hint Brushes
#89 posted by onetruepurple [46.77.124.249] on 2016/01/11 13:40:10
 Is There A Way To Visualise Portals In Quakespasm Or Another Engine?
#90 posted by mh [137.191.242.106] on 2016/01/11 13:59:54
The portalization is discarded following the vis process; all that's stored in the BSP file is a list of which leafs are potentially visible from each leaf.
 Right
#91 posted by Kinn [86.151.102.31] on 2016/01/11 14:15:17
I have found Darkplaces has r_drawportals 1 command. So what is that visualising?
 The Prt File, Presumably?
#92 posted by SleepwalkR [87.146.35.1] on 2016/01/11 14:22:11
 Can't Be
#93 posted by Kinn [86.151.102.31] on 2016/01/11 14:23:13
load up any map in darkplaces, and do r_drawportals 1. Doesn't need a prt file.
#94 posted by Spirit [194.95.79.3] on 2016/01/11 15:10:22
Intersections between leafs or something?
#95 posted by mh [137.191.242.106] on 2016/01/11 15:13:42
IIRC DarkPlaces does it's own realtime portalization. That would be what it's visualizing.
#96 posted by Kinn [86.151.102.31] on 2016/01/11 16:37:57
I'm afraid I'm gonna be asking some stupid questions for a while.
The only other portal-based rendering I'm familiar with is Doom 3 and the portalling there is hand-placed and is coarser than quake I think? (it's done per room, more or less).
Is the portalling in quake on a per-leaf basis? i.e. (ignoring detail brushes for now), are visportals created for each bsp leaf?
#97 posted by mh [137.191.242.106] on 2016/01/11 17:15:01
There's no such thing as a stupid question; particularly when it comes to something like this, where the knowledge actually isn't anywhere that's publicly accessible.
Anyway - don't know. Somebody else is going to have to chime in with that one; this part of tools work makes my head hurt.
#98 posted by ericw [108.173.17.134] on 2016/01/11 20:48:12
Is the portalling in quake on a per-leaf basis? i.e. (ignoring detail brushes for now), are visportals created for each bsp leaf?
afaik that's correct, same with what Spirit said, "Intersections between leafs". So, they're super fine-grained. With "r_drawportals 1" in DP you are seeing the portals, but it's also a visualization of the leafs at the same time.
Bringing detail brushes into the picture, the info on which faces/leaves were detail is not stored in the bsp file, so DP's "r_drawportals 1" will be showing portals as if all detail was converted to world first.
#99 posted by Kinn [86.151.102.31] on 2016/01/11 21:20:44
Thanks guyz, so...if I compiled the map without detail brushes (I think the "jury-rigged" bjp compiler lets me do that)...then viewed it in DP with "r_drawportals 1", can I trust that i'd be seeing the actual portals that vis.exe will be using?
 Yes
#100 posted by mfx [77.180.183.230] on 2016/01/11 21:39:36
you can load the prt file q3radiant aswell, there is a plugin for that.
Quark also loads and displays the portals of a map.
Comparing those may help you. Idk what you are up to tho.
 Mfx
#101 posted by Kinn [86.151.102.31] on 2016/01/11 21:46:01
Thanks for info
Idk what you are up to tho.
Just wanted some help with visualising what happens when I dick around with hint brushes, because right now I don't have a scooby doo of how I'd go about hint-brushing a massive open map :/
 Cool
#102 posted by [77.180.183.230] on 2016/01/11 22:08:23
i feel you, i have always got advice from a friend to use hint brushes, if i want to optimize vising times/quality.
I never bothered to, actually i am playing around with those atm. Hint brushes can make a big difference, thats all i know by now.
#103 posted by ericw [108.173.17.134] on 2016/01/11 22:17:50
from what I understand, hint faces force qbsp to split along those planes, before using any other faces as split places. just imagine doing a 3-point clipping on the whole map, putting the clip points on the surface of the hint face. I think qbsp picks the order in which to do these splits, but it will always do the hint faces first.
Also how do you actually use them? I assume a brush with one face textured "hint" and the others "skip", and I assume it gets deleted from the final bsp, otherwise they would be annoying.
#104 posted by mfx [77.180.183.230] on 2016/01/11 22:23:58
Yep, using "wedge brushes" for hint seems to be the way to go. Hint texture for the desired split, hintskip on the sides that can be discarded.
I have produced some serious HOMs with that already, discarding more protals than it should i assume.
It is tricky, and the tuts that exists for using hint/hintskip brushes all rely upon HL2 compilers.
Hmm..
#105 posted by Lunaran [66.235.55.196] on 2016/01/11 23:31:00
Paraphrasing the best explanation I can recall of hint brush functionality:
Imagine a large room with a high ceiling. It is divided by a wall taller than the player but which only reaches halfway to the ceiling. What you'd want as a level designer is for the space on one side of the wall to be invisible when you're on the other side.
QBSP on its own will take the vertical faces of the divider wall and split the world vertically, leading to two tall leaves corresponding to the two sides of the wall and one narrow one that's on top of the wall. The entire map is visible from everywhere this way, because if you're standing in the bottom of one of the 'wells' you can see the top of the other well's full-height leaf, so the whole leaf is visible all the way to the floor.
If you place a wide horizontal hint plane so that it lines up with the top surface of the divider wall, it splits the room horizontally instead. Now the two leaves on either side of the wall do not extend higher than the wall itself, so the wall fully occludes them from each other until the viewpoint passes the top of the wall, and the entire top half of the room is now one big leaf, so when you're on top of the wall the inside of both wells is still drawn as you'd expect.
Hinting an outside area is really tricky if you've got trisouped rolling terrain, because you've got to find whatever the equivalent of the divider walls is and it's often not as obvious or convenient as a wall. Having this in mind when you make your rolling terrain in the first place makes your life a lot easier.
It's worth remembering that if your big open space is suitably split by big un-see-overable divider walls, you could just have a wall of sky texture stick up out of the top of the divider and make your life easier that way instead. If that's not desirable - maybe the player will at some point be high enough to see over (or will stand on top of) said dividers - then from that vantage point the whole outside area is going to draw anyway, and that is what will set the minimum performance bar for your level. If a given computer can handle that view playably, it doesn't matter if drawing the entire outside area at other times is in principle 'more than necessary.' It's going to become necessary when the player makes his way up there.
 Thanks Cheps
#106 posted by Kinn [86.151.102.31] on 2016/01/12 00:07:16
especially Lunaran with that super useful post - essentially what you described is what would in theory solve my map - imagine a town where the player is mainly low with most of the rest of the town occluded by walls and other buildings. Tall spires and towers rise above the walls though and should be visible from a distance.
If I can fudge things with hinting so that a fair amount of the structures below the walls are hidden, then that will probably do the trick.
Of course there are times when the player gets a bit higher and sees a bit more, but at least I'll be able to say I made a bit of an effort :}
#107 posted by adib [66.249.88.174] on 2016/01/12 00:09:45
Best of all is that this hint plane can be from a 16x16x16 brush.
#108 posted by Lunaran [66.235.55.196] on 2016/01/12 00:21:48
Do it hierarchically, so that there's a second tier of taller buildings that forms a higher barrier for the rooftops of the tier-1 buildings.
And use lots of arched passages and tunnel alleys.
because those are cool.
#109 posted by Kinn [86.151.102.31] on 2016/01/12 13:06:57
Lunaran: it has all those things and more :}
Question:
In the creation of the bsp tree, do hint planes *always* take priority over structural brush planes when building the tree?
I.e. if I make a map with one obscure little hint plane somewhere, does that form the very first split in the entire bsp tree? I'm guessing no, as that could lead to very unbalanced trees?
 Ok Scrub That
#110 posted by Kinn [86.151.102.31] on 2016/01/12 16:53:54
Looking through the bsp.exe code it appears that a structural plane won't be chosen for a bsp split if that plane splits a hint face, but otherwise the splitting planes are chosen that produce the least face splits (no matter whether they are hint planes or structural planes).
So...
Best of all is that this hint plane can be from a 16x16x16 brush.
The size of the hint face should matter though surely? If I have read the code correctly, a whopping great hint face vs a small hint face (but both faces on the same plane) should cause the bsp tree to be split in a different way.
 One Thing I Noticed Though
#111 posted by czg [213.113.210.124] on 2016/01/13 00:04:30
Hint brushes get along really bad with liquids.
And by really bad I mean not at all.
The latest version of the Good Compilers doesn't throw a mixed contents error anymore at least, but as I remember it still clips away liquid surfaces inside hint brushes and gets really confused about leaf contents in general.
|