Jump to content


Photo

Raytracing, Anyone?


  • Please log in to reply
1 reply to this topic

#1 Garo

Garo

    Programming Department

  • Xenocide Programming Department
  • 119 posts

Posted 16 August 2005 - 02:29 PM

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...persampling.jpg
http://www.juhonkoti...6xsupersamp.jpg
http://www.juhonkoti...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 =)

Attached Files


Edited by Garo, 16 August 2005 - 02:32 PM.


#2 red knight

red knight

    Xenocide Project Leader

  • Xenocide Inactive
  • 3,310 posts

Posted 16 August 2005 - 02:40 PM

Nice screenshots, it is always a good idea to learn some extra stuff when you are stuck ;). BTW pretty well done for a 2 days work.

Greetings
Red Knight
Sourceforge Nick: flois - Federico Andres Lois
Visit my blog at: flois.blogspot.com

Posted Image

Pookie cover me, I am going in.