Skip to content
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

Rend2 SP #1179

Draft
wants to merge 150 commits into
base: master
Choose a base branch
from
Draft

Rend2 SP #1179

wants to merge 150 commits into from

Conversation

SomaZ
Copy link
Member

@SomaZ SomaZ commented Oct 8, 2023

So, this is basically a SP port of rend2. This also puts most of the rend2 code to the shared folder. I also started reducing the differences between SP and MP renderer APIs but I think I can do some more, so just a draft for now. This also needs testing.

Many thanks to @AntiAnti for doing the initial SP port and for the additions to the weather code.

@Razish Razish mentioned this pull request Oct 11, 2023
@xycaleth xycaleth mentioned this pull request Nov 12, 2023
SomaZ and others added 27 commits December 12, 2023 16:48
Theres a define in MP that clashes, so it was renamed in MP. Apply this to vanilla too.

Co-Authored-By: AntiAnti <[email protected]>
q_shared.h defines "int COM_GetCurrentParseLine( void )"

q_shared.cpp implemented "int COM_GetCurrentParseLine( int index )"

Fixed now, so function can actually be used.

Co-Authored-By: AntiAnti <[email protected]>
Adding mdr structs, one more texture compression algorithm, some zone tags, and SkipBracedSection function

Co-Authored-By: AntiAnti <[email protected]>
Cleaned up alot of noise. Code formating will happen in another commit.
All work based on: https://github.com/AntiAnti/OpenJK

Co-Authored-By: AntiAnti <[email protected]>
Chose the SP variant of this to get rid of the void pointer in the struct, so potentially less casting.
cg_showtris 1 shouldnt use depth culling. Had overseen this before.
The saber marks in SP use some additional scaling and there's some missing parts still.

Also fixed incorrect ifdeffed if else constructs.
Added working IsShaking

Co-Authored-By: AntiAnti <[email protected]>
Because there's a skyportal in this map, it always culled all the ui elements because they aren't sky surfaces.
when G2_PERFORMANCE_ANALYSIS
Compiles, haven't tested it though
You can now load yavin_swamp again.
SomaZ added 10 commits January 24, 2025 00:27
Also reordering some glsl defines -> no change in functionality
Also limit output color to only positive values.
When we changed r_ext_framebuffer_multisample to r_ext_multisample in rend2 we created an issue. The default framebuffer was multisampled as well as rend2 framebuffers. This is unnecessary overhead. Having a ROM cvar that is set by the renderer to tell the sdl window creation code to skip multisampling the default framebuffer is added. This is my prefered solution as we can use r_ext_multisample regardless of renderer. Renderers just need to tell the engine whether they do multisampling manually or if the default framebuffer should be multisampled.
Time based evaluation changed at some point and I apparently forgot to update this for the fog shader too. So, shaders with deforms had incorrect/missing fogging.
Helps determain if a stage will probably write depth values or not. If the depthfunc is equal, you wont write new or different depth values so just disable it.
Velocity calculations can be simplified as currently all surfaces need to be evaluated individually even if we could compute the velocity just by depth and the view projection matrices for all static surfaces.
@SomaZ SomaZ force-pushed the rend2-unified-wip branch from d2266b6 to 8fe80d3 Compare February 25, 2025 22:12
SomaZ added 10 commits February 25, 2025 23:35
This uses the lightgrid to create the illusion of volumetric fog. Requires a lightgrid per map obviously. When no lightgrid is found, it will use a default white 3d texture instead.
Since this can change the perception of fog tremendously there's a new worldspawn key "volumetricFogScale" to scale the volumetric fog density. Users can also set a default value if this key is not set via r_volumetricFogDefaultScale. r_volumetricFogScale can be used to determain a good value as it will additionaly scale the current scale value. The quality of the effect can be altered with the r_volumetricFogSamples cvar.
Now has to upload the gore data per gpu frame, so basically twice as often, but therefore the vbo that is uploaded to is not in flight anymore. Should prevent lag spikes when gore data is uploaded.

Also annotated most gpu resources for easier debugging in renderdoc

[rend2] Fix OpenGL error on annotating framebuffers

The fbo has to be bound before the annotation can be made as the driver might actually allocate the buffer at first bind.

Also removed two asserts that always trigger in rend2, need to investigate this at some point.

[rend2] Fix compilation on Apple

GL_VERTEX_ARRAY is not available on apple.
[rend2] Increase tr.distanceCull to SP default
[rend2] Increase number of renderable g2 surfaces
[rend2] Increase MAX_FBOS
Could be hit with cg_shadows 4 and r_smaa 2
- Removed incorrectly committed light value scaling via uniform
- Corrected density factor
- Fixed most blended stages
Mappers use blended depthwritten occluders to mask map geometry and still want to see the sky behind them. Only use depthtest for skies when there was something written to the image before the skydraw like portals or skyportals.
When multiple skys are rendered per frame, they could pop randomly because of inconsitent sorting. Also makes sure sky stages are rendered after the actual sky image.
@SomaZ SomaZ force-pushed the rend2-unified-wip branch from 8fe80d3 to 8ff9323 Compare February 25, 2025 22:41
When redsaurus fixed the save screenshot (in ff21085 ), they must have missed the double usage of SCR_GetScreenshot. Besides being used for the savegame thumbnails, it's used directly as an argument for DrawStrechRaw. DrawStrechRaw expects a RGBA buffer to draw to the screen. For drawing the level transition screen correctly I also had to flip the image in RE_GetScreenShot, so I also changed the flipping behaviour when saving the savegame.
except for the ones that need info about the entity time or have the volumetric flag.
Fixed dynamic lights when r_specularMapping and r_normalmapping == 0.
Also removed specular calculations when r_specularMapping 0 but r_normalmapping 1.
Apparently additionally copying depth to the backbuffer is super slow on older graphics cards. Unfortunately this disables depth rejection for refraction surfaces. Need a better system for those anyways. So, just go for it for now.
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.

1 participant