Dynamic shadow angles in Source 2007

Grab your favourite IDE and tinker with the innards of game engines

Dynamic shadow angles in Source 2007

Postby dark0r on Mon Nov 21, 2011 9:07 pm

Hi all,

I just wrote an article on the developer wiki explaining how to implement Left4Dead style player/entity shadows in Source 2007 (Orangebox) mods. With these changes, walking by bright lights will change the direction of your shadow.

Screenshot 1
Image

Screenshot 2
Image
Top: dynamic shadow angles
Bottom: default shadows

Take a look if you're interested
Dynamic RTT shadow angles in Source 2007

Note: this will have minimal effect on performance, which is great news!
dark0r
Been Here A While
Been Here A While
 
Joined: Sat Mar 25, 2006 10:16 am
Location: de_hell

Re: Dynamic shadow angles in Source 2007

Postby zombie@computer on Mon Nov 21, 2011 10:39 pm

Very nice.
When you are up to your neck in shit, keep your head up high
zombie@computer
Forum Goer Elite™
Forum Goer Elite™
 
Joined: Fri Dec 31, 2004 5:58 pm
Location: Lent, Netherlands

Re: Dynamic shadow angles in Source 2007

Postby Gambini on Mon Nov 21, 2011 11:06 pm

That would be a great effect i´d love to add in my mod. Too bad i know shit about coding.

Hey! it would be cool if someone could uptade this mod including this code and a few others like that fix for ambient_generic

http://www.moddb.com/mods/orange-box-ba ... lopers-kit
User avatar
Gambini
Sir Post-a-lot
Sir Post-a-lot
 
Joined: Mon Oct 20, 2008 1:52 am
Location: Buenos Aires, Argentina.

Re: Dynamic shadow angles in Source 2007

Postby dark0r on Tue Nov 22, 2011 12:17 am

Thanks guys. The same effect is also noticeable in several Counter-Strike: GO screenshots
dark0r
Been Here A While
Been Here A While
 
Joined: Sat Mar 25, 2006 10:16 am
Location: de_hell

Re: Dynamic shadow angles in Source 2007

Postby zombie@computer on Tue Nov 22, 2011 9:39 am

Shit, Kremator found out, now he wants it in Canvas.

Congrats darkOr, you are now officially contributing to Canvas.
When you are up to your neck in shit, keep your head up high
zombie@computer
Forum Goer Elite™
Forum Goer Elite™
 
Joined: Fri Dec 31, 2004 5:58 pm
Location: Lent, Netherlands

Re: Dynamic shadow angles in Source 2007

Postby zombie@computer on Tue Nov 22, 2011 11:04 am

Perhaps i misssed something or im using the wrong codebase but i had to add

void UpdateShadowDirectionFromLocalLightSource( ClientShadowHandle_t shadowHandle );
const Vector &CClientShadowMgr::GetShadowDirection( ClientShadowHandle_t shadowHandle ) const;
void UpdateDirtyShadow( ClientShadowHandle_t handle );

to the class definition before it worked.

OK, it's working great, but the shadow switching between two lights is... odd. Is it possible to have multiple shadows (one fading in, one fading out, for each light in the neighborhood) this way, or would that not be possible?
Assuming you already investigated that, i guess it's an obvious next step.

Tnx!
When you are up to your neck in shit, keep your head up high
zombie@computer
Forum Goer Elite™
Forum Goer Elite™
 
Joined: Fri Dec 31, 2004 5:58 pm
Location: Lent, Netherlands

Re: Dynamic shadow angles in Source 2007

Postby Gary on Tue Nov 22, 2011 11:21 am

He is currently working on fading/color changing shadows. He has to localize them(currently changing the color/alpha of one shadow affects all).

Multiple shadows sounds interesting, I don't see why it can't be possible.
Have a question related to modding or something I posted? Something that needs staff attention? I haven't been active lately, but feel free to PM me or message me on Steam(link below)

User avatar
Gary
Interlopers Staff
Interlopers Staff
 
Joined: Wed Dec 16, 2009 12:40 am
Location: USA, FL

Re: Dynamic shadow angles in Source 2007

Postby dark0r on Tue Nov 22, 2011 11:38 am

zombie@computer wrote:Perhaps i misssed something or im using the wrong codebase but i had to add

