Daemon icon indicating copy to clipboard operation
Daemon copied to clipboard

Material system bugs on map "defenxe"

Open slipher opened this issue 1 year ago • 9 comments

This screenshot shows the two bugs described below:

unvanquished_2024-08-24_074127_000

This one shows things working correctly (I deconstructed the OM): unvanquished_2024-08-24_074102_000

1. Transparent surface sometimes not rendered

The Overmind is supposed to be completely surrounded by glass. The rendering is not always wrong; whether it is broken seems to be determined when the renderer loads the map. This sounds silly, but it appears to depend on whether the OM is there during renderer load. I can decon the OM and vid_restart and the bug goes away, then I reload the initial layout and vid_restart and it comes back.

The glass uses this texture from scripts/nexus6.shader in res-tremulous:

textures/nexus6/glass_02_s
{
	qer_editorimage textures/niveus/scratchglass
	qer_trans 0.5
	surfaceparm nomarks
	surfaceparm trans
	{
		map textures/niveus/scratchglass
		blendfunc add
		rgbGen const ( 0.1 0.1 0.1 )
	}
	{
		map $lightmap
		blendfunc gl_dst_color gl_src_alpha
		rgbGen identity
		tcGen lightmap
	}
}

2. Surface under the reactor is never rendered when GPU occlusion culling is enabled

If r_gpuOcclusionCulling is enabled, you can see through the floor under the reactor to the human default base below. I was using the resolution 1920x1080 in case that matters.

Other comments

Also the trees, which use deformvertexes autosprite2, aren't rendered correctly, but I am planning to fix that soon myself.

Something I have noticed with this map is that the number of materials or surfaces generated is not consistent. Sometimes it changes after a vid_restart even though I didn't change any settings, e.g.

Generated 12 materials from 973 surfaces
Generated 12 materials from 966 surfaces

Maybe some shaders are not requested until after the game starts and that is messing things up somehow?

slipher avatar Aug 24 '24 14:08 slipher

Inconsistent number of surfaces might be because R_AddWorldSurfaces() is not adding a few surfaces for some reason... I thought I fixed all causes of that, but I might've missed some. It would also explain the missing glass.

Do you have a link to a dpk with this map?

VReaperV avatar Aug 24 '24 15:08 VReaperV

https://users.unvanquished.net/~sweet/pkg/map-defenxe_0+b2.dpk

slipher avatar Aug 24 '24 15:08 slipher

Thanks, I'll take a look at it later.

VReaperV avatar Aug 24 '24 15:08 VReaperV

So far I'm unable to reproduce either of these bugs and I get consistent 989 surfaces.

VReaperV avatar Aug 24 '24 21:08 VReaperV

I'm using all default cvars except r_materialSystem and r_arb_bindless_texture. I tried to test with Intel to see if it's driver-specific, but that didn't work out. Anyway dumping the GPU details.

