SimplyMaya Forums

Welcome to the forum, feel free to ask questions here.


SM Forums / Maya Questions / Programming / WIP: My Raytracer

Programming MEL Scripts, Expressions & Programming Related Topics

Join the conversation. Reply to post
Page 5 of 7 « First 3 4 5 6 7
 
Thread Tools
14-04-2006, 06:30 PM   #61
MattTheMan
Registered User
 
MattTheMan's Avatar
 
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
ok, so I started coding again.

I started from scratch. My program has support for triangles and supersampling, not to be confused w/ anti-aliasing, even though they have the same result, my program just samples each pixel 4 times(this can be increased or decreased, but at 4 samples it takes about a second to render). I can, however add true AA, the comp checking itself for aliasing and just supersampling the pixels that need it.

However, that doesnt always work, and mine always works. But mine wastes a ton of time basically rendering the scene 5 times....
Attached Thumbnails
Click image for larger version

Name:	aa.jpg
Views:	152
Size:	61.0 KB
ID:	27893  
__________________
Live the life you love, love the life you live
  Reply with quote
14-04-2006, 07:30 PM   #62
MattTheMan
Registered User
 
MattTheMan's Avatar
 
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
Next up- soft shadows (raytraced shadows, in Maya terms).
First, however I will make it just as if it was a grid of shadow casting lights on the area light, and then I will make my program a Monte Carlo tracer! Yay!

Monte Carlo is simply a method that goes like this:

Enough random samples and their average will become the correct answer.

So then I will randomly jitter the position of the samples for the area light, and that will replace the banding that will occur with noise. Then I will increase the samples until- voila, a perfect soft shadow.
Attached Thumbnails
Click image for larger version

Name:	shadowsarea.jpg
Views:	154
Size:	59.1 KB
ID:	27895  
__________________
Live the life you love, love the life you live
  Reply with quote
14-04-2006, 10:33 PM   #63
DJbLAZER
Registered User
 
DJbLAZER's Avatar
 
Join Date: Jun 2004
Location: Gothenburg, Sweden
Posts: 1,318
Nice going...I'm thinking about writing a raytracer myself since am taking a "Advanced Computer Graphics"-course right now. Would be good for the exam.

What codebase are you using? Since you're re-writing "from scratch" every now and then you can't seriously start with an empty cpp-file... it would take ages juts to get a pixel on the screen.

Last edited by DJbLAZER; 14-04-2006 at 11:09 PM.
  Reply with quote
14-04-2006, 11:08 PM   #64
DJbLAZER
Registered User
 
DJbLAZER's Avatar
 
Join Date: Jun 2004
Location: Gothenburg, Sweden
Posts: 1,318
I can see now that you're using the code from the tutorial at flipCode....
  Reply with quote
14-04-2006, 11:35 PM   #65
MattTheMan
Registered User
 
MattTheMan's Avatar
 
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
im not copying it, and my coding is much simpler then theirs...
i have no clue how to do inheritance sampling or polymorphism, so my code is WAAAY different then theirs.

Plus when I go into monte carlo Global Illumination and caustics, I have my own (thats right, my own) methods that are 10x slower and 100x simpler then the norm. Such as storing a huge array of 2d points and then comparing all thousands of them agains the non-gi rendered pic at each pixel, and then adding colors as the 2d map said.

But its true that most of my code did come from flipcode THE FIRST TIME I WROTE IT. Then I couldnt figure out what was happening in my own code, so I rewrote it with an "adapted" form of the flipcode codes. Now, this 3rd time I am writing it completely on my own, simply because flipcode's renderer isnt a Monte Carlo based Path Tracer, and mine will be.

Now, here is my first soft shadow render
Attached Thumbnails
Click image for larger version

Name:	softshads.jpg
Views:	153
Size:	68.0 KB
ID:	27897  
__________________
Live the life you love, love the life you live
  Reply with quote
15-04-2006, 02:16 PM   #66
MattTheMan
Registered User
 
MattTheMan's Avatar
 
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
Yay! We have noise! Noise is much better then bands.

We are much more used to noise... like when you try to find your way around in the dark, you see tons of noise.

This is rendered with a jittered regular grid area light, 16 light rays per pixel.
Attached Thumbnails
Click image for larger version

Name:	noise16samples.jpg
Views:	146
Size:	59.6 KB
ID:	27910  
__________________
Live the life you love, love the life you live
  Reply with quote
15-04-2006, 02:36 PM   #67
MattTheMan
Registered User
 
MattTheMan's Avatar
 
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
This is the effect of supersampling on the noise. I increased the scattering of the light (by 2 times) and added 2 samples (5 per pixel) supersampling.

Of course, it took way longer to render, and the quality is about the same as if I had increased the shadow rays to 81. But I'm sure the 81 samples would take longer to render.
Attached Thumbnails
Click image for larger version

