Jump to content
XCOMUFO & Xenocide

Raytracing, Anyone?


Garo

Recommended Posts

While I'm having small problems with the geoposition calculating and path finding algorithms in the ufo task/mission code, I suddently got an idea to implement a raytrace engine using Java.

 

Here's what I've got so far in less than two days:

 

http://www.juhonkoti.net/files/projects/ra...persampling.jpg

http://www.juhonkoti.net/files/projects/ra...6xsupersamp.jpg

http://www.juhonkoti.net/files/projects/ra...persampling.jpg

 

Features:

 

+ Support for sphere primitives

+ Support for ambient, point and direction lights

+ Simple mirrors

+ Simple ambient, diffuse and specular ligthing materials

+ Supersampling (see the difference with 16x and without supersampling)

+ Scene definition in very simple script syntax

 

Here's the scene file for the demo1 images =)

eye 1 -2 5
lookat 1.5 3 0
up 0 0 1
fov 80
background 0.078 0.361 0.753

declare material ground 1 0.75 0.33     0.15 1.0 0     1 0.2 0.5 1
declare material ball1 0.5 0.45 0.35    0.07 1.0 0.8   3 0.5 0.0 1.0
declare material ball2 1 1 1            1 1.0 0.8      4 0.5 0.0 1.0
declare material ball3 0.1 0.1 0.1            1 1.0 0        1 1 0.0 1.0
declare material ball4 0.4 1 0.4            1 0.2 0.2    4 0.5 0.0 1.0
declare material ball5 0.7 1 1            1 0.3 0      4 0.5 0.0 1.0
declare material ball6 1 0.2 0.6            1 0.5 0.4    4 0.5 0.0 1.0

sphere ground 0 0 -100 99.5



sphere ball1 -1 3 1 0.4 # A
sphere ball1 0 4 2 0.7 # B
sphere ball2 1 5 1 0.4 # C
sphere ball4 2 2 2 0.7 # D
sphere ball5 3 3 1 0.4 # E
sphere ball6 4 4 2 0.7 # F

sphere ball3 4 1 0.2 0.8 # G
sphere ball3 1 4 0.2 0.8 # H
sphere ball3 1 0 0.2 0.8 # I
sphere ball3 1 1 0.2 0.6 # J

light 0.2 0.2 0.2 ambient

light 0.8 0.8 0.8 point 0 -3 5 #V1
light 0.4 0.4 0.4 point 5 -3 5 #V2
light 0.1 0.1 0.6 point 5 -3 1

 

- Garo =)

demo1_thumbnail.jpg

Edited by Garo
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...