Logistics of first person arms and third person shadow

Started by
6 comments, last by vinnyhalts 10 years, 10 months ago

Hi, I have a few questions about first person setups in general. I understand the basics:

  1. Draw the first person view in front of the camera
  2. Disable casting a shadow (so you don't see a shadow of some floating arms).
  3. Play the animations based on what you are doing, etc.

There are a few things I don't understand. In games like Battlefield and Halo 2/3 you can see your legs. Do I just create the legs below the view of my camera, similar to the arms, and go from there?

Also, when playing games that have shadows, aside from Battlefield 3 (on Xbox), you can see your entire player's shadow. How do they do this? Do they not draw the model, but draw the shadow?

If anyone has some advice, I will be glad to listen to it. My mindset might be thinking about this in all the wrong ways. Thanks!

Advertisement

Hi, I have a few questions about first person setups in general. I understand the basics:


1. Draw the first person view in front of the camera
2. Disable casting a shadow (so you don't see a shadow of some floating arms).
3. Play the animations based on what you are doing, etc.

Obviously you are already a bit sidetracked on the basics. There is no such thing as "disable rendering shadows" for any given graphics configuration. There isn't even such a thing as "render shadows". Shadowmapping is a seperate render step. Basically, you render the whole scene from the lights point of view, and you simply ignore any objects that should not cast a shadow. Then, in the lighting pass, you take that renderer shadow-map into account whether an object should be lit or not.

This should already answer most of your questions. Scene and shadow rendering are independant passes, so you can easily have a model that is rendered but does not cast a show and vice versa.

Hi, I have a few questions about first person setups in general. I understand the basics:


1. Draw the first person view in front of the camera
2. Disable casting a shadow (so you don't see a shadow of some floating arms).
3. Play the animations based on what you are doing, etc.

Obviously you are already a bit sidetracked on the basics. There is no such thing as "disable rendering shadows" for any given graphics configuration. There isn't even such a thing as "render shadows". Shadowmapping is a seperate render step. Basically, you render the whole scene from the lights point of view, and you simply ignore any objects that should not cast a shadow. Then, in the lighting pass, you take that renderer shadow-map into account whether an object should be lit or not.

This should already answer most of your questions. Scene and shadow rendering are independant passes, so you can easily have a model that is rendered but does not cast a show and vice versa.

Hey, thanks for replying. I get that shadowmapping is a separate step. I can already selectively disable shadows for any entity.

pjbOYjA.jpg6TxBNTk.jpg

I'm more or less asking about the logic of what the best setup would be. I understand that if I make arms and legs for the first person view, I need to disable the shadows for it. I want to know what the most common techniques are for these types of things.

Do I draw just the shadows for the entire model, along the graphics for my first person legs and arms? It seems very wasteful to me, since my game will be running on low end hardware.

Thanks again for replying to me.

Often in FPS games, the arms aren't even really in the world. By this I mean, that the entire world is rendered using some particular camera, then the arms/gun are drawn using a completely different camera and depth-buffer, so that they never intersect with the world and so the artists can use FOV-hacks to make them "look right".

Yep, you obviously don't want to include just a pair of arms in your shadow pass, or it will look very strange when the player looks down! Same goes for a model that only includes legs.

The game will have logic for drawing a player in the 3rd person vs 1st person -- i.e. the way the game draws another player may be different to the way it draws yourself (arm + leg specialized model for yourself, whole body for others).

When drawing from the light's point of view, none of the players would use the specialized 1st person mode; every player is drawn as a 3rd person player.

In other games, there isn't much of a specialized 1st person mode, and when in first person, all they do is disable rendering of the head and place the camera there -- the arms/legs/body is the same as it would draw for a 3rd person view.

Often in FPS games, the arms aren't even really in the world. By this I mean, that the entire world is rendered using some particular camera, then the arms/gun are drawn using a completely different camera and depth-buffer, so that they never intersect with the world and so the artists can use FOV-hacks to make them "look right".

Yep, you obviously don't want to include just a pair of arms in your shadow pass, or it will look very strange when the player looks down! Same goes for a model that only includes legs.

The game will have logic for drawing a player in the 3rd person vs 1st person -- i.e. the way the game draws another player may be different to the way it draws yourself (arm + leg specialized model for yourself, whole body for others).

When drawing from the light's point of view, none of the players would use the specialized 1st person mode; every player is drawn as a 3rd person player.

In other games, there isn't much of a specialized 1st person mode, and when in first person, all they do is disable rendering of the head and place the camera there -- the arms/legs/body is the same as it would draw for a 3rd person view.

Thanks, I'm going to give this a test after I get back from work. I assume that with some games, where the hands and weapons change when you are near a bright light, are using a separate camera with the player's POV, just rendered to a texture?

So for example, if my game has a long hallway in it, where you walk under many hanging lights. Each time I walk between two lights, my first person hands get darker, and the reverse whenever I walk under a light. So I just have a second camera follow the player (with the same world and view matrix) and render the first person view to a texture, then draw the texture to the screen?

That makes sense in my head, hopefully it will for you too.

You should not need to render the first person arms to a texture, instead render them to the backbuffer after the world rendering. If you're using different fov / nearclip / farclip settings for the first person arms camera, you can clear depth beforehand to avoid problems with the world objects interfering with the arms rendering. The first person arms model just needs to be roughly at the correct point in the world so it will get the world lights applied to it properly.

Worth mentioning, since you brought it up: Halo 2 and later skip all this crap by using the in-world player model for first-person weapon views. It's actually a lot harder than it sounds.

clb: At the end of 2012, the positions of jupiter, saturn, mercury, and deimos are aligned so as to cause a denormalized flush-to-zero bug when computing earth's gravitational force, slinging it to the sun.

Worth mentioning, since you brought it up: Halo 2 and later skip all this crap by using the in-world player model for first-person weapon views. It's actually a lot harder than it sounds.

Are you sure, I remember the shadows being slightly off for first and third person models. An example is in Halo 3: When you reload a gun, there is a very slight delay of about half a second after your first person view has finished reloading, where you cannot shoot. During this time, you can see your shadow finishing up the third person reloading animations. Theater mode is very handy for small things like that.

This topic is closed to new replies.

Advertisement