TGEA 1.7.1 Bug : CustomMaterial pass[0] Parameter is not working
by robo · in Torque Game Engine Advanced · 08/29/2008 (8:25 am) · 4 replies
I need 2 pass shader.
So , I try to use 'CustomMaterial pass[0]' parameter
but CustomMaterial pass[0] is not working.
Mesh is not blue(pass2) but red (pass1)
What do I need to fix below code?
BlueV.hlsl
BlueP.hlsl
RedV.hlsl
RedP.hlsl
So , I try to use 'CustomMaterial pass[0]' parameter
but CustomMaterial pass[0] is not working.
Mesh is not blue(pass2) but red (pass1)
What do I need to fix below code?
BlueV.hlsl
#define IN_HLSL
#include "../shdrConsts.h"
float4x4 view_proj_matrix: register(VC_WORLD_PROJ);
struct VS_INPUT
{
float4 Position : POSITION0;
};
struct VS_OUTPUT
{
float4 Position : POSITION0;
};
VS_OUTPUT main( in VS_INPUT Input )
{
VS_OUTPUT Output = (VS_OUTPUT) 0;
Output.Position = mul( view_proj_matrix, Input.Position );
return( Output );
}BlueP.hlsl
struct PS_INPUT //We define the vertex out structure again
{
float4 Position : POSITION0;
};
struct PS_OUTPUT //We define the pixel output
{
float4 Color : COLOR0;
};
//The heart of the shader
void main(in PS_INPUT IN, out PS_OUTPUT OUT)
{
OUT.Color = float4 (0.0f, 0.0f, 1.0f, 1.0f); //Output the color blue
}RedV.hlsl
#define IN_HLSL
#include "../shdrConsts.h"
float4x4 view_proj_matrix: register(VC_WORLD_PROJ);
struct VS_INPUT
{
float4 Position : POSITION0;
};
struct VS_OUTPUT
{
float4 Position : POSITION0;
};
VS_OUTPUT main( in VS_INPUT Input )
{
VS_OUTPUT Output = (VS_OUTPUT) 0;
Output.Position = mul( view_proj_matrix, Input.Position );
return( Output );
}RedP.hlsl
struct PS_INPUT //We define the vertex out structure again
{
float4 Position : POSITION0;
};
struct PS_OUTPUT //We define the pixel output
{
float4 Color : COLOR0;
};
//The heart of the shader
void main(in PS_INPUT IN, out PS_OUTPUT OUT)
{
OUT.Color = float4 (1.0f, 0.0f, 0.0f, 1.0f); //Output the color blue
}new ShaderData( BlueShader )
{
DXVertexShaderFile = "shaders/myshader/BlueV.hlsl";
DXPixelShaderFile = "shaders/myshader/BlueP.hlsl";
pixVersion = 2.0;
};
new ShaderData( RedShader )
{
DXVertexShaderFile = "shaders/myshader/RedV.hlsl";
DXPixelShaderFile = "shaders/myshader/RedP.hlsl";
pixVersion = 2.0;
};
new CustomMaterial(BlueMaterial)
{
shader = BlueShader;
version = 2.0;
};
new CustomMaterial(RedMaterial)
{
mapTo = "c_armor_base_map01";
texture[0] = "./c_armor_base_map01";
shader = RedShader;
pass[0] = BlueMaterial; //2 pass
version = 2.0;
};About the author
Recent Threads
#3
Perhaps I should step back and ask, what exactly is it you want the final effect to be? There may be another way of handling this.
-Dave Calabrese
Gaslight Studios
08/29/2008 (9:55 am)
Hrrm...Perhaps I should step back and ask, what exactly is it you want the final effect to be? There may be another way of handling this.
-Dave Calabrese
Gaslight Studios
#4
Silhouette Shader is 2Pass Shader.
also I'm curious how can I render state control?
08/29/2008 (10:27 am)
I want to import Render Monkey Silhouette Shader.Silhouette Shader is 2Pass Shader.
also I'm curious how can I render state control?
Associate Dave Calabrese
Cerulean Games
new CustomMaterial(RedMaterial) { mapTo = "c_armor_base_map01"; texture[0] = "./c_armor_base_map01"; shader = RedShader; pass[0] = BlueShader; //2 pass version = 2.0; };-Dave Calabrese
Gaslight Studios