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

Renderer: broken sprite code path #730

Closed
slipher opened this issue Nov 7, 2022 · 5 comments · Fixed by #1251
Closed

Renderer: broken sprite code path #730

slipher opened this issue Nov 7, 2022 · 5 comments · Fixed by #1251

Comments

@slipher
Copy link
Member

slipher commented Nov 7, 2022

vboData_t::spriteOrientation is never set anywhere, and it was that way since the field was introduced in b10e8c2. I guess the "autosprite" thing (no idea what it is) has probably been broken at least since then.

illwieckz says:

note that we have some known bugs related to sprites. Some can be seen in metro map, in catacombs: missing fire sprites, distorted chain sprite…

@illwieckz
Copy link
Member

illwieckz commented Dec 15, 2023

It's possible that vboData_t::spriteOrientation is dead code.

Here are some materials from the metro map:

textures/metro/kosad_flammebougie
{
	qer_editorimage textures/metro/kosad_flammebougie1

	surfaceparm nolightmap
	surfaceparm nomarks
	surfaceparm trans

	cull disable
	deformvertexes autosprite2

	{
		animmap 50 textures/metro/kosad_flammebougie1 textures/metro/kosad_flammebougie2 textures/metro/kosad_flammebougie3 textures/metro/kosad_flammebougie4 textures/metro/kosad_flammebougie5 textures/metro/kosad_flammebougie6 textures/metro/kosad_flammebougie7 textures/metro/kosad_flammebougie8
		blendfunc add
	}
}


textures/metro/kosad_chaine
{
	qer_editorimage textures/metro/kosad_chaine

	cull disable
	deformvertexes autosprite2

	{
		map textures/metro/kosad_chaine
		alphafunc ge128
		depthwrite
	}
	{
		map $lightmap
		blendfunc filter
		depthfunc equal
	}
}

First one is candle flame, next is a metal string, both use deformvertexes autosprite2.

Here is a scene with both of them. The metal string is incorrectly distorted, the lightmap is not applied, but the texture is rendered and is always facing the player, there is a candle on the left, without flame:

unvanquished_2023-12-15_095616_000

Now, if I swap the names:

textures/metro/kosad_chaine
//textures/metro/kosad_flammebougie
{
	qer_editorimage textures/metro/kosad_flammebougie1

	surfaceparm nolightmap
	surfaceparm nomarks
	surfaceparm trans

	cull disable
	deformvertexes autosprite2

	{
		animmap 50 textures/metro/kosad_flammebougie1 textures/metro/kosad_flammebougie2 textures/metro/kosad_flammebougie3 textures/metro/kosad_flammebougie4 textures/metro/kosad_flammebougie5 textures/metro/kosad_flammebougie6 textures/metro/kosad_flammebougie7 textures/metro/kosad_flammebougie8
		blendfunc add
	}
}

textures/metro/kosad_flammebougie
//textures/metro/kosad_chaine
{
	qer_editorimage textures/metro/kosad_chaine

	cull disable
	deformvertexes autosprite2

	{
		map textures/metro/kosad_chaine
		alphafunc ge128
		depthwrite
	}
	{
		map $lightmap
		blendfunc filter
		depthfunc equal
	}
}

The string is rendered using the flame material (and is animated as expected !), and the candle doesn't have a string as flame:

unvanquished_2023-12-15_095649_000

So, it's like if the autosprite2 code works even if buggy, but only on some kind of surfaces. I guess the string comes from a BSP surface directly made with a brush in NetRadiant, while the candle is a baked model (though if baked, it should be a BSP surface too).

@illwieckz
Copy link
Member

Something we know is that the flame doesn't have any lightmap, the surfaceparm nolightmap was read by the map compiler so the engine is not interpreting that part.

@slipher
Copy link
Member Author

slipher commented Jul 16, 2024

autosprite (without the 2) seems to be broken as well. station15 is supposed to have a sun. Its textures/station15_custom_src/sun_d shader uses the autosprite keyword. Here's what in looks like in Unvanquished 0.25.0:

unvanquished_2024-07-15_200122_000

@DolceTriade says that it works in 0.50 also, which is interesting since that is later than the commit I linked in the OP.

@slipher
Copy link
Member Author

slipher commented Aug 12, 2024

autosprite "one" probably actually works fine. I believe the sun was broken by some map update and autosprite was a red herring.

@slipher
Copy link
Member Author

slipher commented Aug 17, 2024

I made a tool to more easily look up which maps contain a given shader keyword such as autosprite2. https://users.unvanquished.net/~slipher/shader-keyword-directory.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants