programing a raytracer

Discuss stuff not about Indigo.
Post Reply
164 posts
User avatar
Kram1032
Posts: 6649
Joined: Tue Jan 23, 2007 3:55 am
Location: Austria near Vienna

Post by Kram1032 » Tue May 01, 2007 9:11 pm

cool reflections!
I like 'em

User avatar
oodmb
Posts: 271
Joined: Thu Oct 26, 2006 5:39 am
Location: USA
Contact:

Post by oodmb » Tue May 01, 2007 11:18 pm

Image
a shiny monkey is a happy monkey

User avatar
oodmb
Posts: 271
Joined: Thu Oct 26, 2006 5:39 am
Location: USA
Contact:

Post by oodmb » Thu May 03, 2007 11:19 am

idea for normal smoothing algorithm:
(cant find any real internet sources on normal interpolation)

get the hit point
for each vertex on the triangle create a new ray through the hit point
get the length from the origin of that ray (vertex) to the line that it hits opposite of it using trig.
get the length from the origin to the hit point
for that vertex normalise the normal then scale it by (origin to hitpoint/origin to oposite edge).

add all the scalled vertex normals together then normalise that.
a shiny monkey is a happy monkey

User avatar
oodmb
Posts: 271
Joined: Thu Oct 26, 2006 5:39 am
Location: USA
Contact:

Post by oodmb » Thu May 03, 2007 2:29 pm

Image

new stuff: fixed the fresnel.
a shiny monkey is a happy monkey

User avatar
arneoog
Indigo 100
Posts: 504
Joined: Sun Jun 25, 2006 2:19 am
Contact:

Post by arneoog » Thu May 03, 2007 5:17 pm

This is getting very very nice, oodmb! :D
Good job! ;)

But how long do these images take to render? :)

User avatar
oodmb
Posts: 271
Joined: Thu Oct 26, 2006 5:39 am
Location: USA
Contact:

Post by oodmb » Thu May 03, 2007 5:25 pm

about 10-15 seconds for a 400*400 image with supersampling of 2, and about 20-30 seconds for a 600*600 image with a supersampling of 4,
considering its written in java, i'd say thats fairly fast. it also lacks any optimization effort whatsoever, i'll do that later.
a shiny monkey is a happy monkey

User avatar
oodmb
Posts: 271
Joined: Thu Oct 26, 2006 5:39 am
Location: USA
Contact:

Post by oodmb » Thu May 03, 2007 5:47 pm

yay, got normal smoothing working sort of (there is something wrong with how the actual normals are calculated resulting in black triangles if its input wrong again).

sorry mates, no more green, i lost that color:

Image
a shiny monkey is a happy monkey

User avatar
Kram1032
Posts: 6649
Joined: Tue Jan 23, 2007 3:55 am
Location: Austria near Vienna

Post by Kram1032 » Fri May 04, 2007 3:52 am

but the new colour looks great, too :D
the darker parts on the top of the spheres, are those the patters, you mean?

It really looks great :D

User avatar
oodmb
Posts: 271
Joined: Thu Oct 26, 2006 5:39 am
Location: USA
Contact:

Post by oodmb » Fri May 04, 2007 12:14 pm

ok, i'm pretty sure that the turning black problem has nothing to do with normal smoothing, although i have no idea what it is because.

my problem:

triangles specified by 3 vertexes,0 1 3, turns black depending on how these verticies are configured
for example it turns black at two configureations: 3,0,1 and 1,0,3 but none of the other configurations


Code: Select all

       
Ray[] vert = {
                        new Ray(new Point(100, 0, -10), new Vector(0, .1, .1)),
                        new Ray(new Point(0, 100, -40), new Vector(0, .8, .8)),
                        new Ray(new Point( -100, 0, -10), new Vector(0, .1,.1)),
                        new Ray(new Point(0, -100, 80), new Vector(0, .8, .8)),
        };


           Objects[] objective = {
                                                  new Objects(new polygon(true, vert[3], vert[0], vert[1]), bdf),
}
a shiny monkey is a happy monkey

User avatar
eman7613
Posts: 597
Joined: Sat Sep 16, 2006 2:52 pm

Post by eman7613 » Fri May 04, 2007 12:18 pm

First debug, turn of normal smoothing and run it. No black lines, probably noram smoothing, still black lines, not normal smoothing problem
Yes i know, my spelling sucks

User avatar
oodmb
Posts: 271
Joined: Thu Oct 26, 2006 5:39 am
Location: USA
Contact:

Post by oodmb » Fri May 04, 2007 12:22 pm

its not black lines that are the problem, i fixed that one already. its not a normal smoothing problem, i've been debbuging it for the last day and it doesnt realy seem to be an algorithmic error either.

also- i just learned about static constructors in java for edditing static classes... i changed my scene and camera stuff to work like this and now it renders about twice as fast (3-5 seconds for 400*400 2osi). i'm happy.
a shiny monkey is a happy monkey

User avatar
CTZn
Posts: 7240
Joined: Thu Nov 16, 2006 4:34 pm
Location: Paris, France

Post by CTZn » Fri May 04, 2007 2:07 pm

for example it turns black at two configureations: 3,0,1 and 1,0,3 but none of the other configurations
What about 0,3,1 (if that's possible) ? If 0,3,1 works ok I have no clue, sorry, if it doesn't maybe these triangles are created inverted, could it be ? In Maya (and some others apps I think) the direction of the normal of a created triangle depends on if you created the vertices clockwise or counter-clockwise (the later creating tris with normal facing toward the camera).
obsolete asset

User avatar
oodmb
Posts: 271
Joined: Thu Oct 26, 2006 5:39 am
Location: USA
Contact:

Post by oodmb » Fri May 04, 2007 2:24 pm

0, 3, 1 works fine
a shiny monkey is a happy monkey

User avatar
CTZn
Posts: 7240
Joined: Thu Nov 16, 2006 4:34 pm
Location: Paris, France

Post by CTZn » Fri May 04, 2007 2:34 pm

oki, good luck :)

:arrow:
obsolete asset

User avatar
oodmb
Posts: 271
Joined: Thu Oct 26, 2006 5:39 am
Location: USA
Contact:

Post by oodmb » Fri May 04, 2007 2:38 pm

if anybody feels they can figure out the issue and can be trusted to not post my source on the internet, (and can read my rediculously messy non documented/notated code) i'd be more than happy to pm you a coppy of the source without password protection.
a shiny monkey is a happy monkey

Post Reply
164 posts

Who is online

Users browsing this forum: Majestic-12 [Bot] and 6 guests