Tinted bloom?

Started by
12 comments, last by TheChubu 8 years, 8 months ago

Hi! Please look at these pictures (they're from Planetside 2)

planetside2-2012-11-2elshe.jpg

TRCG-7.png

As you may notice, the glow of the sun and the bloom of the surfaces has this tint that looks to depend on the direction. I'm not terribly sure whats going on.

I added (for teh lulz) a chromatic aberration shader on the bloom pass:

[attachment=28455:bloom.jpg]

But it doesn't quite looks the same. Besides, from the Planetside 2 pics you can see the tinting doesn't always follow the same direction (sometimes its reddish to blueish from right to left, sometimes from top to bottom, and so on).

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

My journals: dustArtemis ECS framework and Making a Terrain Generator

Advertisement

Looks like the bloom buffer is tapped 2 times with a centered radial UV shift and each tap is tinted with a purple and orange tint and added together.


Looks like the bloom buffer is tapped 2 times with a centered radial UV shift and each tap is tinted with a purple and orange tint and added together.
... okay, but I'm going to need to know what does "tapped 2 times" and a "centered radial UV shift" means.

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

My journals: dustArtemis ECS framework and Making a Terrain Generator

One way is to do a single standard bloom pass (which involves all steps necessary to create the bloom texture) but along with each offset/weight you pass to the shader also pass a single or color mask to be multiplied with each sample as you take them.
Also note that passing weights is sometimes omitted in bloom, but when it is used it could actually be fully merged with the color mask.


Another way (mentioned above) is to do this using a standard bloom result but sampling that texture differently based on the effect you want.
For strong chromatic aberrations you can sample the bloom texture in 3 different locations, 1 for red, 1 for green, and 1 for blue. Similarly, you can sample it here in 2 locations with a tint for each (mentioned above).


L. Spiro

[EDIT]
Page idiotically jumped just before I clicked and put the down-vote button on TheChubu’s post under my cursor.
I would be obliged if someone could undo that down-vote.
[/EDIT]

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

About the direction of the tinting, it seems like it's based on vector to screen center.

Else as all others said. Usual bloom just with that screen center based offset for chromatic aberration

I'm not sure it's bloom/lens related. It seems the light has already been shifted somehow before it's reflected on the water surface and reaches the camera - that's why it looks upside-down.

I would reflect the ray from the camera to the surface back to the light source, then colorize it based on where it hits the light disc.

Excess light is then blurred/redistributed afterwards.

So the two proposals are:

  1. To shift bloom result based on fragment to center vector.
  2. To do it in the directional light pass, shifting the lighting itself before the bloom pass.

Both make sense, I'll try with the simplest (1) one and see what I get. Thanks a lot !

EDIT: BTW I'm not terribly sure how would you detect where the ray hits the light disc? Some intersection function?

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

My journals: dustArtemis ECS framework and Making a Terrain Generator

EDIT: BTW I'm not terribly sure how would you detect where the ray hits the light disc? Some intersection function?

Yes, with an intersection function. A disc is always planar. You have to chose a point on a plane to test against anyway, so you can just do:


t = distFromPlane(discCenter, discNormal, rayOrigin, rayDirection)
hitPos = rayOrigin + rayDirection * t;
if (length(hitPos -  discCenter) >= discRadius)
    discardOrSomething;


distFromPlane(discCenter, discNormal, rayOrigin, rayDirection):
    if (dot(rayDirection, discNormal) >= 0)
        return 0;
    return dot(discCenter - rayOrigin) / dot(rayDirection, discNormal);

I'm sorry about any spelling or grammar mistakes or any undue brevity, as I'm most likely typing on my phone

"Hell, there's more evidence that we are just living in a frequency wave that flows in harmonic balance creating the universe and all its existence." ~ GDchat

The issue is, I'm not terribly sure where to put the disc center. All I got is a light direction for the "sun", not a position. All of this ties in with something else I have yet to implement, rendering the glowy sun disc, so no idea how to do that.

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

My journals: dustArtemis ECS framework and Making a Terrain Generator

Your chromatic aberration does look very close to the Planetside pics, except, it looks like you're doing something like:
offset = float2(1,1) * pixelSize
uv1 = uv + offset
uv2 = uv - offset


And they're doing something like:
offset = normalize(uv*2-1) * pixelSize
uv1 = uv + offset
uv2 = uv - offset


(btw this code is what I think Ryokeen was suggesting too)

This topic is closed to new replies.

Advertisement