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

Texture Matrix Issue For Q1 Maps Using Shader or External Texture #163

Open
Baker7 opened this issue Apr 8, 2024 · 3 comments
Open

Texture Matrix Issue For Q1 Maps Using Shader or External Texture #163

Baker7 opened this issue Apr 8, 2024 · 3 comments
Labels
mod compatibility A quirk making the engine (in)compatible with mods that work on other engines regression Something used to work in an earlier version but isn't working anymore

Comments

@Baker7
Copy link

Baker7 commented Apr 8, 2024

This water in Quake Combat+ is wrong:

xon_20240407_texture_matrix_q1_affects_all_shaders_and_external_textures_Mod_LoadTextureFromQ3Shader_model_brush_c

In model_brush.c in Mod_Q1BSP_LoadTextures

This is not equivalent to at all to classic DarkPlaces and the result is that all replacement textures and shaders in Q1 bsp will have the wrong texture matrix because the external texture size is used.

		tx = loadmodel->data_textures + i;
		// try to load shader or external textures, but first we have to backup the texture_t because shader loading overwrites it even if it fails
		backuptex = loadmodel->data_textures[i];
		if (name[0] && /* HACK */ strncmp(name, "sky", 3) /* END HACK */ && (Mod_LoadTextureFromQ3Shader(loadmodel->mempool, loadmodel->name, loadmodel->data_textures + i, va(vabuf, sizeof(vabuf), "%s/%s", mapname, name), false, false, TEXF_ALPHA | TEXF_MIPMAP | TEXF_ISWORLD | TEXF_PICMIP | TEXF_COMPRESS, MATERIALFLAG_WALL) ||
		                Mod_LoadTextureFromQ3Shader(loadmodel->mempool, loadmodel->name, loadmodel->data_textures + i, va(vabuf, sizeof(vabuf), "%s"   , name), false, false, TEXF_ALPHA | TEXF_MIPMAP | TEXF_ISWORLD | TEXF_PICMIP | TEXF_COMPRESS, MATERIALFLAG_WALL)))
		{
			// set the width/height fields which are used for parsing texcoords in this bsp format
			tx->width = mtwidth;
			tx->height = mtheight;
			continue;
		}
		// no luck with loading shaders or external textures - restore the in-progress texture loading
		loadmodel->data_textures[i] = backuptex;

It is actually worse than that, it doesn't honor map folder like "textures/e1m1/this_texture.tga" won't ever get used.

What I did in Zircon was to rewrite and rework the texture load using DarkPlaces Classic for the sequence of event while keeping the intentions of what DarkPlaces Beta was trying to improve.

texturematrix

This is what the water is supposed to look like.

@hemebond
Copy link
Contributor

hemebond commented Sep 18, 2024

Disabling these two lines seems to have the desired result:

                {
-                       // set the width/height fields which are used for parsing texcoords in this bsp format
-                       tx->width = mtwidth;
-                       tx->height = mtheight;
                        continue;
                }

Screenshot from 2024-09-18 23-25-47

Screenshot from 2024-09-18 23-29-12

I had a run around and couldn't see any problems with any texturing. Do you think this will be enough to resolve the issue or could it cause problems elsewhere?

Edit: This breaks texture coordinates when using texture overrides.
image

@Baker7
Copy link
Author

Baker7 commented Sep 19, 2024

Heme, that little change might give you part of a fix that isn't why the textures/e1m1/sliptop0.tga does not load.

jakub1 helped me for a fews days with a series of fixes back about (10 months ago )until it worked right, there was some rewiring that had to be done. It was about "medium size" modification, meaning some planning had to go into it and some planning had to go into the testing too.

Even after all the rewiring, 2 lesser issues remain in Zircon engine:

  1. Sometimes missing textures don't print to console. (DarkPlaces Beta, last I checked, hardly any missing textures print to console).
  2. Sometimes get missing texture warning if using R_BeginPolygon when it shouldn't print when used in 3D. This is a more complicated case because Zircon has both DarkPlaces Classic polygon draw and DarkPlaces Beta polygon draw (because the new system just isn't compatible with the old one, despite having some advantages.)

@hemebond
Copy link
Contributor

Heme, that little change might give you part of a fix that isn't why the textures/e1m1/sliptop0.tga does not load.

Yip, I've created a separate issue to track that. This issue (and my little test there) is specifically about the texture UV mapping.

@hemebond hemebond added regression Something used to work in an earlier version but isn't working anymore mod compatibility A quirk making the engine (in)compatible with mods that work on other engines labels Sep 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mod compatibility A quirk making the engine (in)compatible with mods that work on other engines regression Something used to work in an earlier version but isn't working anymore
Projects
None yet
Development

No branches or pull requests

2 participants