Jump to content
  • Advertisement
Sign in to follow this  
TheChubu

Tinted bloom?

This topic is 1130 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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).

 

Share this post


Link to post
Share on other sites
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.
... okay, but I'm going to need to know what does "tapped 2 times" and a "centered radial UV shift" means.

Share this post


Link to post
Share on other sites
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] Edited by L. Spiro

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Edited by eppo

Share this post


Link to post
Share on other sites

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?

Edited by TheChubu

Share this post


Link to post
Share on other sites

 

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);

Share this post


Link to post
Share on other sites

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.

Edited by TheChubu

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!