Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Artifact when mapping texture on sphere ( Mesh ? )
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
mehafi  
View profile  
 More options May 10 2011, 4:03 am
Newsgroups: alt.games.programming
From: mehafi <adam_gawo...@tlen.pl>
Date: Tue, 10 May 2011 01:03:08 -0700 (PDT)
Local: Tues, May 10 2011 4:03 am
Subject: Artifact when mapping texture on sphere ( Mesh ? )
Hi,

I noticed, that when I try map texture on Sphere generated by
Mesh.Sphere(...) metod

this.mesh = Mesh.Sphere(this.device, this.planetRadius, 32, 32);
CustomVertex.PositionNormalTextured[] vb =
(CustomVertex.PositionNormalTextured[])this.mesh.LockVertexBuffer(typeof(Cu stomVertex.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();

in place, when start and end of the tetxture connect togeter ( when
vb[i].Tu has values 0 i 1 ) a strange narrow strip occurs, which has
color of pixels like points with vb[i].Tu = 0.5.

It is not transparency / alpha blending - there could not be seen
pixel behind sphere.

It is not probably problems with ZBuffer ( like descripted here:
http://www.sjbaker.org/steve/omniv/love_your_z_buffer.html ) - I had
set:
presentParameters.AutoDepthStencilFormat = DepthFormat.D24X8;
and zNearClipPlane in device.Transform.Projection to 1.

I checked rounding and accuracy of calculations ( float, double
casting etc. )
I tried also values of vb[i].Tu close to 0 and 1 ( less to 0.001 or
higher to 0.999 ) set to 0 and 1, but it doesn't helps.

What is interesting, when I changed device.RenderState.FillMode to
WireFrame I can see, that this strip has not connected with vertex -
the wrong color is a small part of traingle - not cover whole triangle
from vertex to vertex.

for any help thanks in advance


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »