Close

Hey,

As it’s a new website, let’s celebrate this in a cool way. I’m going to share with you how to put some dirty lens on your ENB settings.

What you’ll need, first :

  • GTA IV or even Skyrim.
  • Small knowledge in the .fx files.
  • Hands, bionic or not.
  • A texture.
  • UsePaletteTexture to 1 in the INI

[image source=’http://icelaglace.com/assets/uploads/2013/06/post-162172-0-73627800-1329937358_thumb1.jpg’ width=’100′ height=’100′ title=’Dirty Lens Texture example’ colorbox=’true’ color_overlay=’dark’ icon_overlay=’down’] [blockquote source=’Someone who cares about you’]Get this example, if you don’t have any. Save it & open it on Paint. Then re-save it to BMP.[/blockquote]

First thing to do is to identify what name is used for your main texture (the color) : By default it’s r0 but it can be color. Easy way to know is to search for “color=r0”. If not, then it’ll be r0 for you.

But keep in mind you can just do :

[code]float4 color = r0;[/code]

Once you know what’s going on, try to find where the bloom is getting done. Bloom by default is r2 but it can be colorBloom. Same thing as before, you can just put another float if you want.

What we will look for now, is the palette. ENB loads an external palette file in BMP, it has to be registered in your .fx (normally is)

– Remove the part where the palette is done (normally at the end of the code before the original game post effect ASM code)

– Now place this part before the bloom computation :

[code]//dirty lens code
float4 dirtPaletteTex=tex2D(s13, _v0.xy); //use the palette texture for the lens
float4 uvsrc=0.0; //set the UVs
float3 lensDirt=dirtPaletteTex.xyz;
[/code]

Once it’s done, place this thing above where the bloom is done :

[code]colorBloom.xyz+=colorBloom.xyz*lensDirt.xyz*0.2; // 0.2 is the intensity[/code]

Then you can merge your colorBloom to r0 or color.xyz.

It is a very simple code, you can if you want add a threshold & more.
I suggest you to do a very contrasted image for the palette so the white will be illuminated with the bloom & not the black parts.

If you need more help or suggestions. Feel free to comment or anything.


(thanks to gp65cj04 too)

10 comments

  1. siraniks Reply June 1, 2013 at 9:51 am

    since no one hasn’t commented yet. Maybe a shameful first comment here :)

    your webpage is clean and neat congrats :) I very like it and it’s simple
    btw, thanks for sharing the idea about dirty lens code can this be applied to other games as well besides GTA IV or Skyrim?

    • Hayssam Keilany Reply June 1, 2013 at 9:59 am

      Well, it can work as long as you have access to the bloom – Yeah, you could put it full screen using the HDR adaptation only but it’ll suck.

  2. GunMod Reply June 1, 2013 at 5:23 pm

    Call me an idiot, but are you talking about the icebloom.fx or iceshader.fx?
    I’m trying to implement this in GTA IV but the only file I can find a r0 variable in is iceshader.fx
    Do you have a file that has the code in the proper places I could switch over to GTA IV?

  3. opezdl Reply June 1, 2013 at 5:54 pm

    actually this one is to simple way for this shader…
    much better if u add some luma and screen position weigthing – that will also help you to fake sun occulion vector of the camera lens 😉

    • Hayssam Keilany Reply June 2, 2013 at 12:15 am

      Why? Dust is not appearing on the sun only. I don’t want it to be like BF3. You can clamp the luma like you said. But get your camera, make it dirty (actually, lend a camera for that lol) You’ll see what I mean. But sure, if you wanna post your more elaborated code, feel free to do it, I can put your version on the article too xD. Cheers mate

  4. Mr.GTX Reply June 3, 2013 at 6:51 am

    to do so?
    [COLORCORRECTION]
    UsePaletteTexture = false
    UsePaletteTexture 1 = true
    And another question ….
    How should I name the file BMP?

    • monete Reply July 20, 2013 at 1:41 am

      UsePaletteTexture = true

      If you use original ENBSeries rename it to enbpalette.bmp and if you use icenhancer to icepalette.bmp

  5. Cosmin Reply June 3, 2013 at 11:37 am

    Hello Haysam!Can you explain how to install this step-by-step for noobs like me?

  6. Spear98CZ Reply July 29, 2014 at 3:37 am

    Where is dirty lens texture?

Leave a reply

Your email address will not be published. Required fields are marked *

Go top