• Advertisement
Sign in to follow this  

Ray pixel intersection

This topic is 1665 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys

 

 

I have a ray intersection method(code below) that was created using java and have been trying to convert it to  c#/xna

but Im having trouble trying to find the class equivalent of javas Image and Scene classes if anyone could help

me with this conversion it would be much appreciated. Thankyou

 

 

 Image RayCast(Camera camera, Scene scene, int width, int height)
        {

            Image image = new Image(width, height);

            for (int i = 0; i < width; i++)
            {

                for (int j = 0; j < height; j++)
                {

                    Ray ray = ConstructRayThroughPixel(camera, i, j);

                    Intersection hit = FindIntersection(ray, scene);

                    image[j] = GetColor(hit);

                }

            }

            return image;

        }

 

 

 

Share this post


Link to post
Share on other sites
Advertisement

XNA has no equivalent to Scene or Camera. The logical equivalent to Image would be Texture2D.

Share this post


Link to post
Share on other sites

Thanks Dave I'll start experimenting right away.

 

                                               Thanks again

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement