When you aim at an entity with your flashlight on, the flashlight draws a dynamic shadow behind them.
This is something i do not want, since for my gamemode i want a player to be almost totally invisible. The shadows make them too easy to spot.
My first attempt:
[lua]
ply:DrawShadow( false )
ply:SetRenderMode( RENDERMODE_TRANSALPHA )
ply:SetColor( Color( 255, 255, 255, 10 ) ) // Set their alpha to 10[/lua]
This draws the player almost invisible, but the player still casts dynamic shadows. DrawShadow( false ) only affects the normal shadow that a player casts (the one that draws directly under them).
My second attempt:
[lua]ply:SetNoDraw( true ) // Completely disable the player from drawing normally[/lua]
So now this is where shit gets interesting. SetNoDraw is hardcore since if any player joins after this has been set on a given entity, said entity won't be networked to the player when they join. This could be problematic for some people, but it's not an issue here (thankfully).
SetNoDraw actually disables dynamic shadows. It disables drawing everything on an entity. The problem arises when i try to use a hacky workaround to re-draw the player on the client:
[lua]
function GM:DrawStalkerOutline( amt ) // manually drawing the invisible player - this function is being called in GM:RenderScreenspaceEffects
cam.Start3D( EyePos(), EyeAngles() )
for k,v in pairs( team.GetPlayers( TEAM_STALKER ) ) do
if v:Alive() then
render.SuppressEngineLighting( true )
render.SetBlend( 0.04 ) // draw the player nearly invisible
cam.IgnoreZ( false )
v:SetupBones()
v:DrawModel()
render.SuppressEngineLighting( false )
render.SetBlend( 1.0 )
end
end
cam.End3D()
end[/lua]
The problem here is that the player is drawn in the christ pose sometimes. I assume this is a side effect of using SetNoDraw on a player.
My question is, how can i fix this? Is there a way to force the player's bone positions to get calculated even if i've run SetNoDraw on the player? Is there even an alternative to this method which is less hacky? Any help is appreciated.
Can't you use SetNoDraw clientside?
imo DrawShadow(bool) not working on players is a bug for garry
I'll try using it clientside and see what happens.
The Portal 2 engine has a keyvalue for this, I think
It does, indeed. I already made a thread about a possible binding for deactivating dynamic shadows on specific entities by request but it was DDT'd on updates and I didn't bother remaking it. By the way, drawing models manually doesn't do anything. The dynamic shadows are a bugger sometimes.
[QUOTE=danielga;38164138]It does, indeed. I already made a thread about a possible binding for deactivating dynamic shadows on specific entities by request but it was DDT'd on updates and I didn't bother remaking it. By the way, drawing models manually doesn't do anything. The dynamic shadows are a bugger sometimes.[/QUOTE]
People are telling me that my hacky workaround has worked and there are no dynamic shadows. But it fucks up the player animations.
You can't set keyvalues on players so that's out of the question.
[url]http://wiki.garrysmod.com/page/Enums/EF[/url]
i'm praying to god one of these works. SetNoDraw fucks up player animations, as i've noticed from some clientside tests
Sorry, you need to Log In to post a reply to this thread.