Welcome, Guest.
Username: Password: Remember me

TOPIC: Adding, and applying multiple bloom.h textures

Adding, and applying multiple bloom.h textures 7 months 1 week ago #1

  • Insomnia
  • Insomnia's Avatar
  • Offline
  • Posts: 43
  • Thank you received: 11
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.
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
I changed the depth so only far away objects in my current game (Elite Dangerous) will get Godrays.

Thanks for any answers! :)
Last Edit: 7 months 1 week ago by Insomnia.
The administrator has disabled public write access.

Adding, and applying multiple bloom.h textures 7 months 1 week ago #2

  • WLHM15
  • WLHM15's Avatar
  • Offline
  • Everything started from the end
  • Posts: 22
  • Thank you received: 6
Hi Insomnia..
Maybe this way gonna help you. :D

#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 months 1 day ago by WLHM15. Reason: Wrong fuctions
The administrator has disabled public write access.
The following user(s) said Thank You: Insomnia

Adding, and applying multiple bloom.h textures 7 months 3 days ago #3

  • Insomnia
  • Insomnia's Avatar
  • Offline
  • Posts: 43
  • Thank you received: 11
Thanks a lot mate!! :)
Last Edit: 7 months 3 days ago by Insomnia.
The administrator has disabled public write access.

Adding, and applying multiple bloom.h textures 7 months 1 day ago #4

  • WLHM15
  • WLHM15's Avatar
  • Offline
  • Everything started from the end
  • Posts: 22
  • Thank you received: 6
You are welcome, :) but make sure it's float lenstexture = tex2D(samplerlens, texCoord).r;
The administrator has disabled public write access.