Jump to content

First person legs and body


marauder2k9

Recommended Posts

It will become clear when i get it working, the idea is simple, u have 3 meshes, a high poly realistic first person hands mesh and a first person body and legs mesh as seen in the screen shot. but i want shadows to see a separate mesh, i was trying to set it up so it could be done with LOD's though but i dont think that is going to work.


1st LOD = 1st person body and legs

2nd LOD = 3rd person mesh, what the shadowpass and server sees.

then all LOD meshes after this will be as usual


I think that link you shared may be a good place to start, might just take an extra bit of code to read shadows from a separate mesh (wouldnt it be great if it was that easy =/ )

Link to comment
Share on other sites

U32 ShapeBase::getImageShapeIndex(const MountedImage& image) const
{
  U32 shapeIndex = ShapeBaseImageData::StandardImageShape;


  const ShapeBaseImageData* data = image.dataBlock;
  if (data && data->useFirstPersonShape && isFirstPerson())
     shapeIndex = ShapeBaseImageData::FirstPersonImageShape;

  if (data && data->useShadowShape)
   shapeIndex = ShapeBaseImageData::ShadowImageShape;

  return shapeIndex;
}

 


so far i have this, it seems to work correctly, i have streams set up to suit, header files set up correctly aswell, i think the problem lies here

 

for (U32 i=0; i<MaxShapes; ++i)
  {
     // Shape 0: Standard image shape
     // Shape 1: Optional first person image shape
  // Shape 2: Optional shadow shape

     StringTableEntry name;

     if (i == FirstPersonImageShape)
     {
        if ((useEyeOffset || useEyeNode) && shapeNameFP && shapeNameFP[0])
        {
           // Make use of the first person shape
           useFirstPersonShape = true;
           name = shapeNameFP;
        }
        else
        {
           // Skip the first person shape
           continue;
        }
     }

  else
     {
        name = shapeName;
     }

 

Every time i try to add another statement to this for the shadow file, it still builds but u get really bad result.


In player.cpp i have this

 

if ( state->isShadowPass() )
  {
     // Force the shadow image shapes for the shadow pass.
   imageShapeIndex = ShapeBaseImageData::ShadowImageShape;
  }

 

which is just a modification of the code that was already there to use my new image index

Link to comment
Share on other sites

Tried this again last night with a fresh version of torque to see if there was something i missed and i think i forgot to add the resources code into shapebase.cpp aswell. Just out of curiosity has anyone messed with the shape indexes before? anything i should know about like for example should all meshes be a lower index than the fp arms mesh for a reason or is that just coincidence?

Link to comment
Share on other sites

  • 2 years later...

Okay i think i have this finally working, attached to this post is how most devs do first person models for their characters. You see no torso up until the point the player can see


iIWUHXb.png

Screenshot from alien isolation.


The problem i was having before was that with a mesh similar to this it was only rendering a shadow for the arms legs etc, the 2nd lod of the model (the one used for 3rd person) had everything in the model and i wanted the shadow to come from that instead. Now i am able to do this to some extent in torque but i have to use an alpha mask for the parts of the model i want hidden. So far its been the only way i can find to do it.

Link to comment
Share on other sites

high fidelity animations in fp arms for weapons and such (finger movement etc etc) simpler animations for third person. I am getting a mocap setup soon so i probably wont need the separation of the two but most AAA devs separate them out still due to camera bleeding through parts of the mesh if the animation isnt perfect so its still good practice to remove those parts of the mesh and have the camera sitting just inside the head behind the eyes to give the proper viewpoint. This has been the usual for some time in a lot of fps games its also why in a lot of fps games there is no shadow for the playable character but for immersion reasons i want shadows on mine to suit the game style. Also if ur camera is locked to a bone that is in turn linked to other bones that have mocap movements applied to them the camera becomes really jittery and weird for the player

Link to comment
Share on other sites

There is a simple checkbox where you enable the shadows in first person of the third person model, it works well and I use it. So I do not really understand your problem. It is kind of irrelevant of what you use in first person, the shadow will always work.

Link to comment
Share on other sites

I remember trying to get a mirror working and it was the opposite but same issue I think. You got it working though?

 

I got it working for what i wanted, i dont think a mirror would work though i will try and create a mock level and upload a few screens of it with mirrors and things when i get a chance.

Link to comment
Share on other sites

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...