Skip to content

Add translucent solid option for showing culling bbox #1674

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 11, 2025

Conversation

slipher
Copy link
Member

@slipher slipher commented Jun 5, 2025

Rename r_showEntityTransforms to r_showEntityBounds and add a new option (2) for showing the culling bounding boxes as a solid translucent surface, in addition to the old wireframe option. This makes it easier to see when the model is poking out of the box.

unvanquished_2025-05-31_002455_000

@VReaperV
Copy link
Contributor

VReaperV commented Jun 5, 2025

Isn't that what cg_drawBBOX 2 does already?

@slipher
Copy link
Member Author

slipher commented Jun 5, 2025

cg_drawbbox is for the collision bounding box used by gamelogic. This is for the culling bounding box used by the renderer.

@VReaperV
Copy link
Contributor

VReaperV commented Jun 8, 2025

There are some artefacts with r_showEntityBounds 2:
Depth-fighting:
unvanquished_2025-06-08_150023_000
Colours changing based on distance:
unvanquished_2025-06-08_150034_000
unvanquished_2025-06-08_150040_000

Copy link
Contributor

@VReaperV VReaperV left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are the alpha channel changes in colours needed?

slipher added 4 commits June 9, 2025 02:07
For RT_SPRITE entities the bounds are not valid and it would draw
something using garbage data from a previous entity. Skip anything that
is not RT_MODEL.
Sometimes I look directly at a door and its bbox is not shown. Looks
like ent->cull is only used for IQM/MD5/MD3 models.
It was pointless since it was only read immediately after being written.
Rename r_showEntityTransforms to r_showEntityBounds and add a new option
(2) for showing the culling bounding boxes as a solid translucent
surface, in addition to the old wireframe option. This makes it easier
to see when the model is poking out of the box.
@slipher
Copy link
Member Author

slipher commented Jun 9, 2025

There are some artefacts with r_showEntityBounds 2: Depth-fighting:

I added polygon offset so those ones that are flush with the bbox will look better.

Colours changing based on distance:

This was a pre-existing bug that some nonexistent entities were drawn using uninitialized data. Now fixed by Fix r_showEntityTransforms drawing garbage for sprites

Also fixed another pre-existing bug where entities were culled (from bbox drawing) that shouldn't have been.

@slipher
Copy link
Member Author

slipher commented Jun 9, 2025

Why are the alpha channel changes in colours needed?

alphagen vertex doesn't work right if the uniform is not 0.

@VReaperV
Copy link
Contributor

There's a moving blue plane in front of the view when actually spawning, likely from the view weapon:
unvanquished_2025-06-11_102435_000

You can skip those by checking RF_THIRDPERSON I think, although it's less of an issue.

@slipher
Copy link
Member Author

slipher commented Jun 11, 2025

That's working as intended - it shows the bounds of all types of models. I use cg_drawgun 0 if I need to examine things while on a team.

@VReaperV
Copy link
Contributor

I see.

Copy link
Contributor

@VReaperV VReaperV left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@slipher slipher merged commit 0fa128f into DaemonEngine:master Jun 11, 2025
9 checks passed
@slipher slipher deleted the showbounds branch June 11, 2025 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants