Author Topic: Changing the "center" of a placeable's model?  (Read 557 times)

Legacy_Androrc

  • Full Member
  • ***
  • Posts: 188
  • Karma: +0/-0
Changing the "center" of a placeable's model?
« on: September 04, 2011, 04:24:15 pm »


               So... I would like to change the point of origin of the "arrow" that appears at the placeable in the toolset. It seems to me that is defined within the .mdl file; how would I change it?

I want to use the town placeables from this pack: http://nwvault.ign.c....Detail&id=7774

I want to make it so a script fires when characters use the placeable, but the placeable's "point of arrow origin" is at it's very center, which is unreachable for the characters to use it, as the placeable is almost a tile large.

Can I change this through text-editing the .mdl file?
               
               

               
            

Legacy_OldTimeRadio

  • Hero Member
  • *****
  • Posts: 2307
  • Karma: +0/-0
Changing the "center" of a placeable's model?
« Reply #1 on: September 04, 2011, 08:00:44 pm »


               

Androrc wrote...
So... I would like to change the point of origin of the "arrow" that appears at the placeable in the toolset. It seems to me that is defined within the .mdl file; how would I change it?

What you're thinking of is the "use node".  When a placeable is usable and a player clicks on it, the engine walks the player to the use node and then whatever is going to fire OnUsed, fires.  However, if there is no use node on the model, the engine defaults to trying to walk the player to the model base, which is at X/Y/Z location 0.0, local to the model itself.  If it can't reach that location, or get close to it, the player will appear to make rudely amorous advances to the placeable and OnUsed usually won't fire- but any OnHump events probably would, if they existed.

The "arrow" in the toolset is really misleading but the non-pointy end appears to start at the model base and some arbitrary amount of height off the ground.

I want to use the town placeables from this pack.

I want to make it so a script fires when characters use the placeable, but the placeable's "point of arrow origin" is at it's very center, which is unreachable for the characters to use it, as the placeable is almost a tile large.

These models were made without use nodes.  They have to have use nodes added to them to be usable.  They're too big for the player to get to the  (fallback) model base, or at least the one you describe is.

Can I change this through text-editing the .mdl file?

I don't think you can because these also appear to need new PWK files too.

As you probably know, a PWK determines where a player can't walk.  It prevents players from walking through placeables and is generally a 2D plane in the outline of where the placeables is likely to meet the
ground.  Some people make PWK's which are simple boxes and there may be convincing arguments as to why this should be done (as opposed to a 2D plane), but I haven't seen them yet and 2D PWK's have not failed me so far.

