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:

[url="http://www.juhonkoti.net/files/projects/raytracking/demo1-16xsupersampling.jpg"]http://www.juhonkoti.net/files/projects/ra...persampling.jpg[/url]
[url="http://www.juhonkoti.net/files/projects/raytracking/demo1-camera2-16xsupersamp.jpg"]http://www.juhonkoti.net/files/projects/ra...6xsupersamp.jpg[/url]
[url="http://www.juhonkoti.net/files/projects/raytracking/demo1-no-supersampling.jpg"]http://www.juhonkoti.net/files/projects/ra...persampling.jpg[/url]

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 =)
[code]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[/code]

- Garo =) Edited by Garo
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...