Name:	supersamplednoise.jpg
Views:	144
Size:	53.7 KB
ID:	27911  
__________________
Live the life you love, love the life you live
  Reply with quote
15-04-2006, 07:16 PM   #68
MattTheMan
Registered User
 
MattTheMan's Avatar
 
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
my last, non-gi render... next one will have path tracing on... sniff...
Attached Thumbnails
Click image for larger version

Name:	lastnon-gi.jpg
Views:	143
Size:	58.0 KB
ID:	27915  
__________________
Live the life you love, love the life you live
  Reply with quote
15-04-2006, 07:36 PM   #69
gohan1842
Subscriber
 
gohan1842's Avatar
 
Join Date: Jul 2004
Posts: 1,060
Nice little raytracing program. Learning some of the basics of c++ I see.

I program myself. Me and my dad made this program. It gets quite a few sales.

http://www.grantfullen.com/index.php...c=detail&pid=1
__________________
I'm not a geek. I'm a nerd.

msn - g1842@hotmail.com
I'm up for a chat anytime.
  Reply with quote
15-04-2006, 08:08 PM   #70
MattTheMan
Registered User
 
MattTheMan's Avatar
 
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
cool! is your dad a programmer?
__________________
Live the life you love, love the life you live
  Reply with quote
16-04-2006, 11:04 AM   #71
arneoog
Registered User
 
arneoog's Avatar
 
Join Date: Mar 2006
Location: Norway
Posts: 189
Wow! Nice Software!

This is amazing for a 13 year old!!!
I'm 16 and I'v thought about learning c++ my self.

I was wondering if you could tell how you started, what was the first you did to start learning c++?
And what software do you use for the programming?

Thanks! And again, Nice Software!
__________________
Arne OOG - Makin' stuff
>>elqx Studios<<
  Reply with quote
16-04-2006, 12:23 PM   #72
MattTheMan
Registered User
 
MattTheMan's Avatar
 
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
thanks!

Well the first thing I did was googled "beginner's c++ tutorials" then, I learnd a bit from there, and I bought c++ for dummies.

Then I decided what I wanted to program (raytracer) and I started reading on vector maths, calculus, linear algebra, etc...

As for compiler- im using a free compiler called DevC++ and also I am using 2 libraries to put pixels on the screen- SDL and QuickCG. Both are easy to install and work like a charm.

Anyway... I really need to get my ass in gear now, I am still just reading papers on Monte Carlo Path Tracing, and I don't understand a lot of it.

Also, I was thinking about making my renderer an Unbiased Renderer, but that would mean implementing Metropolis Light Transport, andI really don't want to go there.

l8er
Matt
__________________
Live the life you love, love the life you live

Last edited by MattTheMan; 17-04-2006 at 04:08 PM.
  Reply with quote
16-04-2006, 02:21 PM   #73
MattTheMan
Registered User
 
MattTheMan's Avatar
 
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
Ok, so I added reflections on top of soft shadows. Just cuz I need reflections and refractions for my Global Illumination and caustics algorithms, and I just want to make sure that they work. And while I am at it, I will add glossy reflections. I am working on it now.

However, its a much more complicated concept, that involves semi-random hemispherical sampling, but if I can do that, then I can do global illumination too.
Attached Thumbnails
Click image for larger version

Name:	reflections.jpg
Views:	129
Size:	56.8 KB
ID:	27922  
__________________
Live the life you love, love the life you live
  Reply with quote
17-04-2006, 03:20 PM   #74
MattTheMan
Registered User
 
MattTheMan's Avatar
 
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
lol, I have to warn everybody- this is NOT the right way to do glossy reflections LOL :p
Attached Thumbnails
Click image for larger version

Name:	baddiffrefl.jpg
Views:	120
Size:	66.7 KB
ID:	27964  
__________________
Live the life you love, love the life you live
  Reply with quote
18-04-2006, 01:05 AM   #75
Joopson
Registered User
 
Joopson's Avatar
 
Join Date: Jul 2005
Location: Boston, MA
Posts: 2,314
looks cool either way:p
__________________
Environment Artist @ Plastic Piranha
www.joopson.com
  Reply with quote
Reply
Page 5 of 7 « First 3 4 5 6 7

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Thumbnails in WIP & Finished Work Nilla Site News & Announcements 11 09-12-2010 06:22 AM
Asia girl - WIP caligraphics Work In Progress 21 12-03-2004 11:30 AM
WIP critiques - a suggestion Alan Maya Basics & Newbie Lounge 2 14-01-2004 02:48 PM
Commando Rodent Gopher - Concepts + WIP orgeeizm Work In Progress 31 15-10-2003 09:17 PM
FN tactical shotgun WIP [icarus_uk] Work In Progress 7 15-08-2003 05:44 PM