Adding, and applying multiple bloom.h textures
- Insomnia
- Topic Author
Less
More
7 years 11 months ago - 7 years 11 months ago #1
by Insomnia
Adding, and applying multiple bloom.h textures was created by Insomnia
Hey,
I'm currently using a custom lens flare texture as the stock one is a bit blinding. But the custom texture only works great with the lens flare effect, and not other effects like Chapmans or especially Godrays. So I wanted to use the stock texture with Godrays, while still using my custom texture with Lens Flare.
Anyone know how do actually do it?
I've loaded the stock texture into the shader, but I have no idea how to actually apply it to the Godrays shader.I changed the depth so only far away objects in my current game (Elite Dangerous) will get Godrays.
Thanks for any answers!
I'm currently using a custom lens flare texture as the stock one is a bit blinding. But the custom texture only works great with the lens flare effect, and not other effects like Chapmans or especially Godrays. So I wanted to use the stock texture with Godrays, while still using my custom texture with Lens Flare.
Anyone know how do actually do it?
I've loaded the stock texture into the shader, but I have no idea how to actually apply it to the Godrays shader.
texture texSpriteAlt < string source = "ReShade/GemFX/Textures/GFX_sprite_alt.png"; > {Width = BUFFER_WIDTH;Height = BUFFER_HEIGHT;Format = RGBA8;};
#if(USE_GODRAYS == 1)
float2 ScreenLightPos = float2(0.5, 0.5);
float2 texCoord = texcoord.xy;
float2 deltaTexCoord = (texCoord.xy - ScreenLightPos.xy);
deltaTexCoord *= 1.0 / (float)iGodraySamples * fGodrayDensity;
float illuminationDecay = 1.0;
for(int g = 0; g < iGodraySamples; g++) {
texCoord -= deltaTexCoord;;
float4 sample2 = tex2D(GFX_SamplerHDR1, texCoord.xy);
float sampledepth = tex2D(RFX_depthColor, texCoord.xy).x;
sample2.w = saturate(dot(sample2.xyz, 0.3333) - fGodrayThreshold);
sample2.r *= 1.0;
sample2.g *= 0.95;
sample2.b *= 0.85;
sample2 *= illuminationDecay * fGodrayWeight;
#if (GODRAY_DEPTH_CHECK == 1)
//if(sampledepth>0.99999) lens.xyz += sample2.xyz*sample2.w;
if(sampledepth<0.0000015) lens.xyz += sample2.xyz*sample2.w;
#else
//lens.xyz += sample2.rgb;
lens.xyz += sample2.xyz*sample2.w;
#endif
illuminationDecay *= fGodrayDecay;
}
#endif
Thanks for any answers!
Last edit: 7 years 11 months ago by Insomnia.
Please Log in or Create an account to join the conversation.
- WLHM15
Less
More
7 years 11 months ago - 7 years 11 months ago #2
by WLHM15
Replied by WLHM15 on topic Adding, and applying multiple bloom.h textures
Hi Insomnia..
Maybe this way gonna help you.
Maybe this way gonna help you.
#if(USE_GODRAYS == 1)
float2 ScreenLightPos = float2(0.5, 0.5);
float2 texCoord = texcoord.xy;
float2 deltaTexCoord = (texCoord.xy - ScreenLightPos.xy);
float lenstexture = tex2D(samplerlens, texCoord).r; //Add this line, you must check your sprite texture sampler..
deltaTexCoord *= 1.0 / (float)iGodraySamples * fGodrayDensity;
float illuminationDecay = 1.0;
for(int g = 0; g < iGodraySamples; g++) {
texCoord -= deltaTexCoord;;
float4 sample2 = tex2D(GFX_SamplerHDR1, texCoord.xy);
float sampledepth = tex2D(RFX_depthColor, texCoord.xy).x;
sample2.w = saturate(dot(sample2.xyz, 0.3333) - fGodrayThreshold);
sample2.r *= 1.0;
sample2.g *= 0.95;
sample2.b *= 0.85;
sample2 *= illuminationDecay * fGodrayWeight;
#if (GODRAY_DEPTH_CHECK == 1)
//if(sampledepth>0.99999) lens.xyz += sample2.xyz*sample2.w;
if(sampledepth<0.0000015) lens.xyz += sample2.xyz*sample2.w;
#else
//lens.xyz += sample2.rgb;
lens.xyz += sample2.xyz*sample2.w*lenstexture; //modified :p
#endif
illuminationDecay *= fGodrayDecay;
}
#endif
Last edit: 7 years 11 months ago by WLHM15. Reason: Wrong fuctions
The following user(s) said Thank You: Insomnia
Please Log in or Create an account to join the conversation.
- Insomnia
- Topic Author
Less
More
7 years 11 months ago - 7 years 11 months ago #3
by Insomnia
Replied by Insomnia on topic Adding, and applying multiple bloom.h textures
Thanks a lot mate!!
Last edit: 7 years 11 months ago by Insomnia.
Please Log in or Create an account to join the conversation.
- WLHM15
Less
More
7 years 11 months ago #4
by WLHM15
Replied by WLHM15 on topic Adding, and applying multiple bloom.h textures
You are welcome, but make sure it's float lenstexture = tex2D(samplerlens, texCoord).r;
Please Log in or Create an account to join the conversation.