About Store Forum Documentation Contact



Post Reply 
Fixes for headless shadows and reflections
Author Message
Mikesanimation Offline
Member

Post: #1
Fixes for headless shadows and reflections
I noticed that while in first person your head does not cast shadows (in some of the tutorials this is fixed, but not all) and that you can not see your head in the reflection of water/mirrors.
The easy fix for this is just:

Code:
void Player::draw() //or where ever you draw your player
{
   Bool disable_head_draw=(Renderer() != RM_SHD_MAP && Renderer() != RM_SOLID_M); // disable drawing head when we're not in shadowing mode or reflection mode
   if(disable_head_draw)mesh->hide("head"); // hide "head" mesh part in 'mesh'

   __super::draw(); // call default drawing

   if(disable_head_draw)mesh->show("head"); // un-hide "head" mesh part, so other objects which use the same mesh will have the head rendered properly

}
12-15-2009 08:22 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Fixes for headless shadows and reflections
in what tutorials you experience this issue?
12-15-2009 05:23 PM
Find all posts by this user Quote this message in a reply
Mikesanimation Offline
Member

Post: #3
RE: Fixes for headless shadows and reflections
Heh one of the older Camera mode tutorials (no clue when it was from, but I just pulled up a copy, its fixed now pfft) all though it doesn't take reflections into account:
Code:
Bool disable_head_draw=(View==VIEW_FPP && Renderer()!=RM_SHD_MAP && mesh);
This is 16 - Camera Modes.cpp
12-16-2009 05:25 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: Fixes for headless shadows and reflections
thats ok, there is no water in this tutorial
12-16-2009 05:36 AM
Find all posts by this user Quote this message in a reply
Mikesanimation Offline
Member

Post: #5
RE: Fixes for headless shadows and reflections
If RM_SOLID_M has been removed in the latest version, how can I draw my player with a head only when looking into reflections (water, etc) and shadows in FPV mode?

For example, if you had:
Code:
UInt Player::drawPrepare()
{
   Bool hide_head=(View==VIEW_FPP && mesh); // disable drawing head when we're in FPP mode

   if(hide_head)mesh->hide("head"); // hide "head" mesh part in 'mesh'

   UInt modes=__super::drawPrepare(); // call default drawing

   if(hide_head)mesh->show("head"); // un-hide "head" mesh part, so other objects which use the same mesh will have the head rendered properly
   return modes;
}

How can I add it so the head will get rendered with reflections?
01-11-2010 06:56 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #6
RE: Fixes for headless shadows and reflections
&& !Renderer.mirror()

and for shadows:
in Chr::drawShadow you just call mesh->drawShadow (without any head hiding)
01-11-2010 04:44 PM
Find all posts by this user Quote this message in a reply
Mikesanimation Offline
Member

Post: #7
RE: Fixes for headless shadows and reflections
Thank you smile
01-11-2010 05:23 PM
Find all posts by this user Quote this message in a reply
Post Reply