Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

• Index
•  » This is Cool
•  » ray-traced torus, scale+rotate+texture+tangent-space normal mapping

## #1 2006-05-25 04:59:15

luca-deltodesco
Super Member

Offline

### ray-traced torus, scale+rotate+texture+tangent-space normal mapping

Ive finnaly got my ray-torus intersections working, and ive made a quick and messy sample program testing it all

there are two renderings of tori in the images, one shows a traditional style torus, except that it is stretched by a factor of 1.11 in z direction and 2.5 in y direction. The othere is what you get when the tube radius is more than the ring radius, and again is scaled.

I have also tested out texturing the tori, and applying a tangent space normal map, which requires finding the tangent vectors at a given point on the tori.

You can see the texture, the pink thingy at the bottom, along with the normal map im using

(is it just me or does the non-traditional looking torus look kind of like an apple (ignoring texture and normal maps))

Last edited by luca-deltodesco (2006-05-25 08:03:48)

The Beginning Of All Things To End.
The End Of All Things To Come.

## #2 2006-05-25 06:05:58

John E. Franklin
Star Member

Offline

### Re: ray-traced torus, scale+rotate+texture+tangent-space normal mapping

Lots of work I bet to create that program.
How many kilobytes large is the source code you wrote?
What is this pink thing at
http://img409.imageshack.us/img409/1148/ehm0ut.jpg ??
I can see its shape applied onto the other 3-D objects if I flip back and forth.
Very interesting.

Last edited by John E. Franklin (2006-05-25 06:09:25)

Imagine for a moment that even an earthworm may possess a love of self and a love of others.

## #3 2006-05-25 06:19:15

luca-deltodesco
Super Member

Offline

### Re: ray-traced torus, scale+rotate+texture+tangent-space normal mapping

#### John E. Franklin wrote:

Lots of work I bet to create that program.
How many kilobytes large is the source code you wrote?
What is this pink thing at
http://img409.imageshack.us/img409/1148/ehm0ut.jpg ??
I can see its shape applied onto the other 3-D objects if I flip back and forth.
Very interesting.

Actually, this is a very messy program i quickly put together just to test the torus rendering, the source code is 10kb for the main cpp without about another 10kb of my own code for files containing a Matrix class, a vector class, and classes i made for loading bitmaps and for solving quartic equations.

the pink image is the texture im applying to the surface, i just used smudge tool in photoshop and added noise

Last edited by luca-deltodesco (2006-05-25 06:21:19)

The Beginning Of All Things To End.
The End Of All Things To Come.

## #4 2006-05-25 07:46:41

MathsIsFun

Offline

### Re: ray-traced torus, scale+rotate+texture+tangent-space normal mapping

That is really Beautiful!

Could you use "Image Upload" to post these on the forum? In a year or so the imageshack images might be gone.

"The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  - Leon M. Lederman

## #5 2006-05-25 08:04:08

luca-deltodesco
Super Member

Offline

### Re: ray-traced torus, scale+rotate+texture+tangent-space normal mapping

#### MathsIsFun wrote:

That is really Beautiful!

Could you use "Image Upload" to post these on the forum? In a year or so the imageshack images might be gone.

done and done, ive rewritten the first post, using the uploaded images.

The Beginning Of All Things To End.
The End Of All Things To Come.

• Index
•  » This is Cool
•  » ray-traced torus, scale+rotate+texture+tangent-space normal mapping