Here is a basic bed placeable (you're looking up at it from the foot of the bed) and its PWK, side by side, from official BioWare content:
'Image 'Image
Also, see those white cones above?  Those are nodes.  I think one of the ones you see on the right hand side (PWK) is the use node for the bed.  Anyway, now take a look at one of the models from that pack you're using:
'Image 'Image
See the problem there?  No use nodes and the PWK appears to be just a full 3D copy of the model which is extremely wasteful of space (doubles the model's filesize) and it's also bound to screw with the poor engine, which is expecting far simpler (and 2D) data to splice into the walkmesh.  You can see the model base in all of the pictures as a blue box.  Its present in all of these pictures, you can just see it most easily in the pictures above because the model is smaller.

As screwed up as these models seem to be, you can probably fix them fairly quickly by using the NWN Creator rollout in Vel's Tools.  It would go something like this:
1.Using something like NWN Explorer Reborn, export the model you want to fix to your override directory (NOT the PWK)
2.Import the model into G/Max
3.Delete the model base leaving just the model
4.On Vel's Tools go to the NWN Creator rollout, give the placeable a name (1), change type to placeable (2), click Create button (3)
Like this

All the nodes, the PWK, etc, will have been created for you by Vel's Tools.  Attach the model to the new base, adjust PWK size and node placement as needed and do a ResetXForm on the PWK if you scaled it and I think that's basically it.

But I don't think you can do that sort of repair in notepad.  There's just too much going on.
               
               

               


                     Modifié par OldTimeRadio, 04 septembre 2011 - 07:32 .
                     
                  


            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Changing the "center" of a placeable's model?
« Reply #2 on: September 04, 2011, 08:34:35 pm »


               <taking notes furiously...>

Great! Was on my list of tutorials to dig up.

Thanks OTR =)

<...and wishing there was a bard handy to blackmail>
               
               

               


                     Modifié par Rolo Kipp, 04 septembre 2011 - 07:35 .
                     
                  


            

Legacy_OldTimeRadio

  • Hero Member
  • *****
  • Posts: 2307
  • Karma: +0/-0
Changing the "center" of a placeable's model?
« Reply #3 on: September 04, 2011, 08:40:14 pm »


               Heh heh, well I think that's the best solution anyway.
               
               

               


                     Modifié par OldTimeRadio, 04 septembre 2011 - 07:40 .
                     
                  


            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Changing the "center" of a placeable's model?
« Reply #4 on: September 04, 2011, 08:46:39 pm »


               <waves off-handedly...>

No, no. Too late now. It'll have to do. :-)

<...busy writing in stone>
               
               

               
            

Legacy_Androrc

  • Full Member
  • ***
  • Posts: 188
  • Karma: +0/-0
Changing the "center" of a placeable's model?
« Reply #5 on: September 04, 2011, 09:40:22 pm »


               Wow, thanks! '<img'> Very detailed tutorial, I'm downloading GMax at this moment to try it out.

EDIT: Gmax isn't recognizing .mdl files, so I imagine I should use a plugin. Is this what the NWmax I've heard about is?
               
               

               


                     Modifié par Androrc, 04 septembre 2011 - 08:49 .
                     
                  


            

Legacy_Zwerkules

  • Hero Member
  • *****
  • Posts: 1997
  • Karma: +0/-0
Changing the "center" of a placeable's model?
« Reply #6 on: September 04, 2011, 09:45:47 pm »


               Those NWN2 models really need an overhaul badly. It's not just that there is a whole model for the pwk instead of just a plane, they also got shadows turned on for the whole model. NWN1 can't handle complex shadows. The engine is a lot more forgiving with placeable than it is with tiles, but I still doubt that there are no shadow problems with those models. If they were tiles, they'd make the game crash.
Also the textures used (especially for the buildings) are textures for models that are supposed to be tintable and they are very gray. For most of the buildings there are versions that are not tintable and that have proper colours.
Most of the other NWN2 models in those haks are complete, but many of the houses have parts of the model missing.
               
               

               
            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Changing the "center" of a placeable's model?
« Reply #7 on: September 04, 2011, 09:59:06 pm »


               <looks happy...>

Androrc wrote...

Wow, thanks! '<img'> Very detailed tutorial, I'm downloading GMax at this moment to try it out.

EDIT: Gmax isn't recognizing .mdl files, so I imagine I should use a plugin. Is this what the NWmax I've heard about is?


Definitely get and install NWMax. Make sure you start the NWMax listener before GMax. 

Also get Velstools... :-) Really!

Cool. Another GMax head in the room =)

<...or, perhaps, just foolish>
               
               

               
            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Changing the "center" of a placeable's model?
« Reply #8 on: September 04, 2011, 10:02:28 pm »


               <slaps his forehead...>

Zwerkules wrote...

Those NWN2 models really need an overhaul badly. It's not just that there is a whole model for the pwk instead of just a plane, they also got shadows turned on for the whole model. NWN1 can't handle complex shadows. The engine is a lot more forgiving with placeable than it is with tiles, but I still doubt that there are no shadow problems with those models. If they were tiles, they'd make the game crash.


Which reminds me, I was going to look up those tree tiles you mentioned in the Medeival thread and see what you were talking about...

Sorta reconstruct what a master did... :-)

<...and beats around the bush>
               
               

               
            

Legacy_OldTimeRadio

  • Hero Member
  • *****
  • Posts: 2307
  • Karma: +0/-0
Changing the "center" of a placeable's model?
« Reply #9 on: September 04, 2011, 10:17:52 pm »


               Hey Androrc, if you're just getting GMax/NWMax installed, you might get some use out of this tutorial video for installing your tools.

It'll help you get everything you need to get up and running, including Vel's Tools.

There are no parts 102 and so on.  Actually,  there were at one point but I couldn't get all the video clips to be spliced together.  That seriously pissed me off, BTW.  Anyway, hope that helps.

@Zwerkules - Thanks for the confirmation.  I agree about the shadows, too.  I don't do any shadows on anything I create or convert.  They add an enormous amount of overhead which is not worth the payoff in my opinion.
               
               

               


                     Modifié par OldTimeRadio, 04 septembre 2011 - 09:36 .
                     
                  


            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Changing the "center" of a placeable's model?
« Reply #10 on: September 07, 2011, 06:08:55 pm »


                <trying to make a quick getaway...>

That's good to know that the engine walks the PC to the use node.  Didn't know that.  I see possibilities...

You could (fer instance) add a transparent plane hanging down from your airship, map a rope ladder texture to it, put the use node at the end and make that the deactivated state. Add an Activate anim of the texture being raised (just sliding the t-verts up the texture) that finishes with the ladder plane completely transparent.

On use, the engine will walk the PC over to the ladder and then roll up the ladder (insert fade-out anim for PC then cut-scene of the (activated) airship moving off).

Am I right?

<...and staring in horror as the ladder rises just out of reach>
               
               

               
            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Changing the "center" of a placeable's model?
« Reply #11 on: September 07, 2011, 06:14:51 pm »


               <looking pretty scruffy...>

OldTimeRadio wrote...
@Zwerkules - Thanks for the confirmation.  I agree about the shadows, too.  I don't do any shadows on anything I create or convert.  They add an enormous amount of overhead which is not worth the payoff in my opinion.


I like what Jez_fr said:

 
- if possible do a very low poly copy of the whole model, as a single mesh (untextured), that will be used as Shadow for the whole model. This "shadow" model won't be displayed ingame (not rendered), it will only be used to "project" the shadow ingame, and spare a lot of crashes. Its kind of a LOD but only used for shadow projection (like they did in The Witcher 1, it works super well and really removes a LOT of potential crashes and issues)


I have no shadows at all on Sylvi'a, but I think when I'm doing my performace tests (dangly vs. bones, texture optimization, etc) I'm going to try the low-poly shadow caster bit, too.

Have either of you tried out that approach? Pitfalls? Things to look out for?

<...with 5 o'clock shadow>
               
               

               
            

Legacy_Bannor Bloodfist

  • Hero Member
  • *****
  • Posts: 1578
  • Karma: +0/-0
Changing the "center" of a placeable's model?
« Reply #12 on: September 07, 2011, 07:34:41 pm »


               Keep it simple.  Low poly means just that, no tubes, no round objects at all, most especially convex/concave (can't remember which is worst) objects as these cause the worst possible shadow casting issues.

Basically, any place that you have a round tube type object, create the shadow box as a box/rectangle type shape instead, only 4 sides.  

For creatures, this gets real problematical, as they always have arms/legs etc, so shaping a box to cast a shadow for them that looks right in game gets much more difficult.  Typically, you end up with bits of shadow that don't look right, ie don't exactly match the true shape of the object casting the shadow.  However, 99% of the time, folks won't notice the difference unless it is a really glaring issue.  As in if you use shadow rectangles for the arms, and you end up with a shadow that is cast in sections, IE disconnected boxes of shadows that pertain to the arm.  

For buildings/placeables, this is much less of an issue and using simple square boxes typically works.
               
               

               
            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Changing the "center" of a placeable's model?
« Reply #13 on: September 07, 2011, 08:06:17 pm »


               <shivers a little...>

Very cool!, Thank you.

<...in anticipation>