Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi all,

 

i have programmed a little terrain engine. I tried to improve the look of the terrain by selecting the height values as diffuse colors of the vertices(i am using CustomVertex.PositionColoredTextured).

Now i want to do sth like this:

 

device.TextureState[0].ColorOperation = TextureOperation.AddSinged;

device.TextureState[0].ColorArgument0 = TextureArgument.TextureColor;

device.TextureState[0].ColorArgument1 = TextureArgument.Diffuse;

device.TextureState[0].AlphaOperation = TextureOperation.Disable;

 

But the result is a surface containing just grey colors. Even if i select TextureOperation.SelectArg1 i just get these colors.

Please help!

Pan :eek:

Posted

First i created a mesh, then i fill it with the vertices. Here is the call setting the diffuse color:

 

//map is my hightmap

int color = map.Data[x,y]*5;

 

if(color > 255) color = 255;

vertices[index].Color = Color.FromArgb(255,color,color,color).ToArgb();

 

 

After setting the indices and opimizing it, i draw it:

 

int numSubSets = _mesh.AttributeTable.Length;

 

device.SetTexture(0, _surface);

 

//Start

device.TextureState[0].ColorOperation = TextureOperation.AddSinged;

device.TextureState[0].ColorArgument0 = TextureArgument.TextureColor;

device.TextureState[0].ColorArgument1 = TextureArgument.Diffuse;

device.TextureState[0].AlphaOperation = TextureOperation.Disable;

//End

 

for(int i=0;i<numSubSets;i++)

{

_mesh.DrawSubset(i);

}

 

If i comment the lines between start and end my programm works fine. If not everything is grey, as i descriped above. Even if i select SelectArg1 as Operation i get a grey result.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...