Can CG_HLSL files be used with Sweet FX?

  • AKNightHawk
  • Topic Author
More
8 years 8 months ago - 8 years 8 months ago #1 by AKNightHawk Can CG_HLSL files be used with Sweet FX? was created by AKNightHawk
Hello everyone. :)
I am new here. And I got to say I really like Sweet FX 1.5.1. I use it for skyrim. And it runs great. though I have not tried 2.0 yet.
Anyway I got a ton of CG_HLSL files from another game engine that I am using. Called Neo Axis.

www.neoaxis.com/ that is the website for any one whom might be interested in seeing the game
engine. But this is not me trying to advertise for the engine. Anyway. I was wondering sense CG_HLSL is
very close to HLSL files. If what I have could be converted and used with Sweet FX?

I have premission to use these files how ever I want. Including in other engines.
I was just curious if any one knew how to write HLSL files here. And might be able to remake these files for
Sweet FX?
I have things like SSAO, DOF, Light Scattering, Motion Blur, Grey Scale, Night Vision,Heat Vision, and quite a few others, these are just off the top of my head. I was just curious if any one here knows how to write hlsl files. and might be interested in getting these to work with sweet FX?

Anyway thanks :)
Last edit: 8 years 8 months ago by AKNightHawk.

Please Log in or Create an account to join the conversation.

  • AKNightHawk
  • Topic Author
More
8 years 8 months ago #2 by AKNightHawk Replied by AKNightHawk on topic Can CG_HLSL files be used with Sweet FX?
Hello again.
I noticed I got 23 views but no answers. heh. Well anyway. I would like to post up some CG_HLSL code for some one to look at.

The first part of this is the CG_HLSL code.
sampler RT : register(s0);
sampler noiseVol : register(s1);

float4 main_fp(	float2 TexCoord : TEXCOORD0, uniform float4 lum, uniform float time) : COLOR
{	
	float4 oC;
	oC = tex2D(RT, TexCoord);
	
	//obtain luminence value
	oC = dot(oC,lum);
	
	//add some random noise
	oC += 0.2 *(tex3D(noiseVol, float3(TexCoord*5,time)))- 0.05;
	
	//add lens circle effect
	//(could be optimised by using texture)
	//float dist = distance(TexCoord, float2(0.5,0.5));
	//oC *= smoothstep(0.5,0.45,dist);
	
	//add rb to the brightest pixels
	oC.rb = max (oC.r - 0.75, 0)*4;
	
	return oC ;
}

And this part is the .compositor code.
compositor NightVision
{
	technique
	{
		// Temporary textures
		texture rt0 target_width target_height PF_A8R8G8B8

		target rt0
		{
			// Render output from previous compositor (or original scene)
			input previous
		}

		target_output
		{
			// Start with clear output
			input none

			// Draw a fullscreen quad with the Invert image
			pass render_quad
			{
				// Renders a fullscreen quad with a material
				material Compositor/NightVision/NightVision
				input 0 rt0
			}
		}
	}
}

Also here is the .material file for it.
fragment_program Compositor/NightVision/NightVision_hlsl hlsl
{
	source Base\FullScreenEffects\NightVision\NightVision.cg_hlsl
	entry_point main_fp
	target ps_3_0
}

fragment_program Compositor/NightVision/NightVision_cg cg
{
	source Base\FullScreenEffects\NightVision\NightVision.cg_hlsl
	entry_point main_fp
	profiles arbfp1
}

fragment_program Compositor/NightVision/NightVision unified
{
	delegate Compositor/NightVision/NightVision_hlsl
	delegate Compositor/NightVision/NightVision_cg
}

material Compositor/NightVision/NightVision
{
	technique
	{

		pass
		{
			depth_check off

			vertex_program_ref Compositor/StdQuad_vp
			{
			}

			fragment_program_ref Compositor/NightVision/NightVision
			{
				param_named lum float4 1.0 1.0 1.0 0.0
				param_named_auto time time_0_1 1
			}

			texture_unit
			{
				tex_address_mode clamp
				filtering trilinear
				tex_coord_set 0
			}
			
			texture_unit
			{
				texture Base\FullscreenEffects\NightVision\Random3D.dds 3d
				tex_address_mode wrap
				tex_coord_set 1
			}
		}
	}
}

Could some one use this with sweet FX?

Please Log in or Create an account to join the conversation.

  • crosire
More
8 years 8 months ago #3 by crosire Replied by crosire on topic Can CG_HLSL files be used with Sweet FX?
ReShade doesn't accept HLSL or CG, but its own shader language, which is very very close to HLSL though. Equivalent ReShade Code to the material and compositor file format of Neoaxis:
texture rt0 : COLOR;
texture noiseTex < source = "Base\FullscreenEffects\NightVision\Random2D.dds"; >;

