December 2005 - Posts

Happy X....box360

Since I have better things to do that stand out in the rain for 2 days, buy the $1000 bundle or pay double on ebay I had all but given up on getting my Xbox360 before Xmas. I preordered in August which was *not* looking like it was early enough.

But this evening (23rd) I got a nice phone call from EBGames saying they just got a delivery and it was my turn... how cool is that?

For those who want to know the EB in Redmond, WA has around 300 preorders, they got 40 delivered today leaving them with around 120 still on the waiting list. As I was waiting in line the guy in front of me asked for one, but didn't have a preorder, he said someone at Microsoft had told him they had a delivery. That is one *cruel* person at Microsoft because I'm sure everyone knows EB is still working through its waiting list.

Sadly I spent an hour rebooting and fiddling with all the devices in my network to try to get online. I really have no clue what was up, after I replaced the router with a spare, then replaced it back again, then powered everything off and back on it connected first time.

So if you want someone to beat at *any* game out there (I really am about as crap as they come) then add The ZManiac to your friends list.

Texture wrapping

About time I put some DirectX content on here isn't it!

Those of you who bother to read the Ask The ZMan column on Coding4Fun may remember I left the spherical texturing article with a bit of a teaser. Why does the texture get messed up in the middle of the pacific ocean. Check out the last picture on the spherical texturing article.

Necroscope had the correct answer over on the channel 9 forums. The texture coordinates are distributed around the globe, the 1st being 0.0 the last being less than 1.0 because 1.0 would be the same vertex that we set to 0.0. Since the vertices in the Mesh.Sphere are shared you can't actually have a start and an end. So if our globe has 10 segments our texture coordinates are 0.0, 0.1, ....0.8, 0.9, 0.0. When the texture is interpolated for the last section you get the entire texture from 0.9 back to 0.0 in a single segment.

My solution was going to be to create a new mesh that didn't have to overlapping vertices so that there was an 'end' that could be set to 1.0. That wouldn't have been the whole article but it was to be part of one which showed the innards of a mesh.

Well today whilst browsing the newsgroups I came across a post called 'Looping Textures' by the very frequent poster Robert Dunlop where he magically solves the problem with a single line of code. There is a renderstate that I had not come across before which controls how DirectX does its texture interpolation. If you add this line before you render

device.RenderState.Wrap0 = WrapCoordinates.Zero;

then the texture anomaly goes away.

Basically this renderstate says "when you interpolate assume that 0.0 and 1.0 are the same thing and then interpolate in the direction that gives you the shortest distance". So in the example above 0.9 -> 0.0 is a bigger interpolation than 0.9 -> 1.0 so it interpolates from 0.9 -> 1.0 which is exactly what you want. The SDK has a help topic called Texture Wrapping that also explains it.

Search

Go

This Blog

Syndication