-
Notifications
You must be signed in to change notification settings - Fork 60
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
broken rotating texture #35
Comments
|
I'm pretty sure that at least the fan in the first two pictures worked on my end, and I cannot think of a way how I could have broken it. So I would also assume this to be a renderer bug. |
|
This is an engine issue, the issue got confirmed with a Smokin' Guns map, the train one: See how looks the closest wheel from this point of view: See how broken looks the opposite wheel from this point of view: Of course the train wheel looks good on ioquake3, so it's an engine issue. It's possible to download some preview dpks of Smokin' Guns assets this way: Then to load the map in Unvanquished this way (requires |
|
pinging @gbougard 😉 |
|
I have been examining this issue and I think something similar happens on the working fans as well. The choppy rendering is due to conversion into a .gif in the actual engine this is completely smooth. Below is the broken one slowed down. But note the corners in the working slowed fan below. This fan is directly underneath 'the one crazy fan' seen above. All the fans seem to be have multiple fans spinning around them. This was also observed with the fans in the ventilation duct as well. |
|
Yeah, I noticed that, it looks like the center of rotation is wrong on "crazy fan". Edit: I think the fact textures are tiled infinitely is expected, hence the texture repeating and displaying other fans in corner because there is not enough transparent surface around the fan. |
|
You can see this in the engine by shifting the rotation speed of textures/parpax_evillair/e6metalfan_blade in the parpax_evillair.shader file up from -1500 to -100. |
|
Thanks, then we can guess the issue is in |
|
Where would that code be found? Only a file name... That question is way too specific otherwise. |
|
That shader keyword is parsed in Daemon/src/engine/renderer/tr_shader.cpp Lines 1305 to 1318 in b17dd39
The bug has high chance to be between that step and the rendering itself, or somewhere in some general purpose texture code, since it looks like we have a coordinate issue. |
$ grep -r TMOD_ROTATE src
src/engine/renderer/tr_shade_calc.cpp: case texMod_t::TMOD_ROTATE:
src/engine/renderer/tr_shade_calc.cpp: case texMod_t::TMOD_ROTATE2:
src/engine/renderer/tr_shader.cpp: tmi->type = texMod_t::TMOD_ROTATE;
src/engine/renderer/tr_shader.cpp: tmi->type = texMod_t::TMOD_ROTATE2;
src/engine/renderer/tr_local.h: TMOD_ROTATE,
src/engine/renderer/tr_local.h: TMOD_ROTATE2 |
|
In tr_shade_calc.cpp |
|
Do you know why there is a TMOD_ROTATE1 and TMOD_ROTATE2? |
|
The code in Note: ioq3 code is different (split between |
|
If I uglily backport this parpax map to run on Unvanquished 0.6.0 (the oldest build I have), the fan is not broken. I also know that the map was already broken in Unvanquished 0.37.0. So the bug was introduced between 0.6 and 0.37. |
|
In the 0.6 version of the game both the current code existed and some older code existed as part of a some earlier renderer. It looks very similiar to the code used by smokinguns |
|
Oh yeah there was multiple renderer, perhaps one was buggy and not the other one, I don't know. In anyway the fan rotation is not broken on Unvanquished 0.18.0, but it still has the two renderers. |
|
In fact I'm using GL3 renderer in both 0.06 and 0.18, hence the current code path, and the fan is not broken, so the bug was introduced after 0.18. Edit: Bug was introduced between 0.18.0 (bug not there) and 0.32.0 (bug there). |
|
OK, bug was not there in |
|
As I suspected changing the code to what is seen below will fix the typically crazy fan in the duct. While making the typically normal fan in the duct become crazy. |
Wouldn't clamping fix this issue? This can be enabled in the shader(mtr?) definition file. |
|
@megatog615 Maybe clamping would fix the second issue, but this one is not really problematic: even if it's not realistic, what is expected to be rendered is rendered, even if it's wrong. @Rootyjr what you discovered makes me think that perhaps some code elsewhere in dæmon was simplified or rewritten without some hacks required for some corner-cases. I doubt the problem is in that transform code since this transform code looks very old, the bug is probably already triggered when the execution comes to that point. |
|
Exactly my thoughts. I am now thinking our bug is in tr_backend or whereever the matrix object is implemented for each texture/brush. |
|
It looks like the bug was introduced by the extracted engine tree: 5ea5314 I'm not able to run custom build of 0.30.0 or that commit anymore but I know that 0.30.0 has the bug since I reproduce the bug using old 0.30.0 build and current map, and there is no engine-related commit between this merge and the 0.30.0 release. I'm able to build and run the commit in Commit that precede that merge and does not display the bug yet (initial tree): Unvanquished/Unvanquished@67d4839 |
|
I will have hard time to bisect this since I'm not able to run anything in that |
|
@gimhael, It looks like you contributed a lot to that |
|
The cause is that the vertexpack engine tries to optimize texture coords, because fp16 numbers have 1/2048 resolution only between -1.0 and 1.0, and so we could have several texel rounding errors if the coords are too large. The optimization finds connected surfaces and then shifts the texture coords so that their average value is near 0. If the range is 0-1, there are two equally good solutions, either keep the range 0-1 or shift to -1-0, and in this case tiny rounding errors decide which one is used. For non-animated textures this is no issue, but the rotating textures always rotate around 0.5/0.5, and if the texture coords are shifted, it shifts the rotation center too. The easy fix is to move the average as close as possible to 0.5 instead of 0.0, then all standard 0-1 textures will not be shifted. |









See these two videos: 1, 2, two fans are rotating wrongly in parpax map, while the others are rotating as expected. For example in the ventilation hall, the one near the tank room is wrong, but not the other one in the same hall.
There is one crazy fan in ventilation hall (near tank room):
And one in ventilation (near alien base):
These fans look to just be spinning textures. I noticed similar rotating fan bug in some other maps like the metro map by KOsAD. The same map has correct rotating fan while loaded on Tremulous and has crazy fan while loaded on Unvanquished. That's why I think it's a renderer bug.
Parpax used to have more broken fans but these fan were removed once some geometry was redone. This bug is very old (I always seen it).
The text was updated successfully, but these errors were encountered: