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

Implement more shader stage collapsing #1420

Open
slipher opened this issue Nov 5, 2024 · 2 comments
Open

Implement more shader stage collapsing #1420

slipher opened this issue Nov 5, 2024 · 2 comments
Labels
A-Renderer T-Improvement Improvement for an existing feature

Comments

@slipher
Copy link
Member

slipher commented Nov 5, 2024

I noticed a couple of shaders from legacy maps which were rendered wrong with my naive overbright implementation due to the color buffer and fragment shader outputs being restricted to [0, 1], which could have been rendered as a single stage:

  1. Hand-written "light style" on metro-b1-2. Only rgbgen identity colormaps are collapsed, but I think any rgbgen should be allowed.
textures/metro/ROCK_003
{
	qer_editorimage textures/metro/ROCK_003.jpg

	q3map_nonplanar
	q3map_shadeangle 70

	{
		map $lightmap
	}
	{
		map textures/metro/ROCK_003.jpg
		rgbgen wave noise .8 .1 .5 10
		blendfunc filter
	}
}
  1. Grate texture in pulse. This one is trickier, we'd have to recognize the depthWrite + depthfunc equal pattern.
textures/pulse/e8bgrate01_s
{
	qer_editorimage textures/pulse/e8bgrate01.tga
	surfaceparm alphashadow
	surfaceparm metalsteps
	surfaceparm nomarks
	surfaceparm trans
	cull disable
	nopicmip
	{
		map textures/pulse/e8bgrate01.tga
		depthWrite
		alphaFunc GE128
	}
	{
		map $lightmap
		rgbGen identity
		tcGen lightmap 

		blendfunc filter
		depthFunc equal
	}
}

Also stage auto collapsing code should be NUKED for any kind of stage which didn't exist in Tremulous. Modern map types like physical map should be grouped in a single stage in the first place. It would seem devs of Xreal or whatever it was were targeting some awful alternate syntax where every image (glowmap, physicalmap, normalmap, etc.) has to be written like a separate stage.

@slipher slipher added T-Improvement Improvement for an existing feature A-Renderer labels Nov 5, 2024
@illwieckz
Copy link
Member

illwieckz commented Nov 5, 2024

Modern map types like physical map should be grouped in a single stage in the first place. It would seem devs of Xreal or whatever it was were targeting some awful alternate syntax where every image (glowmap, physicalmap, normalmap, etc.) has to be written like a separate stage.

That syntax was inspired from Doom3 (XreaL mimicked Doom 3) as far as I know. We moved to pre-collapsed stages when I implemented specular/normal maps on terrain blended shaders (since each blended stage, for example rock and sand, can have their own specular/normal maps).

In the past all of our shaders making use of specular/normal maps were using the old doom3 syntax, but once pre-collapsed stages were implemented we printed very loud warnings on legacy separate specular/normal stages so there should not be much of them left.

@VReaperV
Copy link
Contributor

VReaperV commented Nov 5, 2024

2. Grate texture in pulse. This one is trickier, we'd have to recognize the depthWrite + depthfunc equal pattern.

There's apparently some check in tr_shader that the shader doesn't have GLS_DEPTHFUNC_EQUAL to add a depth shader to it, not sure why. Other than that it should be possible to collapse that without doing anything extra.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Renderer T-Improvement Improvement for an existing feature
Projects
None yet
Development

No branches or pull requests

3 participants