• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 450
  • Last Modified:

[MDX] [C#] Ray Picking and Point list brightness issues

Rather than ask 2 questions, I'll stick them both in here.

Problem #1 (for 250 points):

I have a space station, I have a camera. I am trying to pick the distance of the station from the camera and the space station face being looked at, mostly for docking purposes. This was working brilliantly (detected distance perfectly and showed the right face number). However, when I decided to move the space station 1000 units in an arbitary direction, the total distance became the camera distance to the space station + the distance from the space station to the origin. Now this could probably be solved with pythagoras, but I'd rather find the problem in my code if there is one.

Problem #2 (for 125 point bonus):

I have a skybox, a pointlist, and my camera. Lighting is disabled. I have coded the pointlist to flicker in intensity (higher values of grey to white). The skybox and the pointlist are rendered whilst the z-buffer is disabled, and the skybox is rendered BEFORE the pointlist. The problem is that when the skybox is enabled the pointlist is all black, I can tell this because I can see a few of the points in the bright patches of my skybox texture. I tested rendering only 1 subset of my skybox and the points all appear blue, and flicker in intensity. When the skybox is disabled the points all appear perfect and flickering grey-white. I need to find out why my skybox is influencing my pointlist.

Does anyone have any ideas? If people provide really good answers, I'll consider dumping more points on this question.

1 Solution
#1, could you please post your distance finding code. If you are using  Mesh.Intersect, the intersect information gleaned by it has a distance property that most likely should be utilized by your distance finding code.

#2, My thought is not exactly consistent with your issue, but I'll throw it out there so you can see if it offers you a clue. Your Skybox most likely utilizes PositionedTextured vertices, which like you say, is fine with lighting disabled. But if the vertices in your point list are PositionedColored, then they do require lighting to be enabled to see them properly. If this is the case, just before you render the pointlist, you could insert a device.renderstate.lightinh = true; and when done, toggle it back to off for the skybox draw.

Without seeing your code, the above is a kind of shot in the dark but I hope it helps.

KnossosAuthor Commented:
I managed to solve #1, but #2 is still causing grief.

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now