English 中文(简体)
DirectX Sphere Texture Coordinates
原标题:

I have a sphere with per-vertex normals and I m trying to derive the texture coordinates for the object using the algorithm:

U = Asin(Norm.X) / PI + 0.5
V = Asin(Norm.Y) / PI + 0.5

With a polka dot texture, I get:

Misaligned textures

Here s the same object without the texture applied:

No textures

The issue I m particuarly looking at (I know there s a few) is the misalignment of the textures.

I am inclined to believe the issue resides in my use of those algorithms, as the specular highlighting (which doesn t utilise any textures but does rely on the normals being correct) appears to have no artifacts.

Any ideas?

最佳回答

Can t you just set your UVs while you are building the sphere?

Then:

 u = theta / (2 * PI);
 v = phi / PI;

Edit: I might also point out that there probably is something wrong with your normals given the black dot on top ... There also appears to be highlighted lines along polygon edges. This again points to probable dodgy normals ...

问题回答

暂无回答




相关问题
Prerequisite for learning directx

I am from .net C# background and I want to learn DirectX. I have knowledge of C++ but I am fairly new to graphic world. I am little confused about how to start learning directx, should I start ...

How to programmatically disable the auto-focus of a webcam?

I am trying to do computer vision using a webcam (the model is Hercules Dualpix). I know it is not the ideal camera to use, but I have no choice here. The problem is the auto-focus makes it hard/...

Making an object orbit a fixed point in directx?

I am trying to make a very simple object rotate around a fixed point in 3dspace. Basically my object is created from a single D3DXVECTOR3, which indicates the current position of the object, ...

3d Alternative for D3DXSPRITE for billboarding

I am looking to billboard a sun image in my 3d world (directx 9). Creating a D3DXSPRITE is great in some cases, but it is only a 2d object and can not exist in my "world" as a 3d object. What is ...

热门标签