some screenshots

of my raytracer (actually is more a sphere tracer now). It is coded in c++ and uses the openpm library for multithreading. Here's some features:

- primitives: planes, spheres, cones, disks, cylinders, boxes, torii, polylines:

- reflection, refraction and fresnel effect:

- CSG:

- soft CSG:

- hypertextures:

- quaternion julia fractals:

and some flowers I made for Cristina:

(10 spheres, using soft CSG)

(10 spheres, soft CSG and hypertexture)

Nothing to download yet, I plan to script the raytracer, using angelscript, maybe, so that the scene can be described/modified/rendered at run time.


improved interactive raytracer

I added some features to my raytracer: reflections, refractions, hard shadows, fresnel effect. It's also possible now to previsualize the scene and the raytracing process using sandy3d (the gray line is the primary ray, the red ones the shadow rays, the green ones the reflected rays and the blue ones the refracted rays). This was very useful to me for debugging.

Here's the script used for the rendering above:

scene.maxReflection = 1;
scene.maxRefraction = 3;
scene.eye = new Vector(0, 30, -500);
var s1 = new Sphere(100, new Vector(0, 0, 200), new Vector(255));
s1.refrIndex = 1.;
var s2 = new Sphere(50, new Vector(0, 0, 500), new Vector(0, 255));
var l = new Light(new Vector(0, 500, -500));
var p = new Plane(new Vector(0, 1), -100, new Vector(0, 0, 255));


interactive raytracing

I find coding in haxe every day more enjoyable! I scripted my raytracer using hscript, so now scenes can be described and rendered directly in the browser.

The classes available for scripting are:

- new(position)
- position:Vector
- color:Vector
- difusse, specular, power: Float
Primitive -> Sphere:
- new(radius:Float, position:Vector)
Primitive -> Plane:
- new(normal:Vector, distance:Float)
- setBackground(color:Vector)
- setDimensions(width:Float, height:Float)
- addPrimitive(p:Primitive)
- addLight(l:Primitive)
- x, y, z:Float

The Math's methods and the trace function are also available.
There are some known bugs and I'm working on crashing them. I also plan to add shadows, reflection, refraction etc to the raytracer.

Here's an example script:

function rand(n1,n2){
return Math.floor(Math.random()*(n1-n2+1))+n2;

scene.eye.set(0, 0, -500);
scene.setDimensions(300, 300);
var i = 0;
var x = -50;
var y = 100.0;
var z = -100.0;
while(i<360){ var deg = i * Math.PI / 180.0; var s = new Sphere(20, new Vector(x += Math.cos(deg) * 50, y -= 15, z += Math.sin(deg) * 130)); s.color = new Vector(rand(0, 255), rand(0, 255), rand(0, 255)); trace(s.color); scene.addPrimitive(s); i += 30; } scene.addLight(new Primitive(new Vector(0, 500, -500)));


raytracing in haxe

As I've started to learn haxe, I wrote a very basic raytracer

It can go real-time too, if you dont care much about the image quality. And here are the sources.


shadows part ll: stress test

Although there are some rough edges and the FPS is pretty low, I'm quite pleased with the results.
Use the 'L' key to stop/start the light orbiting, 'A' to stop/start the animation and the UP/DOWN arrows to change the light altitude.



Today I've played with rays again:


sandy quake (kind of)

Here's something I've been working on these days; it was a good opportunity to improve my actionscript skills, to learn more sandy3d and to test my engine. Dont expect much, it is WIP, the enemies are completely dumb (and their willing to die seems quite big), there's no goal in the game, you just can go around and shoot stuff... Well, hopefully it will improve, eventually.