Sign in to follow this  
football94

Ray pixel intersection

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[i][j] = GetColor(hit);

                }

            }

            return image;

        }

 

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this