Contributor Task: Investigate rim lighting

Discussion in 'General' started by Beerdude26, Apr 14, 2011.

  1. Beerdude26

    Beerdude26 OnThink(){ IsDownYet(); }

    Messages:
    7,243
    Likes Received:
    13
    Trophy Points:
    0
    Hey all, I saw this very interesting shader option for rim lighting: http://developer.valvesoftware.com/wiki/$rimlight

    It would be greatly appreciated if someone felt like trying it out and making some comparison shots to see what it gives. Perhaps it'd be best to use Empires 2.31 (non-Steam) for this because the current Steam version has some issues with custom files at the moment.
     
  2. f1r3w4rr10r

    f1r3w4rr10r Modeler

    Messages:
    2,475
    Likes Received:
    4
    Trophy Points:
    0
    maybe make it a sticky
     
  3. flasche

    flasche Member Staff Member Moderator

    Messages:
    13,299
    Likes Received:
    168
    Trophy Points:
    0
    i doubt that it would add something you notice in a real game. distances are too big for such a gimmick ...
     
  4. Trickster

    Trickster Retired Developer

    Messages:
    16,576
    Likes Received:
    46
    Trophy Points:
    0
    Fucking, that is the shit I wanted from Modern Warfare 2 to make players clearer, I had no idea what it was.

    Also, I just saw "rim" and "make it a sticky".
     
  5. FN198

    FN198 Member

    Messages:
    2,434
    Likes Received:
    0
    Trophy Points:
    0
    glad im not the only one
     
  6. ImSpartacus

    ImSpartacus nerf spec plz

    Messages:
    8,598
    Likes Received:
    7
    Trophy Points:
    0
    Yeah, I like listening to Valve's commentary for their games. Such subtle mechanics, like rim shots lighting, can accomplish huge things, these guys are amazing.

    http://www.youtube.com/watch?v=7OZcc4n_Y2U

    0:24, Valve TF2 Team talks about color and other visual things that affect gameplay. "rim lighting" was specifically mentioned at ~1:20, but I suggest listening to the entire visual part from 0:24.

    Hell, the entire series is pretty awesome, but that specific part is relevant.

    PROTIP: These are where the gayben jokes came from.
     
  7. -Mayama-

    -Mayama- MANLY MAN BITCH

    Messages:
    6,487
    Likes Received:
    0
    Trophy Points:
    0
    I guess removing the camoflage textures would be the first step into that direction ;)
     
  8. Trickster

    Trickster Retired Developer

    Messages:
    16,576
    Likes Received:
    46
    Trophy Points:
    0
    Without a fucking doubt. Fuck camo.
     
  9. communism

    communism poof

    Messages:
    4,095
    Likes Received:
    2
    Trophy Points:
    0
    u :madman:?
     
  10. ImSpartacus

    ImSpartacus nerf spec plz

    Messages:
    8,598
    Likes Received:
    7
    Trophy Points:
    0
    *stomps foot*

    Is it freezing over?

    :|ove: :|ove: :|ove: :|ove: :|ove:
     
  11. Chris0132'

    Chris0132' Developer

    Messages:
    9,482
    Likes Received:
    0
    Trophy Points:
    0
    I think that's kinda built into phong, or at least the same sort of effect is often achieved with phong, you'd need to set up some world models for phong first, as far as I know none of them are, leastways not that I can tell.
     
  12. Demented

    Demented Member

    Messages:
    2,337
    Likes Received:
    0
    Trophy Points:
    0
    No rimlight:
    [​IMG]

    Rimlight On:
    [​IMG]

    Rimlight with Exponent 10:
    [​IMG]

    Rimlight with Boost 10:
    [​IMG]
     
  13. Grantrithor

    Grantrithor Member

    Messages:
    9,820
    Likes Received:
    11
    Trophy Points:
    0
    holla.
     
  14. dizzyone

    dizzyone I've been drinking, heavily

    Messages:
    5,771
    Likes Received:
    0
    Trophy Points:
    0
    rimlight with exponent 10, just looks perfect.

    Demented, did you notice anything special while the gun animations were playing?
     
  15. f1r3w4rr10r

    f1r3w4rr10r Modeler

    Messages:
    2,475
    Likes Received:
    4
    Trophy Points:
    0
    well i guess you would have to restrict this lighting to the outlines of an object only. As it looks rather stupid, reflecting light where it shouldnt get to

    if you realize that you could actually keep the values like in the standard rim light picture, as it is some eyecandy that wouldnt have to be used that subtle
     
  16. Demented

    Demented Member

    Messages:
    2,337
    Likes Received:
    0
    Trophy Points:
    0
    It was only playing the (perfectly still) idle animation and looked exactly like the screenshots. The rimlighting is an extension of the phong highlight, so whatever applies to the phong will have a corresponding effect to the rim light.
     
    Last edited: Apr 20, 2011
  17. blizzerd

    blizzerd Member

    Messages:
    10,552
    Likes Received:
    60
    Trophy Points:
    0
    whats this thread about i just read rim and sticky ;)

    looks cool, exp 10 looks best imo
     
  18. flasche

    flasche Member Staff Member Moderator

    Messages:
    13,299
    Likes Received:
    168
    Trophy Points:
    0
    well you see it on the gun model, now do that on a tank 20m away from you that moves at full speed. you might not even notice the difference ... it might appear a bit brighter colored as a whole, worth the extra processing?
     
  19. MOOtant

    MOOtant Member

    Messages:
    4,047
    Likes Received:
    0
    Trophy Points:
    0
    "rim lighting" is just another pass of phong with different exponent. What Demented did was adding another phong with strength so high that whole "dark metal" material turned into christmas tree exposing low res textures.

    Here's shader code: (if you don't understand you're not the target)

    Code:
    void SpecularAndRimTerms( const float3 vWorldNormal, const float3 vLightDir, const float fSpecularExponent,
    						  const float3 vEyeDir, const bool bDoAmbientOcclusion, const float fAmbientOcclusion,
    						  const bool bDoSpecularWarp, in sampler specularWarpSampler, const float fFresnel,
    						  const float3 color, const bool bDoRimLighting, const float fRimExponent,
    
    						  // Outputs
    						  out float3 specularLighting, out float3 rimLighting )
    {
    	rimLighting = float3(0.0f, 0.0f, 0.0f);
    
    	float3 vReflect = reflect( -vEyeDir, vWorldNormal );				// Reflect view through normal
    	float LdotR = saturate(dot( vReflect, vLightDir ));					// L.R	(use half-angle instead?)
    	specularLighting = pow( LdotR, fSpecularExponent );					// Raise to specular exponent
    
    	// Optionally warp as function of scalar specular and fresnel
    	if ( bDoSpecularWarp )
    		specularLighting *= tex2D( specularWarpSampler, float2(specularLighting.x, fFresnel) ); // Sample at { (L.R)^k, fresnel }
    
    	specularLighting *= saturate(dot( vWorldNormal, vLightDir ));		// Mask with N.L
    	specularLighting *= color;											// Modulate with light color
    
    	if ( bDoAmbientOcclusion )											// Optionally modulate with ambient occlusion
    		specularLighting *= fAmbientOcclusion;
    
    	if ( bDoRimLighting )												// Optionally do rim lighting
    	{
    		rimLighting  = pow( LdotR, fRimExponent );						// Raise to rim exponent
    		rimLighting *= saturate(dot( vWorldNormal, vLightDir ));		// Mask with N.L
    		rimLighting *= color;											// Modulate with light color
    	}
    }
    
     
  20. Trickster

    Trickster Retired Developer

    Messages:
    16,576
    Likes Received:
    46
    Trophy Points:
    0
    It's more important on people (i.e. character models) than first person.
     

Share This Page