| Topic: texture appearing solid
|
|
 | texture appearing solid | |  |
| Poster | : FIsherdog | | Posts | : 14 | | Country | : USA | | City | : Omaha |
| | | | Posted by FIsherdog on 17/09/2009 at 21:13:29
| | OK im using the textured technique and the terrain appears as a solid color, it may be a problem with the struct so i added it here:
public struct VertexPositionTexture
{
public Vector3 Position;
public Vector3 Normal;
public Vector2 TextureCoordinate;
public static int SizeInBytes = 8 * sizeof(float);
public static VertexElement[] VertexElements = new VertexElement[]
{
new VertexElement( 0,0, VertexElementFormat.Vector3, VertexElementMethod.Default, VertexElementUsage.Position, 0 ),
new VertexElement( 0, sizeof(float) * 3, VertexElementFormat.Vector3, VertexElementMethod.Default, VertexElementUsage.Normal, 0 ),
new VertexElement( 0, sizeof(float) * 6, VertexElementFormat.Vector2, VertexElementMethod.Default, VertexElementUsage.TextureCoordinate, 0 )
};
}
i AM using vertex buffers and i know it isnt a problem with my texcoords
thanks riemer
BTW i ordered ur book ;)
| |
|
| | | | | | Poster | : Archenon | | Posts | : 397 | | Country | : Romania | | City | : Oradea |
| | | | Posted by Archenon on 18/09/2009 at 07:52:44
| | I cannot see anything wrong about your code for now...
Solid as what color?
white, black or one color from the texture?
Another question are you sure you are sending the texCoords from the vertexShader to the PixelShader or you leave that uninitialized (your HLSL code would be helpfull in debugging the issue)?
Cheers | |
|
| | | | | | Poster | : Fisherdog | | Posts | : 14 | | Country | : USA | | City | : Omaha |
| | | | Posted by Fisherdog on 18/09/2009 at 15:16:56
| | indeed it was actualy a problem with the texcoords, they were being rounded to 0 or 1 because i was dividing int's the code looks like this
where H and W are the height and width of the terrain:
BEFORE:
vt[c].TextureCoordinate = new Vector2(x/W, y/H);
AFTER:
vt[c].TextureCoordinate = new Vector2((float)(x)/W, (float)(y)/H); | |
|
| | | | | | Poster | : Anonymous | | Posts | : | | Country | : | | City | : |
| | | | Posted by Anonymous on 18/08/2010 at 06:12:39
| | | WXICAc <a href="http://xusgktvvjvkj.com/">xusgktvvjvkj</a>, [url=http://zdatvbhlrhch.com/]zdatvbhlrhch[/url], [link=http://ohmuuyzamugh.com/]ohmuuyzamugh[/link], http://driyitffxaoa.com/ | |
|
|
 | | |  |
|
|
|
If you appreciate the amount of time I spend creating and updating these pages, feel free to donate -- any amount is welcome !
|
- Website design & DirectX code : Riemer Grootjans - ©2006 Riemer Grootjans
|
|