Announcement

Collapse
No announcement yet.

Importing models in Quake - can't see model

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Importing models in Quake - can't see model

    Hi all,

    I know this is a common issue because I remember some posts in the past about the subject (or maybe I found it somewhere else after some googling) but I'm unable to find such info again

    I replaced IT_AXE model for a sword of mine which was modeled in Blender and exported it using Bill Currie's import/export addon for Blender (55 frames of animation too, textured). So far the only thing I changed in weapons.qc is adding the precache model line of code at the beginning and replaced the .mdl file of v_axe.mdl for my v_knife.mdl (added that file to the pak file using PakExpl) in the W_SetCurrentAmmo function.

    When switching to the axe, instead of my model, there's nothing. I remember there was something specific to this, like rotating the model in a specific way or side ways or some strange thing to do at the model level before exporting maybe, so that models actually show up in-game. Any chance anyone around here knows?

    Btw, what's up with the site? The new skin is a bit...quakeless?
    Last edited by wizardmachine; 08-24-2017, 01:42 PM. Reason: added tags

  • #2
    The first thing to check is the position of the model. It may be that it's too high or too low and is out of the players view. The easiest way to to do this is to import the original axe model next to yours and see how far apart they are.

    Another issue is that the frames may not match up. Make sure that frame 1 is indeed the idle frame. Also make sure that you are actually on the 55th frame when you export. In blender, it will only export the frames up to the one you have selected in the frame bar. Also remember that you will still need to add code to make all 55 frames useable...I believe the original model only used 13. Another thing is that if you look at the players axe swing animations, you'll see they only use 4 frames each, even though both the player model and the axe have 6 frames for a swing, so you may want to address this as well. This was an original flaw from the stock game.

    Also make sure you are calling the correct .mdl file name in the code. Look for any warning messages in-game when you switch to it. Also remember that IT_AXE is not the axe model, it is simply a float that tells the engine that the player has an axe in their inventory.

    My advice would be to start fresh, unaltered code, name your sword file as "v_axe.mdl" and simply drop it into the progs folder. Make sure you store a backup of the original axe model. If the model appears, then you'll know its something in your code that was wrong.
    Last edited by Dutch; 08-24-2017, 02:09 PM.
    'Replacement Player Models' Project

    Comment


    • #3
      Hi Dutch, thanks!

      Model position was wrong, I already corrected that. I tried starting from scratch and just replace the v_axe.mdl with a v_axe.mdl with my sword but it still displays the axe. If I change it to something else, it displays nothing (even if model position now matches the axe position). Idle frame is at the beginning for the sword too so it should appear right where the axe is now that I changed the scale and position.

      IT_AXE only contains a reference to the bitmask value but in the W_SetCurrentAmmo I put a reference to that v_knife.mdl file:

      Code:
      if (self.weapon == IT_AXE)
          {
              self.currentammo = 0;
              self.weaponmodel = "progs/v_axe.mdl"; // here it's referencing that model, could there be other references I should modify to match my model's name?
              self.weaponframe = 0;
          }
      Renaming original v_axe.mdl to _v_axe.mdl and placing the v_axe.mdl sword version just displays the axe (do I also need to remove it from the pak file completely?) <--- also tried that, same result.

      Last edited by wizardmachine; 08-24-2017, 05:39 PM. Reason: Added info that I tried removing the original v_axe.mdl from pak file when trying to do a model swap.

      Comment


      • #4
        I think you're putting the model in the wrong place...theses a couple ways to do it. You can make a mod folder, and within that folder Make another folder called "progs". Then drop your model into this folder. As long as the filename is identical to the original ("v_axe.mdl"), then this model will override the one in PAK0. Start the game with your mod active and it should work.

        You can also grab PakScape and then replace the axe model in PAK0, then start the game without any active mod. This will also work.

        If the model still doesn't appear, then it is definitely the model itself, and not file location or game code. In blender, make sure the eye position is the same as the original...it may be easier to check this in QME model editor. I love this program because it makes it easy to see any discrepancies between blender and the in-game display of the model. QME will render and position the model pretty much exactly how the quake engine. Very handy. The eye position isn't really used to my understanding for original models, so this should probably be set to 0.

        Beyond that, I'm not really sure. If this doesn't solve the problem we'll have to look at your process step by step.
        'Replacement Player Models' Project

        Comment


        • #5
          Putting them in my mod's progs folder did the trick. Thanks! Now it shows up.

          I still need to understand how to make the textures look sharp (in Blender 3D view they look way sharper than in this picture) and how extend the animation. In the end I'm using 1-20 for idle and 21-30 for attack:


          Code:
          void()    player_axe1 =    [$axatt1, player_axe2    ] {self.weaponframe=20;};
          void()    player_axe2 =    [$axatt2, player_axe3    ] {self.weaponframe=21;};
          void()    player_axe3 =    [$axatt3, player_axe4    ] {self.weaponframe=22;W_FireAxe();};
          void()    player_axe4 =    [$axatt4, player_run    ] {self.weaponframe=23;};
          
          void()    player_axeb1 =    [$axattb1, player_axeb2    ] {self.weaponframe=24;};
          void()    player_axeb2 =    [$axattb2, player_axeb3    ] {self.weaponframe=25;};
          void()    player_axeb3 =    [$axattb3, player_axeb4    ] {self.weaponframe=26;W_FireAxe();};
          void()    player_axeb4 =    [$axattb4, player_run    ] {self.weaponframe=27;};
          
          void()    player_axec1 =    [$axattc1, player_axec2    ] {self.weaponframe=21;};
          void()    player_axec2 =    [$axattc2, player_axec3    ] {self.weaponframe=22;};
          void()    player_axec3 =    [$axattc3, player_axec4    ] {self.weaponframe=23;W_FireAxe();};
          void()    player_axec4 =    [$axattc4, player_run    ] {self.weaponframe=24;};
          
          void()    player_axed1 =    [$axattd1, player_axed2    ] {self.weaponframe=25;};
          void()    player_axed2 =    [$axattd2, player_axed3    ] {self.weaponframe=26;};
          void()    player_axed3 =    [$axattd3, player_axed4    ] {self.weaponframe=27;W_FireAxe();};
          void()    player_axed4 =    [$axattd4, player_run    ] {self.weaponframe=28;};
          Is this the piece of code I need to modify to include the rest of frames? I see there's axe, axeb, axec and axed but I only remember two different swing animations for the axe, and when walking the animation is the same as for idle, I think (the sideways swinging movement happens when walking having equipped any weapon even with this new one and I haven't animated such thing so I'm guessing it's an animation that's been coded in for every weapon).

          Why is W_FireAxe called only on the 3rd iteration of each group? Is that so that only one of the frames triggers the damage?

          Comment


          • #6
            W_FireAxe: Yes, this is only called on the 3rd frame because the 3rd frame is (or should be) when the axe is the farthest out during the swing (both on the player model and the view weapon model). W_FireAxe runs a traceline and deals damage if the trace_ent can be damaged (buttons, monsters, etc.). It is located in weapons.qc.

            The idle frame is easy. Look in player_stand() function near the top of player.qc. Notice that the weaponframe is set to 0. For models, frame 0 is always the first frame in QC. Keep that in mind, because the first frame of your model in blender will be 1, not 0. It can get tricky. Now, instead of setting it at 0, you can use a similar method to the walkframe (in player_run(), which basically loops the player's running animation while he's in motion). Replace "self.weaponframe = 0" with an if statement, like:

            if (self.weaponframe >= 19)
            self.weaponframe = 0;
            else
            self.weaponframe = self.weaponframe + 1;

            This is assuming that you are indeed using frames 1-20 [read: 0-19] for the idle animation.

            As for the attack functions, if you don't plan on re-animating the player model, you'll have to make do with swing animations that are no longer than 6 frames each. Remember earlier I said that the original code doesn't use all the swing animations? In the code you posted above, each set of animations should actually go to 6, not 4. If you've ever seen the player model swinging, you'll notice it abruptly stops. Load up player.mdl in QME and you'll see what I mean.
            'Replacement Player Models' Project

            Comment


            • #7
              Ok I think I got it (except for the texture being crisp as you will see in the gif, I'm guessing this is an issue with Blender export rather than Quake).

              If I understood correctly, every attack animation (of every weapon) is 6 frames long because the player model attack animation is also 6 players long and in order to introduce attack animations of greater lengths I'd have to also modify the player model attack animation, right? I think I can keep them 6 frames long (especially for guns, it shouldn't be that big of a restriction).

              Thanks a lot for your help! Here's a gif of the sword I made. I'll fix the issues with the crispness but I'm happy I got the whole Blender-To-Quake pipeline figured out




              Comment


              • #8
                No problem! And yes, each attack animation is 6 frames, except for nailgun and lightning gun animations. They are only 2 each. To add extra frames in code, you will also need to add extra frames to the model.

                As far as the texture, blender will render the texture differently than a quake engine, but you can change the rendering style with the "gl_texturemode" command in the console. I don't remember what the different options are, but most quake engines Use the same set of options. The crisper textures are a result of non GL blending. You'll have to look at the readmes for the engine, or Google around to find out what the acceptable options are.
                'Replacement Player Models' Project

                Comment


                • #9
                  linear_mipmap_linear will blend the textures GL-style, nearest_mipmap_linear will get you da krunchy p1x3lz.
                  (nearest as 3rd term is not a viable option)
                  ♪ I'm skiiiiiiinnin' in the pain, just skiiiiiiinnin' in the pain ♪
                  ♪ What a glorious feelin' I'm haaaaaaappy again ♪

                  Comment


                  • #10
                    Thanks. "nearest_mipmap_linear" is my favorite. The stock textures in Quake aren't a high enough resolution or enough variety of color to make gl blending look any good. And I just can't get down with the high-res textures. Not enough geometry in the levels to look any good. Maybe on a Sock level, IDK. Either way, I think Sock (rightfully so) was aiming for a traditional look. What can I say, I'm a sucker for old school.
                    'Replacement Player Models' Project

                    Comment


                    • #11
                      its unfortunate that trilinear is basically required for anisotropic filtering to work, thus using nearest results in ugly floors (mipmaps are decided based on how quickly the texture coords change, and floors/etc angled away from you are very small in one axis which biases the mipmap despite the other axis being fairly normal, resulting in lower-than-desired mipmap resolutions).
                      but yeah, other than that...
                      Some Game Thing

                      Comment


                      • #12
                        Hi all again!

                        I got sharp textures by adding an autoexec.cfg file in Id1 folder with the following line “gl_texturemode GL_NEAREST_MIPMAP_LINEAR”. This is the way it looks best in my opinion. Haven't fiddled around with many other options, though.

                        Now I'm having trouble exporting a Blender model made out of several cubes. It's only exporting one of the pistol's cubes for whatever strange reason. I posted this question about the subject in Blender.StackExchange but unfortunately it seems it hit a dead end. Maybe someone around here had this issue before and knows what's up.

                        Comment


                        • #13
                          Originally posted by Spike View Post
                          its unfortunate that trilinear is basically required for anisotropic filtering to work, thus using nearest results in ugly floors (mipmaps are decided based on how quickly the texture coords change, and floors/etc angled away from you are very small in one axis which biases the mipmap despite the other axis being fairly normal, resulting in lower-than-desired mipmap resolutions).
                          but yeah, other than that...
                          Ahh, so that's why floors look like hell in nearest mode. I wondered why they were more garbly than walls. I figured it had something to do with the angle/axis though.

                          @wizardmachine

                          MDLs do not support multiple Objects like an MD3 model does. You will need to use the Join command in Blender and combine all the objects into one object. You shouldn't have to use parents at all. It's perfectly ok to have several meshes in the model (like a mesh for the pistol frame, a separate mesh for the slide, the trigger, an empty shell ejecting, the player's hands, what have you), but these all need to be part of the same Object. Use an armature and assign bones to each mesh for animating.
                          'Replacement Player Models' Project

                          Comment


                          • #14
                            Ctrl+J did the trick! Unfortunately in-game the model looks all black tinted, texture-less. Also when importing the .mdl output file back into Blender, if you select the option to see textured objects, it's going to look with every face painted in #000. After joining all the objects, the pistol is still textured in the viewport but it seems that the textures are somehow lost when exporting. With the sword I don't think I had this issue at all so I'm not sure again what to do in this case.


                            Comment


                            • #15
                              You had a separate UV map for each object, huh? No worries, the meshes should still be unwrapped. Just place all the uvs on the same map. You will have to open all your different texture images in gimp or Photoshop or something and splice them all into one image. Then just align the uvs with the new image in blender.
                              'Replacement Player Models' Project

                              Comment

                              Working...
                              X