Jump to content
The Dark Mod Forums
Sign in to follow this  
SteveL

Tweak proposal: r_showPortals colours

Recommended Posts

I'd like to tweak the behaviour of r_showPortals so that it uses three colours instead of two. Red would still be used for closed VPs, that look on to a closed visleaf. Green would be for portals that you can see through, and that lead to open visleafs. Yellow would be for portals that connect to open visleafs, but you can't actually see through them, and they are not adding anything to the list of objects to be drawn this frame. At the moment, those portals are coloured green, the same as the ones you can see through.

Example:
post-29566-0-02402700-1433681429_thumb.gif

Only the selected (red) barrel gets drawn in this scene, plus the walls of course. The player's view (pale yellow zone) flows through the first open portal, then through the portal above it, and hits the barrel, which duly gets added to the draw list for the frame. The barrel at the top right is in the same visleaf but the player's view doesn't touch it, so it's not drawn. Likewise the yellow-coloured portal at the top right leads onto the same visleaf and would be green in r_showPortals, but the player can't actually see through it so for most purposes it's effectively closed. The barrel behind it isn't drawn.

Using r_showPortals in 2.03, you can't tell which portals are green because they are actually adding entities and other portals to the draw list for the frame, and which are green merely because the player can see through some other portal to the same room. And you can't check whether a split portal is working, because both halves will always be red or green even if one half is letting the player's view flow through to discover new objects, and the other half isn't.

I've tweaked r_showPortals in my test build so that it shows three colours as in the diagram. Should I commit that, or is it needlessly complicating the whole thing?

  • Like 4

Share this post


Link to post
Share on other sites
the player's view doesn't touch it, so it's not drawn

 

 

Huh, I didn't realize that. I thought if a leaf were open everything in it was drawn. Does this apply to worldspawn too?

Share this post


Link to post
Share on other sites

Sounds good to me. Nice work.


FM's: Builder Roads, Old Habits, Old Habits Rebuild

WIP's: Several. Although after playing Thief 4 I really wanna make a city mission.

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Share this post


Link to post
Share on other sites

 

Huh, I didn't realize that. I thought if a leaf were open everything in it was drawn. Does this apply to worldspawn too?

 

Not really. When DMAP converts worldspawn into visible models, all the worldspawn in one visleaf becomes a single model, so if any part of it is visible, the gpu will be told to draw it all.

 

The GPU does know which bits of a model can be seen through the portal(s), so it can in theory disregard tris and parts of tris before doing the expensive step (colouring them in by lights). I'm not sure whether our old shader programs are taking advantage of that or not. They definitely discard those unseen parts before they get written to the screen, but I should put it on the to-do list to make sure that they don't get their lighting calculated before being discarded.*

 

* To say the same thing in OpenGL speak: we do use a scissor test to discard parts of models that fall outside the view, but I'm not sure whether our old ARB shaders allow the GPU to use a early scissor test -- before shading -- or not. The answer might differ between GPUs, and it's almost certainly not documented anywhere by the manufacturers. We'll be able to make sure of it when we switch to GLSL shaders for drawing our light interactions.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...