[help]Painting color/texture problem

grelot

07-07-2008 19:50:42

before : many thanks for previous help... i did check the forum for related topic and i did find some.. some been helpfull.. other didn't but i still got a problem..

now : the problem that i'm having is that i can't paint color/texture to my terrain with the setOption("PaintCenter", &hit ); i dont really know why nor how and that what i would like to know to eventually make this work...

here's the code i do for the painting



std::vector<Ogre::Real> rgba;
rgba.reserve(4);
rgba.resize(4);

rgba[0] = 1.0f;
rgba[1] = 1.0f;
rgba[2] = 0.0f;
rgba[3] = 0.0f;
graphicSupport->GetOgreGameSceneMgr().setOption("setPaintChannelValues", &rgba);

brushArrayWidth = bsi*2;
brushArrayHeight = bsi*2;

delete mBrushArray;
mBrushArray = new float[brushArrayWidth * brushArrayHeight];

for(int i=0; i<(bsi*2)*(bsi*2);++i)
{
mBrushArray[i] = 1.0f;
}

graphicSupport->GetOgreGameSceneMgr().setOption( "BrushArrayHeight", &brushArrayHeight );
graphicSupport->GetOgreGameSceneMgr().setOption( "BrushArrayWidth", &brushArrayWidth );
graphicSupport->GetOgreGameSceneMgr().setOption( "BrushArray", mBrushArray );

graphicSupport->GetOgreGameSceneMgr().setOption("PaintCenter", &hit );


bsi = brush size...
before i go any further... this code work... how do I how? well simple enought.. when i change my cfg file to any of the TextureFormat from the demo it work.. i can paint color... ( did not tried texture ) but the not working part is when i take my cfg and change the TextureFormat to mine that is PLSM2Splatting ( oh and btw Splatting dont work but other do (other being base, instantbase, etc ) )
now for my cfg, material part

cfg

GroupName=PLSM2

LandScapeFileName=Mont-Treuille.100
FileSystem=LandScapeFileName

PageSize=2049
TileSize=65

Width=1
Height=1

ScaleX=4096
ScaleY=1530
ScaleZ=4096

Deformable=yes
TextureModifiable=yes
VertexCompression=yes
VertexProgramMorph=yes

MaxPixelError=4

VertexNormals=yes

TextureStretchFactor=1

TextureFormat=PLSM2Splatting //changing this to Base, instantbase, instantbaselight worked but my texture stop working...
#Shadowed


PerTileLightMap = Yes

MaterialHeight1=33
MaterialHeight2=66
MaterialHeight3=100

NumMatHeightSplat=4

SplatFilename0=Mont-Treuille.100.splatting.png
SplatFilename1=splatting_grass.png
SplatFilename2=splatting_rock.png
SplatFilename3=splatting_snow.png

VisibleRenderables=150
NumRenderablesLoading=10
RenderableLoadInterval=3
MaxAdjacentPages=1
MaxPreloadedPages=2
PageLoadInterval=5
MaxNumRenderables=1024
IncrementRenderables=1024
MaxNumTiles=1024
IncrementTiles=1024
SaveDeformation=yes

#VertexLit = yes
#TextureModifiable=yes
#MaterialDistanceLod=15000
#HorizonVisibilityComputing=yes
RoughnessLod=no
DistanceLOD=10.1

LightMap=yes
Sunx=-0.32f
Suny=0.38f
Sunz=0.87f
Ambient=0.5f
Diffuse=0.5f
Blur=0.0f

# where to put camera on load.
BaseCameraViewpoint.x=0.0f
BaseCameraViewpoint.y=500.0f
BaseCameraViewpoint.z=0.0f

Baselookat.x=0.0f
Baselookat.y=500.0f
Baselookat.z=100.0f


material


material PLSM2Splatting
{
technique
{
pass allinone
{
ambient 0.20 0.20 0.25 1
//ambient 1 1 1 1
diffuse 0.9 0.9 0.9 1
specular 1 1 1 1
fog_override true 0
vertex_program_ref PLSM2Splatting_VS
{
param_named scale float 1
}

fragment_program_ref PLSM2Splatting_PS
{
param_named scale_tex float3 64 64 64
param_named Ka float 1
param_named Kd float 1
param_named Ks float3 0.8 0.5 0.1
param_named shininess float3 60 30 30
param_named bumpiness float 1.5
param_named colorscale float3 0.95 0.95 0.95
}

shadow_receiver_vertex_program_ref simpleShadowReceiver_VS
{
}

shadow_receiver_fragment_program_ref simpleShadowReceiver_PS
{
}

texture_unit
{
filtering anisotropic
max_anisotropy 16
texture Ice02.dds
//texture blue.png
}

texture_unit
{
filtering anisotropic
max_anisotropy 16
texture Snow6.dds
//texture green.png
}

texture_unit
{
filtering anisotropic
max_anisotropy 16
// or HighRez_SoftSnow.dds
texture MedRez_SoftSnow.dds
//texture red.png
}
texture_unit
{
filtering anisotropic
max_anisotropy 16
texture Ice02_NM.dds
}

texture_unit
{
filtering anisotropic
max_anisotropy 16
texture Snow6_NM.dds
}

texture_unit
{
filtering anisotropic
max_anisotropy 16
// or HighRez_SoftSnow_NM.dds
texture MedRez_SoftSnow_NM.dds
}
texture_unit
{
texture nm.dds cubic
}
texture_unit
{
texture Splatting // if i change this to Base my texture are lost somewhere but the painting work... and if change to Image, not working...
}
}
}
}



some SS to show how it's not working..
the working one but with not working painting...

the painting working but not the texture... with Base or instantbase set in the material file... ( hard to see but the painting is there, white on left side )

the painting working ( see the green painting ) but you see what's not working...


thanks in advance...