Comments (12)
res2k is correct (as usual) - the RTX renderer cannot use the depth hack because it doesn't render the scene in multiple passes. The gun exists in the world just like anything else. We can, however, do a different hack here (also used in Portal RTX) - scale the gun down so that it's tiny and close to the camera, but its footprint on the screen stays the same. Then it likely won't intersect with world geometry.
from q2rtx.
The logic to adjust the gun position is in CL_AdjustGunPosition()
. It's using some hardcoded "gun dimensions", though, which are probably not quite suitable in this case (and possibly others as well).
from q2rtx.
It may look superficially simple to fix - just adjust the hardcoded "gun dimensions", right? - however, this may make other weapons look bad (being wall offset without appearing close to a wall).
Not sure what the best approach would be. Maybe using the view model bbox could give satisfactory results.
from q2rtx.
It's been long ago since I did OpenGL API stuff but I recall in those days there was a solution related to depth testing, which would prevent minor issues such as this one.
Actually peeking around a bit, Q2RTX its GL renderer responds to the RF_DEPTHHACK flag. However there is zero results of finding any records of this flag being checked for in the VKPT code.
Found in shared.h
#define RF_DEPTHHACK 16 // for view weapon Z crunching
Found in client/entities.c
gun.flags = RF_MINLIGHT | RF_DEPTHHACK | RF_WEAPONMODEL;
Responded to/in/by GL_DrawAliasModel
using 'glDepthRange'.
from q2rtx.
The RTX renderer works differently, it doesn't have a depth hack equivalent.
But even if it would have, it probably would result in looking weird in cases where the hack would kick in:
The view weapon is actually properly located in the world, so reflections, lighting etc look reasonably right.
Now, cases where the depthhack would be in effect, the view weapon would be inside a wall or such - resulting in unexpected lighting and reflections, probably looking quite off. So moving the whole gun makes sense, at least for the RTX renderer.
from q2rtx.
Sounds like the most decent proposing solution. Any chance of seeing that actually being implemented?
from q2rtx.
scale the gun down so that it's tiny and close to the camera
Hm, but couldn't there be cases where this could look off?
Say, parts of the gun would be shadowed by something in "real size", but it would either be completely shadowed, or not at all, with a tiny gun.
Or is that something that's not typically noticed?
Or maybe the downsizing trick is only used when it's close to a wall (like the position shifting right now)?
from q2rtx.
(FWIW, I think the weapon shifting actually makes some sense in the world - I always think my avatar is actually deliberately moving the weapon a bit farther back when close to a wall, instead of, say, just ramming the gun into it...)
from q2rtx.
Hm, but couldn't there be cases where this could look off?
Say, parts of the gun would be shadowed by something in "real size", but it would either be completely shadowed, or not at all, with a tiny gun.
Or is that something that's not typically noticed?
It's not noticeable unless you look for it, in my experience.
Or maybe the downsizing trick is only used when it's close to a wall (like the position shifting right now)?
Now that would certainly be noticeable. :)
from q2rtx.
Being pretty much illiterate at Vulkan (although I understand the general concept's bits here and there), I'm hoping someone can implement this. Main motivating reason would be, (new future)mods, and consistency in general of supporting a as of yet unsupported RenderFlag.
I'd have gladly done so myself if I could. Rooting for this lol.
from q2rtx.
Hi @res2k , @WatIsDeze - I made a PR that adjusts the gun scale, #319
It's not perfect - you can see the gun slightly shifting on screen when the scale is changed, but I think that's good enough. Please review.
from q2rtx.
Excuse me for being late to the party. The problem seems to be resolved now in all of the specific scenarios that I ran into. Seems good to me.
from q2rtx.
Related Issues (20)
- Crash when starting a game or loading save save (Windows/Linux) HOT 5
- wrong flashlight direction when playing demo HOT 7
- reset accumulated profiler samples causes an access violation error HOT 5
- Support for Quake 2 remaster, please ? HOT 21
- Errors trying to build latest Q2RTX HOT 6
- No Audio on default build from Ubuntu.. HOT 2
- [Question] Where could I find the default game lib logic of d2rtxded loading? HOT 1
- [Feature Request] Support compilation against shared system libs HOT 2
- There are no shadows in the latest(1.7.0) render version. HOT 2
- [regresssion] Graphic does not render correctly HOT 6
- Parallax Occlusion Mapping with Self-Shadowing ? HOT 2
- Input from cinematics gets into the game HOT 3
- "Pitch black" rendering HOT 5
- Enable FSR3 HOT 2
- Native wayland small viewport & stretched graphics HOT 1
- CMake error: Unknown CHECK_C_COMPILER_FLAG
- Failed to compile client target due to missing libm linkage
- [Question] What is the minimal supported GCC?
- Much better denoising through Area-ReSTIR HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from q2rtx.