sampler RT
{
	Texture = rt0;
	AddressU = CLAMP; AddressV = CLAMP; AddressW = CLAMP;
	MinFilter = LINEAR; MagFilter = LINEAR; MipFilter = LINEAR;
};
sampler noiseVol2D
{
	Texture = noiseTex
	AddressU = REPEAT; AddressV = REPEAT; AddressW = REPEAT;
 };

static const float4 lum = float4(1.0, 1.0, 1.0, 1.0);
uniform float time < source = "timer"; >;

float4 main_fp(float4 pos : POSITION, float2 TexCoord : TEXCOORD0) : COLOR
{
	float4 oC;
	oC = tex2D(RT, TexCoord);
	
	//obtain luminence value
	oC = dot(oC,lum);
	
	//add some random noise
	oC += 0.2 *(tex2D(noiseVol2D, float3(TexCoord*5,time)))- 0.05;
	
	//add lens circle effect
	//(could be optimised by using texture)
	//float dist = distance(TexCoord, float2(0.5,0.5));
	//oC *= smoothstep(0.5,0.45,dist);
	
	//add rb to the brightest pixels
	oC.rb = max (oC.r - 0.75, 0)*4;
	
	return oC ;
}

technique NightVisionMaterial
{
	pass p0
	{
		DepthTest = false;
		VertexShader = StdQuad_vp;
		PixelShader = main_fp;
	}
}
The following user(s) said Thank You: AKNightHawk

Please Log in or Create an account to join the conversation.

  • AKNightHawk
  • Topic Author
More
8 years 8 months ago #4 by AKNightHawk Replied by AKNightHawk on topic Can CG_HLSL files be used with Sweet FX?
Hiya. Thanks for the reply. If I posted you up the code for the other compositors? And stuff in Neo Axis. Could you make a RE Shade version that could be used with RE Shade and Sweet FX? There is a ton of different code here. I don't code myself but if I send you the code. It could be made for REShade I am betting.

Neo Axis has DOF, FXAA, HDR, SSAO and things like Heat Vision compositors and other screen FXs. If I post them up could you or some one make a REShade version of these to use with this system?

Please Log in or Create an account to join the conversation.

  • AKNightHawk
  • Topic Author
More
8 years 8 months ago #5 by AKNightHawk Replied by AKNightHawk on topic Can CG_HLSL files be used with Sweet FX?
Here is another set of code for ya. This one is a glass compositor.

First is the CG_HLSL file.
sampler RT : register(s0);
sampler NormalMap : register(s1);

float4 main_fp(float2 texCoord : TEXCOORD0) : COLOR
{	
	float4 normal = 2 * (tex2D(NormalMap, texCoord * 3) - 0.5);
	float4 color = tex2D(RT, texCoord + normal.xy * 0.05);
	return color;
}

Then the Compositor.
compositor Glass
{
	technique
	{
		texture rt0 target_width target_height PF_R8G8B8

		target rt0 { input previous }

		target_output
		{
			// Start with clear output
			input none

			pass render_quad
			{
				material Compositor/Glass
				input 0 rt0
			}
		}
	}
}

Then last the Glass material file.
fragment_program Compositor/Glass_fp_hlsl hlsl
{
	source Base\FullScreenEffects\Glass\Glass.cg_hlsl
	entry_point main_fp
	target ps_3_0
}

fragment_program Compositor/Glass_fp_cg cg
{
	source Base\FullScreenEffects\Glass\Glass.cg_hlsl
	entry_point main_fp
	profiles arbfp1
}

fragment_program Compositor/Glass_fp unified
{
	delegate Compositor/Glass_fp_hlsl
	delegate Compositor/Glass_fp_cg
}

material Compositor/Glass
{
	technique
	{	
		pass
		{
			cull_hardware none
			cull_software none
			depth_check off
			depth_write off
			polygon_mode_overrideable false
			polygon_mode solid

			vertex_program_ref Compositor/StdQuad_vp
			{
			}

			fragment_program_ref Compositor/Glass_fp
			{
			}

			texture_unit
			{
				tex_address_mode clamp
			}

			texture_unit
			{
				texture Base\FullScreenEffects\Glass\WaterNormal.jpg 2d
				tex_coord_set 1
				filtering linear linear linear
			}
		}
	}
}

I will post up the simplier ones first for who ever wants to try to change these over. Then add the more complex ones after.

Please Log in or Create an account to join the conversation.

We use cookies
We use cookies on our website. Some of them are essential for the operation of the forum. You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.