🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.pl.comp.lang.csharp
Article #22162

Niedokładnie mapowane textury na kuli / cylindrze ( Mesh'ach ? )

#22162
From: mehafi
Date: Mon, 09 May 2011 13:35
43 lines
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ę !
Technical Details
Message-ID: <9c4203fb-2c87-47e7-b7b4-24d2cbb3666e@w21g2000yqm.googlegroups.com>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.glorb.com!postnews.google.com!w21g2000yqm.googlegroups.com!not-for-mail

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.glorb.com!postnews.google.com!w21g2000yqm.googlegroups.com!not-for-mail
From: mehafi <adam_gaworek@tlen.pl>
Newsgroups: alt.pl.comp.lang.csharp
Subject: Niedokładnie mapowane textury na kuli / cylindrze (
 Mesh'ach ? )
Date: Mon, 9 May 2011 06:35:22 -0700 (PDT)
Organization: http://groups.google.com
Lines: 47
Message-ID: <9c4203fb-2c87-47e7-b7b4-24d2cbb3666e@w21g2000yqm.googlegroups.com>
NNTP-Posting-Host: 89.174.215.142
Mime-Version: 1.0
X-Trace: posting.google.com 1304948122 10537 127.0.0.1 (9 May 2011 13:35:22 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Mon, 9 May 2011 13:35:22 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: w21g2000yqm.googlegroups.com; posting-host=89.174.215.142; posting-account=0pAJfAoAAADj6-iz_aq4B_xufBT_-P5T
User-Agent: G2/1.0
X-HTTP-Via: 1.1 62.29.173.116:7777:7777 (squid/2.6.STABLE13)
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; pl; rv:1.9.2.16) Gecko/20110319 Firefox/3.6.16,gzip(gfe)
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit