• Advertisement
Sign in to follow this  

Checkboard a sphere without texture?

This topic is 965 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 all

 

I was wondering if it was possible to create a checkerboard pattern on a sphere for a ray tracer with code rather than mapping a texture?

 

For example,just return black or white depening on where the intersection in on the sphere is.

 

Or is this just not the done thing?

Share this post


Link to post
Share on other sites
Advertisement

It is not exactly possible (as it is also not by using a texture), but of course you can parametrize the surface of a sphere and compute the parameters of the point where the ray intersects, transform the parametrization into one suitable for coloring, and finally use the associated color.

 

Example:

 

1. Compute the intersection point in object local space using cartesian co-ordinates as usual.

 

2. Transform the cartesian co-ordinates into spherical co-ordinates.

 

3. Drop the radial co-ordinate and map the remaining by modulo calculations.

 

4. Pick a color due to the 2 modulo values.

Edited by haegarr

Share this post


Link to post
Share on other sites

Thanks Haegarr

 

Couldn't figure it out so added planes and checker boarded that instead with no texture. Simply changed the color of the plane based on whether its intersect was odd or even.

 

sphere_1440911132273.png

Share this post


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

  • Advertisement