Forum

Texture alignment with origin brushes and func_door_rotate

Discuss the construction of maps and the tools to create maps for 3D games.

Moderator: InsideQC Admins

Texture alignment with origin brushes and func_door_rotate

Postby jitspoe » Wed Feb 18, 2015 5:20 am

I thought I saw this mentioned here somewhere, but I can't seem to find it.

I've just run into an issue working on a Quake2 map where converting my carefully aligned brushes into a func_door_rotating causes the textures to get all messed up. It seems the offsets are relative to the origin brush, instead of the world origin. Is this an editor bug? Compiler bug? Engine bug? What's the best way to go about fixing this?
jitspoe
 
Posts: 217
Joined: Mon Jan 17, 2005 5:27 am

Re: Texture alignment with origin brushes and func_door_rota

Postby Spike » Wed Feb 18, 2015 8:10 am

I'm gonna say its a compiler bug, seeing as that's the one that actually adjusts the verticies+brushes ny subtacting the origin, that's the one that should also adjust the texture coords to match that new origin too.
Spike
 
Posts: 2881
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: Texture alignment with origin brushes and func_door_rota

Postby jitspoe » Wed Feb 18, 2015 9:31 pm

That's kind of what I was thinking. I just didn't want to try to fix it there, then discover it was misaligned in other Quake2 engines because the bug was fixed elsewhere.
jitspoe
 
Posts: 217
Joined: Mon Jan 17, 2005 5:27 am

Re: Texture alignment with origin brushes and func_door_rota

Postby Spike » Wed Feb 18, 2015 9:51 pm

if you fix it in the engine, you risk breaking vanilla content.
that said, few advanced quake2 engines can still run vanilla properly so I'm not sure it matters that much anyway.
fixing it in the engine requires parsing the entity lump to match model and origin fields. which is ugly enough that I doubt anyone sane bothered to do it.
Spike
 
Posts: 2881
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: Texture alignment with origin brushes and func_door_rota

Postby jitspoe » Wed Mar 04, 2015 5:02 am

Well, when I was in the process of converting DeWan's modifications to the GPL codebase, I noticed this bit of code in TexinfoForBrushTexture():

Code: Select all
   /* Originally:
    shift[0] = DotProduct (origin, vecs[0]);
    shift[1] = DotProduct (origin, vecs[1]);
   */

   if (!bt->scale[0])
      bt->scale[0] = 1;
   if (!bt->scale[1])
      bt->scale[1] = 1;


   //
   if(origfix)
   {
      VectorScale(origin,1.0/bt->scale[0],scaled_origin);
      shift[0] = DotProduct (scaled_origin, vecs[0]);
      VectorScale(origin,1.0/bt->scale[1],scaled_origin);
      shift[1] = DotProduct (scaled_origin, vecs[1]);
   }
   else
   {
      shift[0] = DotProduct (origin, vecs[0]);
      shift[1] = DotProduct (origin, vecs[1]);
   }


// rotate axis
   if (bt->rotate == 0)
      { sinv = 0 ; cosv = 1; }
   else if (bt->rotate == 90)
      { sinv = 1 ; cosv = 0; }
   else if (bt->rotate == 180)
      { sinv = 0 ; cosv = -1; }
   else if (bt->rotate == 270)
      { sinv = -1 ; cosv = 0; }
   else
   {   
      ang = bt->rotate / 180 * Q_PI;
      sinv = sin(ang);
      cosv = cos(ang);
   }

    // DWH: and again...
    if(origfix)
    {
     ns = cosv * shift[0] - sinv * shift[1];
     nt = sinv * shift[0] + cosv * shift[1];
     shift[0] = ns;
     shift[1] = nt;
    }


So it looks like he at least made an attempt to fix it. I'll have to go back and revisit that later.
jitspoe
 
Posts: 217
Joined: Mon Jan 17, 2005 5:27 am

Re: Texture alignment with origin brushes and func_door_rota

Postby Knightmare » Sun May 29, 2016 8:44 am

That code in DeWan's QBSP3 DOES fix the texture alignment issue, you just have to add the -origfix parameter at the command line. My own KMQBSP3, which is derived from it, has this option enabled by default.
Knightmare
 
Posts: 61
Joined: Thu Feb 09, 2012 1:55 am

Re: Texture alignment with origin brushes and func_door_rota

Postby jitspoe » Wed Jun 01, 2016 2:23 am

Awesome. I'll enable it by default as well. Good call.
jitspoe
 
Posts: 217
Joined: Mon Jan 17, 2005 5:27 am


Return to Mapping

Who is online

Users browsing this forum: No registered users and 1 guest