Advertisement
Guest User

emboss code

a guest
Jun 15th, 2019
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. /*
  2. Full credits to the ReShade team
  3. Ported by Insomnia
  4. */
  5.  
  6. uniform float fEmbossPower <
  7. ui_type = "drag";
  8. ui_min = 0.01; ui_max = 2.0;
  9. ui_label = "Emboss Power";
  10. > = 0.150;
  11. uniform float fEmbossOffset <
  12. ui_type = "drag";
  13. ui_min = 0.1; ui_max = 5.0;
  14. ui_label = "Emboss Offset";
  15. > = 1.00;
  16. uniform float iEmbossAngle <
  17. ui_type = "drag";
  18. ui_min = 0.0; ui_max = 360.0;
  19. ui_label = "Emboss Angle";
  20. > = 90.00;
  21.  
  22. #include "ReShade.fxh"
  23.  
  24. float3 EmbossPass(float4 vpos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
  25. {
  26. //float4 res = 0;
  27. float3 color = tex2D(ReShade::BackBuffer, texcoord).rgb;
  28.  
  29. float2 offset;
  30. sincos(radians( iEmbossAngle), offset.y, offset.x);
  31. float3 col1 = tex2D(ReShade::BackBuffer, texcoord - ReShade::PixelSize*fEmbossOffset*offset).rgb;
  32. float3 col2 = color.rgb;
  33. float3 col3 = tex2D(ReShade::BackBuffer, texcoord + ReShade::PixelSize*fEmbossOffset*offset).rgb;
  34.  
  35.  
  36.  
  37. float3 colEmboss = col1 * 2.0 - col2 - col3;
  38.  
  39. float colDot = max(0,dot(colEmboss, 0.333))*fEmbossPower;
  40.  
  41. float3 colFinal = col2 - colDot;
  42.  
  43. float luminance = dot( col2, float3( 0.6, 0.2, 0.2 ) );
  44.  
  45. color.xyz = lerp( colFinal, col2, luminance * luminance ).xyz;
  46.  
  47. return color;
  48.  
  49. }
  50.  
  51. technique Emboss_Tech
  52. {
  53. pass Emboss
  54. {
  55. VertexShader = PostProcessVS;
  56. PixelShader = EmbossPass;
  57. }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement