emre2345
26-09-2008 12:42:33
Hi everyone,
I have some problems about lighting. I copied PSLighting.cg to my own directory of the project. Below there is my material file:
My shader program:
And lastly my code which creates the lightmap:
This chunk of code does not work. I compare it with the example, everything is same as i see. What can be the problem?
I have some problems about lighting. I copied PSLighting.cg to my own directory of the project. Below there is my material file:
material TerrainMaterial
{
technique
{
pass
{
lighting off
vertex_program_ref Shader/VSLodMorph2
{
}
fragment_program_ref Shader/PSSplat2
{
param_named splatScaleX float 20
param_named splatScaleZ float 20
}
texture_unit
{
texture Splatting0
}
texture_unit
{
texture Splatting1
}
texture_unit
{
texture Toprak_01_0.png
}
texture_unit
{
texture Toprak_01_1.png
}
}
pass
{
// lightmap texture pass
scene_blend modulate
vertex_program_ref Shader/VSLodMorph2
{
}
fragment_program_ref Shader/PSLighting
{
}
texture_unit
{
// dynamically created
texture ETLightmap
}
}
}
}
My shader program:
fragment_program Shader/PSSplat cg
{
source PSSplat.cg
entry_point main
profiles ps_1_1 arbfp1
}
fragment_program Shader/PSSplat2 cg
{
source PSSplat2.cg
entry_point main
profiles ps_2_0 arbfp1
}
vertex_program Shader/VSLodMorph cg
{
source VSLodMorph.cg
entry_point terrain_vp
profiles vs_1_1 arbvp1
default_params
{
param_named_auto morphFactor custom 77
param_named_auto worldViewProj worldviewproj_matrix
}
}
vertex_program Shader/VSLodMorph2 cg
{
source VSLodMorph.cg
entry_point terrain_vp
profiles vs_2_0 arbvp1
default_params
{
param_named_auto morphFactor custom 77
param_named_auto worldViewProj worldviewproj_matrix
}
}
fragment_program Shader/PSLighting cg
{
source PSLighting.cg
entry_point main
profiles ps_1_1 arbfp1
}
And lastly my code which creates the lightmap:
TexturePtr lightMapTex = TextureManager::getSingleton().createManual("ETLightmap", "General", TEX_TYPE_2D,
nHeightMapWidth - 1, nHeightMapHeight - 1, 1, PF_BYTE_RGB);
Image lightMap;
ET::createTerrainLightmap((*pTerrainInfo), lightMap, nHeightMapWidth - 1, nHeightMapHeight - 1,
Vector3(1, -1, 1), ColourValue::White, ColourValue(0.3, 0.3, 0.3), true);
lightMapTex->getBuffer(0, 0)->blitFromMemory(lightMap.getPixelBox(0, 0));
//updateLightMap() Function
Image lightMap;
createTerrainLightmap((*pTerrainInfo), lightMap, 128, 128, Vector3(1, -1, 1),
ColourValue(1, 1, 1), ColourValue(0.3, 0.3, 0.3), true);
TexturePtr lightMapTex = TextureManager::getSingleton().getByName("ETLightmap");
lightMapTex->getBuffer(0, 0)->blitFromMemory(lightMap.getPixelBox(0, 0));
This chunk of code does not work. I compare it with the example, everything is same as i see. What can be the problem?