Evak
02-10-2007 00:55:21
I gave one of my shaders to our coder and asked for a simple way to add an extra light that even I as a non coder can follow and use to test other shaders.
What I got back was a material file with 2 passes add blended with a seperate light in each.
This does seem to work, only problem is its coded, and I'm wondering how I can duplicate this without a .material file and using a .program file and ofusion shader parameter editor, letting ofusion create the material for me.
The .program file looks like this:
Do I have to make 2 seperate .program files one for each shader pass with different light numbers?
param_named_auto lightPosObj light_position_object_space 1
param_named_auto lightColor light_diffuse_colour 1
Is it possible to get these parameters to share a single program file. And not have to change the original shader source code?
Not really sure how to proceed. Naturaly this is not the most efficient way, but using 2 passes seems like it will be the easiest way for a non programmer to test converted shaders.
What I got back was a material file with 2 passes add blended with a seperate light in each.
material 1UV
{
technique
{
pass
{
ambient 0.7 0.7 0.7 1
diffuse 0.7 0.7 0.7 1
specular 0.9 0.9 0.9 1 20
vertex_program_ref NormalMap+Shiny_vs
{
param_named_auto camPosObj camera_position_object_space
param_named_auto lightPosObj light_position_object_space 0
param_named_auto wvp worldviewproj_matrix
}
fragment_program_ref NormalMap+Shiny_ps
{
param_named ShineValue float 0.25
param_named_auto lightColor light_diffuse_colour 0
}
texture_unit
{
texture_alias Map #4
texture texture_sand.bmp
}
texture_unit
{
texture_alias Map #5
texture N_cobblestones_ati.dds
}
}
pass
{
ambient 0.7 0.7 0.7 1
diffuse 0.7 0.7 0.7 1
specular 0.9 0.9 0.9 1 20
scene_blend add
vertex_program_ref NormalMap+Shiny_vs
{
param_named_auto camPosObj camera_position_object_space
param_named_auto lightPosObj light_position_object_space 1
param_named_auto wvp worldviewproj_matrix
}
fragment_program_ref NormalMap+Shiny_ps
{
param_named ShineValue float 0.25
param_named_auto lightColor light_diffuse_colour 1
}
texture_unit
{
texture_alias Map #4
texture texture_sand.bmp
}
texture_unit
{
texture_alias Map #5
texture N_cobblestones_ati.dds
}
}
}
}
This does seem to work, only problem is its coded, and I'm wondering how I can duplicate this without a .material file and using a .program file and ofusion shader parameter editor, letting ofusion create the material for me.
The .program file looks like this:
vertex_program NormalMap+Shiny_vs hlsl
{
source NormalMap+Shiny.hlsl
entry_point v
target vs_2_0
default_params
{
param_named_auto wvp WORLDVIEWPROJ_MATRIX
param_named_auto camPosObj CAMERA_POSITION_OBJECT_SPACE
param_named_auto lightPosObj LIGHT_POSITION_OBJECT_SPACE 0
}
}
fragment_program NormalMap+Shiny_ps hlsl
{
source NormalMap+Shiny.hlsl
entry_point f
target ps_2_0
default_params
{
param_named_auto lightColor LIGHT_DIFFUSE_COLOUR 0
param_named ShineValue float 0.25
}
}
Do I have to make 2 seperate .program files one for each shader pass with different light numbers?
param_named_auto lightPosObj light_position_object_space 1
param_named_auto lightColor light_diffuse_colour 1
Is it possible to get these parameters to share a single program file. And not have to change the original shader source code?
Not really sure how to proceed. Naturaly this is not the most efficient way, but using 2 passes seems like it will be the easiest way for a non programmer to test converted shaders.