[Kind of completed] HDR effect script similar to Source Engine

Hello!

I’ve made a HDR effect script similar to Source Engine which is useful for realistic type of games on Roblox.


This script is not perfect but it works.
ezgif-4-3117118f65
The script can now react on walls when the color is brighter or darker when the camera is too close
ezgif-4-bc3ea7e9f2
Sadly the script dosent react on shadows


How it works?

The script creates two raycast rays from the current camera to the position where the camera is looking at. The first ray which is the normal one reacts for how close the part is to the camera, if the part is too close to the camera the brightness changes to the high value using brightness, contrast and bloom. To the second ray it reacts for how close the camera is to the part using colors, if the camera is too close to the part with the color that is bright it changes brightness to 0 but if the color of the part i darker then it will work the same as the first ray does. The script uses ZonePlus module to create zones that are dark, when the player enters those zones then the script adds more brightness to the environment. This script is much diffrent than the Half-life 2 HDR explenation in the developer commentary in some cases due to the roblox’s scripting limitations

If you don’t know how the Source Engine HDR looks like here’s a Half-life 2 video with a developer commentary about HDR.

How to use it?

The instruction for placing the script and the folder for dark zones are inside the model.
You can add parts to the blacklist or change the dark zones folder location in the settings module inside the HDR module.
You can change the intensity of the brightness inside the local script.

Also remove the current bloom on the lighting because you will get very bright results

Why did i made this?

I was just bored so i created this script, also i didn’t saw anyone use the method with custom HDR and resources with HDR script so i thought i will be first for making this script.


Anyway here’s the link for the model:

Also here’s the example place for testing out the HDR effect
HDRExample2.rbxl (136,4 KB)

I was rushed to make this post so expect some changes and fixes

47 Likes

This is actually pretty cool. A lot of “realistic graphics” games don’t take this into consideration.

4 Likes

This is the most subtle detail that I would have never thought about but is so freaking needed. Amazing resource.

4 Likes

I did everything according to the instructions, but I got this error

1 Like

you should check the local script and add WaitForChild(“HDR”) when requiring the HDR module script or i think there’s something going on the script.

2 Likes

Hey! For the HDR zones, are those the “dark zones”?

Would you be able to post a rbxl example?

Yeah!
I’ve updated the post and added the rbxl file
or download it here:
HDRExample.rbxl (93,3 KB)

This is amazing, thanks for sharing!

1 Like

I don’t know how did that happend but i got flashbanged by this
maybe change up the lighting? Still its a first version of the HDR effect
But the script is intended for darker maps for now

1 Like

Update log on HDR effect script

Version: 1.1

  • You can now change the HDR brightness intensity inside the local script
  • The script can now effect on how close the camera is to the part depending on color
  • Few fixes

I haven’t exactly looked into the source code myself as I’m busy at the moment, but thought to ask:

Does this script take into consideration if the raycast cannot ever make contact with a surface, and how does it handle it?

I guess this question is much like does the raycast return nil, but the brightness value defaults to a number that assumes no wall is closeby?

If so, really cool implementation and I’ll consider using this for some experiences to test performance and other things.

Also, Merry Christmas!

Adding this to my source engine clone, it seems so well made!

1 Like

Update Log #2

Version 1.2

  • Fixed that if the player dies while the player is in a dark zone the brightness will be the same and not changed after respawning and also while the player is not in the dark zone, the zoneplus module would break and don’t work
    (this update is what i mostly encountered)

Update Log #3

Version 1.3

  • Fixed that the brightness will go up and up after the player dies and respawns
    (this update is what i mostly encountered)

You should be checking if camera is in the zone, not the player.

1 Like

True that makes sense, i dont think zoneplus supports cameras though

1 Like

I think you should look into using smart raycasts, might improve the viewport sided detection and general performance.