SDL using driver "windows"
Initializing OpenGL display
Using GLEW version 2.2.0
Display aspect: 1.778
Display resolution: 1920x1080
...setting mode -2: 1920×1080
Using preferred context - 24-bit OpenGL 3.2 core
OpenGL Renderer: NVIDIA GeForce GTX 1070 with Max-Q Design/PCIe/SSE2
Using GL3 Renderer in OpenGL 3.x mode...
Available modes: '1280x720 1366x768 1600x900 1920x1080 1360x768 1280x768 320x200 640x400 1280x800 1440x900 1680x1050 720x480 1280x600 320x240 400x300 512x384 640x480 800x600 1024x768 1152x864 1280x960 1400x1050 1280x1024 '
Detected graphics driver class 'OpenGL 3+'
Detected graphics hardware class 'generic'
Initializing OpenGL extensions
...ignoring GL_ARB_debug_output
...found shading language version 150
...using GL_ARB_half_float_pixel
...using GL_ARB_texture_float
...using GL_EXT_gpu_shader4
...using GL_ARB_gpu_shader5
...using GL_EXT_texture_integer
...using GL_ARB_texture_rg
...using GL_ARB_texture_gather
...using GL_EXT_texture_compression_s3tc
...using GL_ARB_texture_compression_rgtc
...using GL_EXT_texture_filter_anisotropic
...using GL_ARB_half_float_vertex
...using GL_ARB_framebuffer_object
...using GL_ARB_get_program_binary
...using GL_ARB_buffer_storage
...using GL_ARB_uniform_buffer_object
...using GL_ARB_map_buffer_range
...using GL_ARB_sync
...using GL_ARB_depth_clamp
...using GL_ARB_compute_shader
...using GL_ARB_bindless_texture
...using GL_ARB_shader_draw_parameters
...using GL_ARB_shader_storage_buffer_object
...using GL_ARB_multi_draw_indirect
...using GL_ARB_shading_language_420pack
...using GL_ARB_explicit_uniform_location
...using GL_ARB_shader_image_load_store
...using GL_ARB_shader_atomic_counters
...using GL_ARB_indirect_parameters
GL_VENDOR: NVIDIA Corporation
GL_RENDERER: NVIDIA GeForce GTX 1070 with Max-Q Design/PCIe/SSE2
GL_VERSION: 3.2.0 NVIDIA 510.06
GL_MAX_TEXTURE_SIZE: 32768
GL_SHADING_LANGUAGE_VERSION: 1.50 NVIDIA via Cg compiler
GL_MAX_VERTEX_UNIFORM_COMPONENTS 4096
GL_MAX_VERTEX_ATTRIBS 16
Occlusion query bits: 32
GL_MAX_DRAW_BUFFERS: 8
GL_TEXTURE_MAX_ANISOTROPY_EXT: 16.000000
GL_MAX_RENDERBUFFER_SIZE: 32768
GL_MAX_COLOR_ATTACHMENTS: 8
PIXELFORMAT: color(24-bits)
MODE: -2, 1920 x 1080 fullscreen hz: N/A
Using OpenGL version 3.2, requested: 3.2
^x0f0Using OpenGL 3.x context.
^x0f0Using an OpenGL core profile.
OpenGL 3.x context is not forward compatible.
^x0f0Using OpenGL extensions: GL_ARB_half_float_pixel GL_ARB_texture_float GL_EXT_gpu_shader4 GL_ARB_gpu_shader5 GL_EXT_texture_integer GL_ARB_texture_rg GL_ARB_texture_gather GL_EXT_texture_compression_s3tc GL_ARB_texture_compression_rgtc GL_EXT_texture_filter_anisotropic GL_ARB_half_float_vertex GL_ARB_framebuffer_object GL_ARB_get_program_binary GL_ARB_buffer_storage GL_ARB_uniform_buffer_object GL_ARB_map_buffer_range GL_ARB_sync GL_ARB_depth_clamp GL_ARB_compute_shader GL_ARB_bindless_texture GL_ARB_shader_draw_parameters GL_ARB_shader_storage_buffer_object GL_ARB_multi_draw_indirect GL_ARB_shading_language_420pack GL_ARB_explicit_uniform_location GL_ARB_shader_image_load_store GL_ARB_shader_atomic_counters GL_ARB_indirect_parameters
^x0f0Using S3TC (DXTC) texture compression.
^x0f0Using GPU vertex skinning with max 233 bones in a single pass, models are hardware accelerated.

Also

World bounds: min: -5376.000000 -5376.000000 -1024.000000 max: 5376.000000 5376.000000 4288.000000
Generated 12 materials from 972 surfaces

slipher avatar Aug 25 '24 05:08 slipher

I got a missing surfaces bug on another map: https://users.unvanquished.net/~slipher/map-test-video_2.1-20231113-084535-c164c77.dpk The floor is sometimes missing, seemingly at random. As before the presence or absence of the bug is set at renderer load time. Generated 3 materials from 31 surfaces or Generated 3 materials from 25 surfaces unvanquished_2024-08-25_015840_000

slipher avatar Aug 25 '24 07:08 slipher

I'm using all default cvars except r_materialSystem and r_arb_bindless_texture. I tried to test with Intel to see if it's driver-specific, but that didn't work out. Anyway dumping the GPU details.

Is that with r_smp 1?

Still unable to reproduce it on the other map.

VReaperV avatar Aug 25 '24 11:08 VReaperV

Got a fix for bug #1 coming soon. It really was caused by whether the Overmind was present. R_MarkFragments uses the same visit counter for surfaces as R_AddWorldSurfaces does. When calling the latter for the material system, a unique visit ID is not ensured. This means marks added in the first frame, such as the Overmind's creep, may cause nearby world surfaces not to be added to the material system's buffer.

slipher avatar Sep 05 '24 23:09 slipher

After asking to test with r_gpuOcclusionCulling on on forlorn for a different issue with a lower resolution, it was discovered that some surfaces were also missing following that. So most likely this issue has to do with incorrect width/height being used.

VReaperV avatar Oct 18 '24 10:10 VReaperV

There've been some fixes for missing surfaces that have fixed similar issues on other maps, so it's possible that this was fixed too.

VReaperV avatar Mar 08 '25 16:03 VReaperV

I can't reproduce on 0.55.2.

slipher avatar Mar 10 '25 06:03 slipher