| Poster | : Ne0Que | | Posts | : 23 | | Country | : Borger | | City | : the Netherlands |
| | | | Posted by Ne0Que on 27/03/2009 at 05:26:47
| | Hi,
Is there any example on how i can create a grid texture (1x1) on the terrain? I do not want to replace the multitextured terrain.
If there is a better way to show a squared grid, please tell me. I'm desperate on this because i've been asking this on a whole lot of forums and there was no answer in almost 2 months now. :(
Thank you | |
|
|
| |
| |
| Poster | : Archenon | | Posts | : 428 | | Country | : Romania | | City | : Oradea |
| | | | Posted by Archenon on 27/03/2009 at 12:10:59
| | I'm not sure if i understand it right but i think you want to draw a grid like most (3D modeling tools have)
If that is true you need to make the grid rom vertices and conenct them as triangles.
http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series1/Terrain_basics.php
Maybe something like this? | |
|
|
| |
| |
| Poster | : Ne0Que | | Posts | : 23 | | Country | : Borger | | City | : the Netherlands |
| | | | Posted by Ne0Que on 27/03/2009 at 14:14:34
| | Thank you,
No i meant something like this:
 | |
|
|
| |
| |
| Poster | : Ne0Que | | Posts | : 23 | | Country | : Borger | | City | : the Netherlands |
| | | | Posted by Ne0Que on 27/03/2009 at 14:16:14
| | Thank you,
No i meant something like this:

(the dark lines) | |
|
|
| |
| |
| Poster | : Archenon | | Posts | : 428 | | Country | : Romania | | City | : Oradea |
| | | | Posted by Archenon on 27/03/2009 at 15:36:59
| | Ohh i see what you mean. This amy have been obtained by modifieing the textures to have a black outline.
Or maybe from Pixel shader. If the Texccord X < 0.05 or bigger then 9.95 then you return black as a color. The same thing should be applied to the Y.
This should give you an outline to the texture without actualy modifieng it. | |
|
|
| |
| |
| Poster | : Ne0Que | | Posts | : 23 | | Country | : Borger | | City | : the Netherlands |
| | | | Posted by Ne0Que on 27/03/2009 at 18:08:13
| | Thanks,
Do you have a sample code for me? I don't know how to apply that black color within the pixel shader while using multitextures
Pixel shader code:
MTPixelToFrame MultiTexturedPS(MTVertexToPixel PSIn)
{
MTPixelToFrame Output = (MTPixelToFrame)0;
float lightingFactor = 1;
if (xEnableLighting)
lightingFactor = saturate(saturate(dot(PSIn.Normal, PSIn.LightDirection)) + xAmbient);
float blendDistance = 0.99f;
float blendWidth = 0.005f;
float blendFactor = clamp((PSIn.Depth-blendDistance)/blendWidth, 0, 1);
float4 farColor;
farColor = tex2D(TextureSampler0, PSIn.TextureCoords)*PSIn.TextureWeights.x;
farColor += tex2D(TextureSampler1, PSIn.TextureCoords)*PSIn.TextureWeights.y;
farColor += tex2D(TextureSampler2, PSIn.TextureCoords)*PSIn.TextureWeights.z;
farColor += tex2D(TextureSampler3, PSIn.TextureCoords)*PSIn.TextureWeights.w;
float4 nearColor;
float2 nearTextureCoords = PSIn.TextureCoords*3;
nearColor = tex2D(TextureSampler0, nearTextureCoords)*PSIn.TextureWeights.x;
nearColor += tex2D(TextureSampler1, nearTextureCoords)*PSIn.TextureWeights.y;
nearColor += tex2D(TextureSampler2, nearTextureCoords)*PSIn.TextureWeights.z;
nearColor += tex2D(TextureSampler3, nearTextureCoords)*PSIn.TextureWeights.w;
Output.Color = lerp(nearColor, farColor, blendFactor);
Output.Color *= lightingFactor;
return Output;
}
|
Thank you! | |
|
|
| |
| |
| Poster | : Archenon | | Posts | : 428 | | Country | : Romania | | City | : Oradea |
| | | | Posted by Archenon on 28/03/2009 at 05:07:20
| | After MTPixelToFrame Output = (MTPixelToFrame)0;
you add If(PSIn.TexCoords.X < 0.05 || PSIn.TexCoords.X > 0.95 || PSIn.TexCoords.Y <0.05 || TexCoords.Y > 0.95)
{
} | |
|
|
| |
| |
| Poster | : Archenon | | Posts | : 428 | | Country | : Romania | | City | : Oradea |
| | | | Posted by Archenon on 28/03/2009 at 05:08:37
| | In the middle of that if Add return Output.
Thix should return black instead of the edges of the texture. Hope this is waht you need. | |
|
|