[REQ] Vibrant Bloom

share shaders here
  • Author
  • Message
Offline
User avatar
*blah-blah-blah maniac*
Posts: 17562
Joined: 27 Dec 2011, 08:53
Location: Rather not to say

Re: [REQ] Vibrant Bloom

For such simple effect you don't need multipass rendering, there are alpha blending modes always available to mix bloom on to screen.
_________________
i9-9900k, 64Gb RAM, RTX 3060 12Gb, Win7

Offline
User avatar
*blah-blah-blah maniac*
Posts: 530
Joined: 30 Jan 2012, 13:18

Re: [REQ] Vibrant Bloom

Sorry to bug you but could you do a simple example? Details like saturation/vibrance and all that stuff can be done by me but blurring etc, I need an example I can work with/extend.

Offline
User avatar
*blah-blah-blah maniac*
Posts: 17562
Joined: 27 Dec 2011, 08:53
Location: Rather not to say

Re: [REQ] Vibrant Bloom

code like this draw image in P0 pass, then in P1 it add to it another image via alpha blending
technique PostProcess
{
pass P0
{
VertexShader=compile vs_3_0 VS_PostProcess();
PixelShader =compile ps_3_0 PS_PostProcess();

AlphaBlendEnable=FALSE;
}
pass P1
{
VertexShader=compile vs_3_0 VS_Bloom();
PixelShader =compile ps_3_0 PS_Bloom();

AlphaBlendEnable=TRUE;
SrcBlend=ONE;
DestBlend=ONE;
}
}
Bloom in single pass have very low performance for big ranges, even with smart offsets to reduce sampling. Almost all old versions have automatic mipmap generation, so you need to use tex2Dlod to choose proper mipmap and blur several stages to get smooth look, not just bilinear downsampling as it is (don't forget to set linear filtering for sampler). If not work mipmap (don't remember in which versions i disabled, probably starting from 0.076), use blur offsets which have greater step depending from distance from center pixel and sample in to middle of four interpolated pixels, not center of each one.
_________________
i9-9900k, 64Gb RAM, RTX 3060 12Gb, Win7

Offline
User avatar
*blah-blah-blah maniac*
Posts: 530
Joined: 30 Jan 2012, 13:18

Re: [REQ] Vibrant Bloom

This may sound dumb but this is too complicated for me. I understood the part with alpha blending n stuff but how can I choose mipmaps with tex2dlod (and what would that do?) and what I completely have no idea of is how to sample in of the middle (how?) of four interpolated (what?) pixels. I suppose you mean rendering the bloom in a lower res image and upscale it which will get it blurred without additional code but I may also be completely wrong. My knowledge isn't that high, I know about stuff inside pixel shader, what I dunno is how to modify vertex shader or working in multiple passes.

Offline
User avatar
*blah-blah-blah maniac*
Posts: 17562
Joined: 27 Dec 2011, 08:53
Location: Rather not to say

Re: [REQ] Vibrant Bloom

Image

Mipmaps turned on when:
sampler2D SamplerColor = sampler_state
{
Texture = <texColor>;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = LINEAR;//THIS SET TO LINEAR INSTEAD OF "NONE"
AddressU = Clamp;
AddressV = Clamp;
SRGBTexture=FALSE;
MaxMipLevel=0;
MipMapLodBias=0;
};
And of course version is old, which generate mipmaps.
To read mipmap, use this:
float4 coord=0.0;
coord.xy=IN.txcoord.xy;
coord.w=1; //level of mipmap, 0 is full screen size, 1 is half size, 2 is quater, etc.
color=tex2Dlod(SamplerColor, coord);
Shader must be 3_0 set in technique.
_________________
i9-9900k, 64Gb RAM, RTX 3060 12Gb, Win7

Offline
User avatar
*master*
Posts: 119
Joined: 05 Jan 2012, 22:34
Location: France

Re: [REQ] Vibrant Bloom

Haha , thanks Boris for the more detailed explanation than mine.
Like I said there are multiple methods to do bloom. I didn't know ENB was doing automatic mipmapping... that's interesting.
I was talking about reducing it manually on the DX window code the resolution of each pass of bloom because I still think that doing it in multiple texture passes allow a better control & quality but if you can do mipmapping on it, then that's amazing! I really should try that generic ENB !
Is it the same for 0.076? :)

Offline
User avatar
*blah-blah-blah maniac*
Posts: 17562
Joined: 27 Dec 2011, 08:53
Location: Rather not to say

Re: [REQ] Vibrant Bloom

I don't remember which versions have mipmaps. Guilty Gear version have for sure, because mipmapping used there to simulate blurring.
_________________
i9-9900k, 64Gb RAM, RTX 3060 12Gb, Win7

Offline
User avatar
*blah-blah-blah maniac*
Posts: 530
Joined: 30 Jan 2012, 13:18

Re: [REQ] Vibrant Bloom

Ooo thanks for the explanation, now everything is clear. Thanks!

EDIT: Argh in the version(s) I use it's not enabled, f*ck. Boris, sorry to ask you this, but could you enable that in ENB 0.076 SA and/or generic? Only if it's fast to do, if it requires big code changes, forget it.

Offline
User avatar
*blah-blah-blah maniac*
Posts: 17562
Joined: 27 Dec 2011, 08:53
Location: Rather not to say

Re: [REQ] Vibrant Bloom

Not hard, but what i'm afraid is some other effects will be affected then, because same textures used (to reduce memory usage) and they must not use mipmapping. Btw, bloom in old versions have absolutely same math, increase BloomCurve parameter and set BloomAllowOversaturation=1, then it will be additive, more saturated and contrast. I want to make another generic version, which support all latest changes to editor and shaders with new standarts of configs.
_________________
i9-9900k, 64Gb RAM, RTX 3060 12Gb, Win7

Offline
User avatar
*blah-blah-blah maniac*
Posts: 530
Joined: 30 Jan 2012, 13:18

Re: [REQ] Vibrant Bloom

Great! Looking forward to this. Btw may that be that the new standard and HUD filtering out stuff in 0.158 may have screwed up something? I tested it with several shaders, they do look different on 0.158, a DOF shader for example looks extremely crappy on 0.158...

btw would it be possible to create something like the enbeffect/enbbloom in GTA IV/Skyrim variants for the generic effects? You said you are limited in your changes by taking this code out of the binary but would it be possible?
Last edited by Marty McFly on 13 Sep 2013, 19:46, edited 1 time in total.
Post Reply