2010-01-30

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:



(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.

2009-09-22

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));
scene.addPrimitive(s1);
scene.addPrimitive(s2);
scene.addLight(l);
scene.addPrimitive(p);

2009-08-07

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:

Primitive:
- new(position)
- position:Vector
- color:Vector
- difusse, specular, power: Float
Primitive -> Sphere:
- new(radius:Float, position:Vector)
Primitive -> Plane:
- new(normal:Vector, distance:Float)
Scene:
- setBackground(color:Vector)
- setDimensions(width:Float, height:Float)
- addPrimitive(p:Primitive)
- addLight(l:Primitive)
Vector:
- 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)));

2009-08-04

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.

2009-05-07

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.

2009-04-23

shadows

Today I've played with rays again:

2009-03-22

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.

2009-03-07

a really simple raytracer

...made off in about 20 lines of code (the intersection stuff was already there). There's a simple sandy3d scene and, in the upper left corner of the window, is its raytraced approximation.

2009-02-26

back to work

...hopefuly. I've been quite busy lately, changing job (actually just quiting the old one), changing home, city, even country. Nevertheless, I managed to do some work on the c++ version of my project. Basically, it is just particles - plane collision, but I've elaborated it a bit, just for fun: it will draw an image (have to be 128x128, 24b/pixel; it will use any "image.bmp" found in the current directory or a bmp file given as parameter, like painter animage.bmp)  with a "beam cutting through steel" like effect. Use the pagedown/pageup keys to increase/decrease the beam velocity.

Click the image below to download the executable (win32) . You can get the sources as well. You will need my old windows wrapper library if you want to build it yourself.


2008-11-27

soft bodies

Some soft bodies made of sandy3d primitives. Use the 1 - 7 keys to cycle through them.

2008-10-20

rays, part II

2008-10-16

...and some boxes

Axis aligned boxes. Use numpad+/numpad- to increase/decrease their number.

2008-10-14

some spheres

...bouncing on a plane. Some of them might (and most probably will) pass through the plane, or one through each other but, hey, it's a work in progress. I'll fix it soon, hopefully. Use the numpad+/numpad- keys to increase/decrease the number of spheres.

2008-10-13

rays

2008-09-20

particles and planes

Some particles colliding with a plane. Use the numpad+/numpad- keys to increase/decrease the number of particles.

2008-09-12

cloth

And while we're at springs, the mandatory cloth demo:

2008-09-11

spring simulation

Yet another interactive simulation: a fixed spring with a box attached to it. Use the PageUp/PageDown/Space keys to control the camera.

2008-09-06

particles and spheres

The same demo, this time spheres are involved. Press "space" to start/stop the camera to orbit around the scene.

2008-09-03

particles and boxes

This demo features some collision detection and response. You can increase/decrease the number of particles with numpad+ and numpad-, respectively.

forces and particles

I made a firework show by blowing up random sandy3d primitives. The visual appearance could definitely use some work, but as a proof of concept will do, so here it goes: