Thread View: alt.pl.comp.lang.csharp
1 messages
1 total messages
Started by mehafi
Mon, 09 May 2011 13:35
Niedokładnie mapowane textury na kuli / cylindrze ( Mesh'ach ? )
Author: mehafi
Date: Mon, 09 May 2011 13:35
Date: Mon, 09 May 2011 13:35
43 lines
2844 bytes
2844 bytes
Witam,
Zauważyłem, że gdy próbuje zmapować texturę na wygenerowanej kuli:
this.mesh = Mesh.Sphere(this.device, this.planetRadius, 32, 32);
CustomVertex.PositionNormalTextured[] vb =
(CustomVertex.PositionNormalTextured[])this.mesh.LockVertexBuffer(typeof(CustomVertex.PositionNormalTextured),
0, this.mesh.NumberVertices);
double R = this.planetRadius;
double theta, theta2;
double x1, y1;
for (int i = 0; i < this.mesh.NumberVertices; ++i)
{
theta = Math.Asin(vb[i].Y / R); //-PI/2~PI/2
theta2 = Math.Atan2(vb[i].Z, vb[i].X); //-PI~PI
x1 = (theta2 / Math.PI / 2.0) + 0.5; //0.0~ 1.0
y1 = ((theta / Math.PI * 2.0) + 1.0) / 2.0;
vb[i].Tu = (float)x1;
vb[i].Tv = 1.0f - (float)y1;
}
this.mesh.UnlockVertexBuffer();
w miejscu styku początku i końca tekstury ( tam gdzie vb[i].Tu ma
wartość odpowiednio 0 i 1 ) powstaje dziwny wąski pasek, który ma
kolory punktów textury takie, jak punty dla vb[i].Tu = 0.5
Nie jest to przezroczystość = nie widać przez niego tego, co pod
spodem.
Nie są to tez problemy z ZBuffer - mam ustawiony na 24bit a
nearClipPlane w device.Transform.Projection na 1.
Nie wydaje mi się, zby były to niedokładnośći obliczeń / rzutowań -
próbowałem zaokranglać wartości vb[i].Tu bliskie 0 do 0 a bliskie 1 do
1 - nic to nie pomagało.
Co ciekawe, kiedy włączyć device.RenderState.FillMode na WireFrame
zamist na solid można zauważyc, że ten dziwny pasek jest pomiędzy
wertexami a nie na samych wertexach.
Za wszelkie podpowiedzi z góry dziękuję !
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads