Page 1 of 1

Legacy Corona Node HLSL Shader Source Code ?

Posted: 09 Apr 2018, 10:26
by gaz99
Hello,

Would it be possible to get the HLSL source code that was used for the Corona Shader node in Ventuz 3 and Ventuz 4? We have a few legacy projects that I have been upgrading to Ventuz 5, replacing all deprecated nodes. The only node I am unable to replace is the Corona Shader due to my limited experience with writing shaders.

It's fine leaving in the legacy node with the layer engine set to Standard as there are no issues but it seems odd that these nodes are deprecated when they work just fine with the engine not in legacy mode.

It would be nice to be able to replace all deprecated nodes in these projects.

Cheers

Re: Legacy Corona Node HLSL Shader Source Code ?

Posted: 12 Apr 2018, 15:57
by Karol
Hi Gareth,

Here you are!

The PixelShader Code:

Code: Select all

float4 lightColor	:	register(c0);
float4 alpha		:	register(c1);
float3 parameter	:	register(c2);
sampler Corona		:	register(s0);

float4 main(float2 texCoord: TEXCOORD0) : COLOR 
{
   float4 corona = tex2D(Corona, texCoord);
   return parameter.g * pow(parameter.b, parameter.r) * corona * lightColor * alpha;
}
The Vertex Shader Code:

Code: Select all

float4x4 view_proj_matrix	: register(c0);
float4x4 view_matrix		: register(c4);
float4x4 texTransform		: register(c8);
float4 pos0					: register(c12);
float coronaSize			: register(c13);

struct VS_OUTPUT 
{
   float4 Pos: POSITION;
   float2 TexCoord: TEXCOORD0;
};

VS_OUTPUT main( float4 Pos: POSITION )
{
   VS_OUTPUT Out;

   // Grab X and Y eye-space vectors in world-space ...
   float3 dirX = view_matrix[0];
   float3 dirY = view_matrix[1];

   // ... which are used for billboarding
   float4 pos = float4(0,0,0,1);
   pos.xyz = pos0 + coronaSize * (Pos.x * dirX + Pos.y * dirY);

   Out.Pos = mul(view_proj_matrix, pos);
   // v Tex. Coord. must be flipped because they come from object space!
   Out.TexCoord = mul(texTransform, float3(Pos.x + 0.5, -Pos.y + 0.5, 1.0));

   return Out;
}