void UpdateShadowDirectionFromLocalLightSource( ClientShadowHandle_t shadowHandle );
const Vector &CClientShadowMgr::GetShadowDirection( ClientShadowHandle_t shadowHandle ) const;
void UpdateDirtyShadow( ClientShadowHandle_t handle );

to the class definition before it worked.

Thanks zombie, added the steps to the article now.
zombie@computer wrote:OK, it's working great, but the shadow switching between two lights is... odd. Is it possible to have multiple shadows (one fading in, one fading out, for each light in the neighborhood) this way, or would that not be possible?
Assuming you already investigated that, i guess it's an obvious next step.

I was thinking about multiple shadows myself, and will give it a shot when I get per-entity shadow colours functional. I will add a ConVar such as r_worldlight_shadowsperentity which will define the maximum number of shadows an entity may have. The brightest lights around an entity will then cast independent shadows, instead of the most intense light casting a single shadow.

In the meantime, try increasing r_worldlight_mincastintensity, or decreasing r_worldlight_lerptime.
dark0r
Been Here A While
Been Here A While
 
Joined: Sat Mar 25, 2006 10:16 am
Location: de_hell

Re: Dynamic shadow angles in Source 2007

Postby joe_rogers_11155 on Tue Nov 22, 2011 7:28 pm

this is pretty stunning. I'm looking forward to seeing those multiple shadows. I wonder how high in number it can go?
"Day breaks, but decay soon follows." - Ava Winona
Currently developing in radio silence... 99 Bolts
Here's another project of mine... Assault on Overwatch
Are you new to Source SDK? VDC
joe_rogers_11155
Veteran
Veteran
 
Joined: Wed Oct 08, 2008 11:11 pm
Location: United States

Re: Dynamic shadow angles in Source 2007

Postby dark0r on Tue Nov 22, 2011 7:50 pm

Independent shadow colours have now been implemented:
Image

Next step is multiple shadows (at varying alphas).
dark0r
Been Here A While
Been Here A While
 
Joined: Sat Mar 25, 2006 10:16 am
Location: de_hell

Re: Dynamic shadow angles in Source 2007

Postby ThrillerProd on Wed Nov 23, 2011 6:10 pm

You are my GOD !

I wait a long time to see a tutorial like this !

Thank you VERY MUCH !!!

Can't wait to implement it !

EDIT :

I implement it, no error of compilation, juste, game crash on launching a map...

REEDIT :

That work only for certain map, not for all... it's strange...

REREEDIT :

I found the problem, if you have no light_environement in your map, the game crash ! ^^

So I hop you can fix that and add multiple shadow !

Thanks for all !
Actinium Studio
User avatar
ThrillerProd
Dumpling
Dumpling
 
Joined: Sun Dec 12, 2010 10:00 am

Re: Dynamic shadow angles in Source 2007

Postby cashed on Sat Dec 03, 2011 10:49 pm

saul great work, and i do not think csgo has done this. its the same old sun casts the shadow in the current beta.
User avatar
cashed
Regular
Regular
 
Joined: Fri Apr 06, 2007 12:21 am
Location: London, Ontario, Canada

Re: Dynamic shadow angles in Source 2007

Postby joe_rogers_11155 on Sat Dec 03, 2011 11:35 pm

@cashed: they will probably include it as beta draws closer into final.
"Day breaks, but decay soon follows." - Ava Winona
Currently developing in radio silence... 99 Bolts
Here's another project of mine... Assault on Overwatch
Are you new to Source SDK? VDC
joe_rogers_11155
Veteran
Veteran
 
Joined: Wed Oct 08, 2008 11:11 pm
Location: United States

Re: Dynamic shadow angles in Source 2007

Postby IBeMad on Sun Jan 22, 2012 10:20 pm

Any update on multiple shadows per entity?
IBeMad
Member
Member
 
Joined: Sun Jan 22, 2012 5:18 pm

Re: Dynamic shadow angles in Source 2007

Postby dark0r on Mon Jan 23, 2012 7:03 am

I've been busy with exams since the end of November, so unfortunately not. They finish tomorrow, so I'll get straight back to work, don't worry... I haven't left them.
dark0r
Been Here A While
Been Here A While
 
Joined: Sat Mar 25, 2006 10:16 am
Location: de_hell
Next

Return to Programming

Who is online

Users browsing this forum: No registered users