Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 


Submitted by Tobias Johansson, posted on November 12, 2000




Image Description, by Tobias Johansson



This is a picture rendered by a raytracer I wrote a few months ago. It renders spheres, planes & cones/cylinders. Features a nice illumination model, soft shadow and adaptive supersampling. It has pretty good material handling, you can have a ambient, diffuse, specular and bump texture on each object.

I've written a very basic tutorial on raytracer and put it on my homepage, http://come.to/polygone Now I'm off to read Realistic RayTracing by Shirley, a fine book on raytracing.

Tobias Johansson


[prev]
Image of the Day Gallery
www.flipcode.com

[next]

 
Message Center / Reader Comments: ( To Participate in the Discussion, Join the Community )
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
Myrmecophagavir

November 12, 2000, 04:39 PM

Looks fantastic! I really like the colouring, very bright and vibrant.

 
Bobert

November 12, 2000, 06:43 PM

SWEET!!! ;-D

how many light sources?

 
Christian Henning

November 12, 2000, 07:55 PM

It's nice and colorfull. Please can you send me the ISBN of your mentioned book.

regards,
Christian

 
Tobias Johansson

November 12, 2000, 07:59 PM

Thanks...


It use two point lightsources...

Christian:
1568811101
another book that looks cool (haven't read it)
0122861604

Tobias Johansson

 
fluffy

November 12, 2000, 08:18 PM

Ooh. Normally I'm not that interested in raytracer screenshots, but this one is an exception. How are you calculating the soft shadows? And how fast is it? I'm always interested in techniques for integrating across the cross-section of a cone and/or determining partial occlusion... :)

 
bit64

November 12, 2000, 09:24 PM

Looks nice, but why only primitive shapes?

 
richard

November 13, 2000, 01:17 AM

Wow, is that water? :P

Very good!!

 
Max

November 13, 2000, 01:33 AM

The matte surface on the globe looks really good; you usually don't see that in a ray tracer :)

Max

 
SPYTHON

November 13, 2000, 03:49 AM

Very nice, especialy the detail on the globe - except the bitmap is back to front !!!!!

 
Strepto

November 13, 2000, 06:06 AM

Yes tell us about the soft shadow! How do you do it?

 
Tobias Johansson

November 13, 2000, 07:50 AM


I use jittering to get soft shadows, that involves just changing the
direction of your shadow ray. You trace 19 shadow ray, and see how many arrived, and use (float)iNumSRay / 19.0f so get the 'shadow-fraction'. I learned it from Advanced Animation & Rendering Techniques.


double circle[40] =
{
0,750, 0.433, 0.000, 0.866, -0.750, 0.433, -0.750, -0.433, 0.000, -0.866,
0.750, -0.433, 0.000, 0.000, 0.750, 0.000, 0.375, 0.650, -0.375,
0.650, -0.750, 0.000, -03.75, -0.650, 0.375, -0.650, 0.375, 0.216, 0.000,
0.433, -0.375, 0.217, -0.375, -0.216, 0.000, -0.433, 0.375, -0.217
};

CVector GetJitterRay( int iRay, CVector cIn, vec_t fLightDist, vec_t fLightRadius )
{
double dTheta;
vec_t fRadius, fDistance;
CVector cRay, cOut;
vec_t fDeltaX, fDeltaY, fA, fB, fC, fLen;

dTheta = asin( (double)( fLightRadius / fLightDist ) );
fRadius = fLightRadius * (vec_t)cos( dTheta );
fDistance = fLightDist - fLightRadius * (vec_t)sin( dTheta );

fDeltaX = gJitterOffset * ( (vec_t)(rand()%1000) / 1000.0f );
fDeltaY = gJitterOffset * ( (vec_t)(rand()%1000) / 1000.0f );

cRay = CVector( fRadius * ( (vec_t)circle[ iRay ] + fDeltaX ),
fRadius * ( (vec_t)circle[ iRay + 19 ] + fDeltaY ),
fDistance );
fA = cIn.m_fX;
fB = cIn.m_fY;
fC = cIn.m_fZ;

fLen = (vec_t)sqrt( (double)( SQR( fB ) + SQR( fC ) ));

cOut.m_fX = fLen * cRay.m_fX + fA * cRay.m_fZ;
cOut.m_fY = -fA * fB * cRay.m_fX / fLen + fC * cRay.m_fY / fLen + fB * cRay.m_fZ;
cOut.m_fZ = -fA * fC * cRay.m_fX / fLen - fB * cRay.m_fY / fLen + fC * cRay.m_fZ;

cOut.Normalize();

return cOut;
}






Tobias Johansson

 
fluffy

November 14, 2000, 06:43 PM

Oh, Monte Carlo techniques? Damn, I was hoping for something more impressive. :) (The shadows in the screenshot look better than a 19-element jitter.)

 
This thread contains 12 messages.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.