Forums (I/O Tower)
Forums 
  General Discussion 
 Real Time CSG Ray Tracer...


New New Comments | Post No Change | Locked Closed
AuthorComments:  Page: of 2 PagesNextLast
wwwmwww
User

Posts: 1,230
Real Time CSG Ray Tracer...

on Monday, March, 20, 2006 9:54 PM
All,

I believe I've talked about this before but it deserves its own thread. A friend I've meet through Tron-Sector is working on a real time CSG Ray Tracer. To my knowledge all real time ray tracers currently use meshes. His name is Martin Dahl and he just became a first time Dad back on February 16th. So join me in saying congratulations.

Here is the current version of his Ray Tracer.

http://www.wwwmwww.com/Martin/strahl.zip
You start off with this view...


And you can move around in this setting with the mouse. Press and hold the left mouse button while moving the mouse to change the direction you are looking. Press and hold the right mouse button while moving the mouse to move forward or backward relative to the direction you are looking. It took me some getting used to these controls but after a while I was able to control it enough to get this image.


The arena and light cycle models Martin is using are mine. The recognizer model is John McCarthy's. All the models are in the zip file in their pov formats.

Enjoy,
Carlorder abortion pill morning after pill price where to buy abortion pillabortion pills online http://www.kvicksundscupen.se/template/default.aspx?abortion-questions cytotec abortion


 
TronFAQ
Sector Admin

Posts: 4,467
Re: Real Time CSG Ray Tracer...

on Tuesday, March, 21, 2006 7:38 AM


That's extremely cool and innovative . . . I take it that very few modeling programs (if any) use the geometric primitive method any more, like MAGI did.

order abortion pill http://unclejohnsprojects.com/template/default.aspx?morning-after-pill-price where to buy abortion pillwhere to buy abortion pill ordering abortion pills to be shipped to house buy abortion pill online

LDSOFacebookTwitterYouTubeDeviantArt

 
wwwmwww
User

Posts: 1,230
Re: Real Time CSG Ray Tracer...

on Tuesday, March, 21, 2006 10:06 PM
Just got an email from Martin... he pointed out I was over looking half of the controls. Here is part of his email...

btw: have you noticed that by pressing "b" you enter the border rendering mode - "+" increases the Quality of the output. For even nicer pics press "f" for the frameless mode - however this is way slower than the non-frameless mode. (All the options are printed to the dos box when exiting the program). Have fun...

And making use of this info I made this image...


Very very cool stuff. I took a closer look at the POV models and Martin dropped the code I put in to give the white outlines on my walls. HOWEVER... he's now got a "border" feature built into his ray tracer that draws these lines without them having to be modeled. This is GREAT... now the lines are all the same width regardless of distance from the camera and this is just how they were made in the movie.

Martin, you need to find a way to make the border red on the recognizer. Also is there a way to turn off the border effect on just the blue part of the light cycle? I was really impressed when I first saw this but heck... now I'm even more impressed. Keep up the great work...

Carl

P.S. What does frameless mean in this context? I'm thinking of picture frames and frames of animations but neither seems correct in this context.


 
wwwmwww
User

Posts: 1,230
Re: Real Time CSG Ray Tracer...

on Tuesday, March, 21, 2006 10:14 PM
redrain85 Wrote:I take it that very few modeling programs (if any) use the geometric primitive method any more, like MAGI did.

With POV-Ray you can used either meshes or the geometric primitive method (CSG's). I don't have too much personal experience with other modeling programs so I can't really address this point very well. My introduction to 3D modeling came from POV-Ray and at the time I didn't think it was unique in this ability but now I'm not so sure.

Carl



 
TheReelTodd
Sector Admin

Posts: 0
Re: Real Time CSG Ray Tracer...

on Wednesday, March, 22, 2006 6:50 PM
Wow - that was pretty cool!

I wish the controls to move around were a little more user-friendly, but it was neat to see these things rendered in real time like that - I mean the fact that they're made old-school with primitives and all and not the usual meshes.

I remember how hard it was for you to get outlines on some of your models, Carl - look how Martin was able to show the outlines so easily. You really should look in to this technique - I bet it saves a ton of time in modeling and rendering!

I can't wait to see where this leads!



 
wwwmwww
User

Posts: 1,230
Re: Real Time CSG Ray Tracer...

on Wednesday, March, 22, 2006 7:42 PM
TheReelTodd Wrote:Wow - that was pretty cool!

I wish the controls to move around were a little more user-friendly, but it was neat to see these things rendered in real time like that - I mean the fact that they're made old-school with primitives and all and not the usual meshes.

I agree on all points. The moving in and out isn't so bad but controlling the direction you look seems much harder. Martin is it possible to fix "up" to say the y-axis and just have the left mouse button allow you to rotate about this axis. As is pitch pan and yaw (I think that's the correct terms) all seen to be controlled with the left mouse button and when you try to change just one it affects all 3. If 2 of these could be assigned to the arrow keys or something I think it'd make it much easier to control.

TheReelTodd Wrote:
I remember how hard it was for you to get outlines on some of your models, Carl - look how Martin was able to show the outlines so easily. You really should look in to this technique - I bet it saves a ton of time in modeling and rendering!

Martin and I have talked about this before. To be honest until just the yesterday I wasn't aware Martin had solved this problem. Martin PLEASE tell us how you did this and now having a solution in hand do you think you could do this in POV-Ray? I'm guessing a POV-Ray solution would require digging into POV-Ray source code which is available but WELL beyond me. Oh and your statement "I bet it saves a ton of time in modeling and rendering!" is certainly correct on both counts. I bet 75% of the modeling effort goes into modeling these outlines and that might be 90% is an attempt is made to optimize that code. And I'm sure my arena would render ATLEAST 10x faster in POV-Ray without all the extra shapes needed to outline everything. It might even be 100x faster. For example think of rendering a cube. That's 1 primitive. If I want to outline that cube I put a sphere at each corner and a cylinder along each edge. That's 20 more primitives that are needed just to outline 1 primitive. Outlining a cylinder gets even more complicated. First you put tori on both the end caps and as tori are rather complicated shapes they render rather slowly and then you have to outline the edges of the cylinder and as they depend on the camera location you can't do that with simple primitives in any easy fashion. What I do is place the whole cylinder inside a second cylinder that has an interior texture and an exterior texture. The outside texture is transparent so you can see through it like it isn't there. The interior texture is the color of your outlining. This way rays that would hit the inner cylinder do and show you the inner cylinder. Rays that pass close enough to the inner cylinder to go inside the outer cylinder but just miss the inner cylinder will hit the interior surface of the outer cylinder. This in effect outlines the inner cylinder when rendered. It works but is SLOWWWW....

TheReelTodd Wrote:
I can't wait to see where this leads!

As am I...

Oh... and one other question for Martin. I see the POV-Ray code for the game grid is in the arena model but you have the arena positioned such the its not centered on the grid. Why? And does your ray tracer support the code I've used for the grid? I don't see the grid at all moving around with your ray tracer.

Carl



 
luggage
User

Posts: 0
Re: Real Time CSG Ray Tracer...

on Thursday, March, 23, 2006 7:41 AM
wwwmwww Wrote:
TheReelTodd Wrote:Wow - that was pretty cool!

I wish the controls to move around were a little more user-friendly, but it was neat to see these things rendered in real time like that - I mean the fact that they're made old-school with primitives and all and not the usual meshes.

I agree on all points. The moving in and out isn't so bad but controlling the direction you look seems much harder. Martin is it possible to fix "up" to say the y-axis and just have the left mouse button allow you to rotate about this axis. As is pitch pan and yaw (I think that's the correct terms) all seen to be controlled with the left mouse button and when you try to change just one it affects all 3. If 2 of these could be assigned to the arrow keys or something I think it'd make it much easier to control.

Not a problem, I will fix the movement to be a little more user-friendly. For me it was really only important to be able to move around a bit. Right at the moment I am fooling around with multithreading, but I promise to update this in the next "release"


TheReelTodd Wrote:
I remember how hard it was for you to get outlines on some of your models, Carl - look how Martin was able to show the outlines so easily. You really should look in to this technique - I bet it saves a ton of time in modeling and rendering!

Martin and I have talked about this before. To be honest until just the yesterday I wasn't aware Martin had solved this problem. Martin PLEASE tell us how you did this and now having a solution in hand do you think you could do this in POV-Ray? I'm guessing a POV-Ray solution would require digging into POV-Ray source code which is available but WELL beyond me. Oh and your statement "I bet it saves a ton of time in modeling and rendering!" is certainly correct on both counts. I bet 75% of the modeling effort goes into modeling these outlines and that might be 90% is an attempt is made to optimize that code. And I'm sure my arena would render ATLEAST 10x faster in POV-Ray without all the extra shapes needed to outline everything. It might even be 100x faster. For example think of rendering a cube. That's 1 primitive. If I want to outline that cube I put a sphere at each corner and a cylinder along each edge. That's 20 more primitives that are needed just to outline 1 primitive. Outlining a cylinder gets even more complicated. First you put tori on both the end caps and as tori are rather complicated shapes they render rather slowly and then you have to outline the edges of the cylinder and as they depend on the camera location you can't do that with simple primitives in any easy fashion. What I do is place the whole cylinder inside a second cylinder that has an interior texture and an exterior texture. The outside texture is transparent so you can see through it like it isn't there. The interior texture is the color of your outlining. This way rays that would hit the inner cylinder do and show you the inner cylinder. Rays that pass close enough to the inner cylinder to go inside the outer cylinder but just miss the inner cylinder will hit the interior surface of the outer cylinder. This in effect outlines the inner cylinder when rendered. It works but is SLOWWWW....

Well - the technique I am using is really simple after all: For every traced pixel do the following (after tracing):
If the object that was hit by the upper neighbour and the right neighbour equal the object that was hit by the pixel itself the pixel is obviously not a border pixel. Otherwise, make the pixel the border colour. (I will try to describe it in more detail if you cannot follow this rather short description).

I really did not invent this and it is more of a post-process trick rather than a raytracing trick.
BUT: The effect neatly produces constant line thickness because the algorithm do


 
luggage
User

Posts: 0
Re: Real Time CSG Ray Tracer...

on Thursday, March, 23, 2006 7:55 AM
wwwmwww Wrote:
Martin, you need to find a way to make the border red on the recognizer. Also is there a way to turn off the border effect on just the blue part of the light cycle? I was really impressed when I first saw this but heck... now I'm even more impressed. Keep up the great work...

Carl

P.S. What does frameless mean in this context? I'm thinking of picture frames and frames of animations but neither seems correct in this context.

Hi Carl,

I will have to make this "border" feature parametable in some way - if my current idea is working you will be able to turn bordering on/off for each object individually.

Frameless rendering: What I mean with frames in this context is a single frame out of a series of frames. Like a TV film: A frame corresponds to the image that is displayed 1/25th of a second. Oh well, there is more to it for TV but you get the idea.

Now in non-frameless mode (the traditional approach) a complete frame is generated and displayed, then the next one and so on.
In frameless mode only parts of a frame are really generated and mixed with the provious frame. This is basically temporal undersampling of the image.

Just give it a try with strahl.exe: Press 'f' and move around a bit. When you do not move any more the image converges slowly. (Just do not do this with bordering on because this slows renering down a lot).

martinorder abortion pill abortion pill buy online where to buy abortion pill


 
wwwmwww
User

Posts: 1,230
Re: Real Time CSG Ray Tracer...

on Thursday, March, 23, 2006 10:57 AM
luggage Wrote:
Not a problem, I will fix the movement to be a little more user-friendly. For me it was really only important to be able to move around a bit. Right at the moment I am fooling around with multithreading, but I promise to update this in the next "release"

Already talking over my head... What's multithreading? As always... eager to see the next release.

luggage Wrote:
Well - the technique I am using is really simple after all: For every traced pixel do the following (after tracing):
If the object that was hit by the upper neighbour and the right neighbour equal the object that was hit by the pixel itself the pixel is obviously not a border pixel. Otherwise, make the pixel the border colour. (I will try to describe it in more detail if you cannot follow this rather short description).

I follow. I just don't think POV-Ray can do that. Some ideas... could up merge the blue body of the light cycle? I'm thinking maybe if you used 'merge' it would treat that whole parts as one object. Use union on the gray part where you want each detail outlined.

luggage Wrote:
I really did not invent this and it is more of a post-process trick rather than a raytracing trick.
BUT: The effect neatly produces constant line thickness because the algorithm does not care about the distance of the objects at all. This has one downside though: If the image is be traced at a very high resolution the lines will consequently shrink (in relation to the object). I do not know yet how to deal with in a consistent manner.

If I remember correctly it was you that pointed me to an article where a group HAD done just this by modifying POV-Ray source. I wish that was something I knew how to do but to be honest I know I don't have the time to even try to learn that stuff.

As for how to deal with the line width issue. Couldn't you simply say below "x" resolution you make 1 pixel the border color. Between "x" and "2x" resolution you make 2 pixels the border color, ect. Just an idea that at least sounds simple to me.

luggage Wrote:
Carl's right - I just have to add some way of specifying the border of an object (probably through the .pov file, but this will break compatibility with povray...)

Not necessarily. POV-Ray puts comments on lines after //. Or you can use /* to begin a comment block and */ to end a comment block if it takes up more then one line. If you put the code that specified your boarder color in either of these structures POV-Ray would ignore it.

luggage Wrote:
The game grid is not yet supported by my raytracer - because I have not yet implemented texturing. However, I will add procedural textures in the future for sure!
From the povray point of view my parser stops parsing .pov files at the point where the first object is declared. This way, povray does still render the complete file while I do not have to fool around with all these lightning and other keywords.
I don't remember why I did any translations on the arena though, I guess I just forgot about the grid at some point.

Martin

No problem... just curious. I notice in the arena code you have this:

// object {Arena}

object {Arena translate }

The simple untranslated Arena is in the correct position however its commented out. If I change which one is commented out and re-run your ray tracer the whole view changes. The camera is no longer looking at the light cycle and I didn't understand why that change would have moved either the light cycle or the camera. Can you explain that?

Carlabortion pills online abortion questions cytotec abortion


 
wwwmwww
User

Posts: 1,230
Re: Real Time CSG Ray Tracer...

on Thursday, March, 23, 2006 11:01 AM
luggage Wrote:
Hi Carl,

I will have to make this "border" feature parametable in some way - if my current idea is working you will be able to turn bordering on/off for each object individually.

Frameless rendering: What I mean with frames in this context is a single frame out of a series of frames. Like a TV film: A frame corresponds to the image that is displayed 1/25th of a second. Oh well, there is more to it for TV but you get the idea.

Now in non-frameless mode (the traditional approach) a complete frame is generated and displayed, then the next one and so on.
In frameless mode only parts of a frame are really generated and mixed with the provious frame. This is basically temporal undersampling of the image.

Just give it a try with strahl.exe: Press 'f' and move around a bit. When you do not move any more the image converges slowly. (Just do not do this with bordering on because this slows renering down a lot).

martin

Ok... I think I follow.

Carl


 
luggage
User

Posts: 0
Re: Real Time CSG Ray Tracer...

on Saturday, March, 25, 2006 6:16 AM
wwwmwww Wrote:
luggage Wrote:
Well - the technique I am using is really simple after all: For every traced pixel do the following (after tracing):
If the object that was hit by the upper neighbour and the right neighbour equal the object that was hit by the pixel itself the pixel is obviously not a border pixel. Otherwise, make the pixel the border colour. (I will try to describe it in more detail if you cannot follow this rather short description).

I follow. I just don't think POV-Ray can do that. Some ideas... could up merge the blue body of the light cycle? I'm thinking maybe if you used 'merge' it would treat that whole parts as one object. Use union on the gray part where you want each detail outlined.

Yes, sth. like that. Except that merge removes inner surfaces and we need to remove the outer edges. But anyways - there will be a (possibly simple) solution!

luggage Wrote:
I really did not invent this and it is more of a post-process trick rather than a raytracing trick.
BUT: The effect neatly produces constant line thickness because the algorithm does not care about the distance of the objects at all. This has one downside though: If the image is be traced at a very high resolution the lines will consequently shrink (in relation to the object). I do not know yet how to deal with in a consistent manner.

If I remember correctly it was you that pointed me to an article where a group HAD done just this by modifying POV-Ray source. I wish that was something I knew how to do but to be honest I know I don't have the time to even try to learn that stuff.

As for how to deal with the line width issue. Couldn't you simply say below "x" resolution you make 1 pixel the border color. Between "x" and "2x" resolution you make 2 pixels the border color, ect. Just an idea that at least sounds simple to me.


Ahh, I'd like to see that as feature for povray, too. Anyone volunteering for modifying their code? Carl, did you try out megapov? I think they had the ablity to outline, or at least sth similar, didn't they?

As for the size of the border, you are pointing to a possible solution!

No problem... just curious. I notice in the arena code you have this:

// object {Arena}

object {Arena translate }

The simple untranslated Arena is in the correct position however its commented out. If I change which one is commented out and re-run your ray tracer the whole view changes. The camera is no longer looking at the light cycle and I didn't understand why that change would have moved either the light cycle or the camera. Can you explain that?

Carl

I guess the cylce is exactly inside the wall when using the untranslated arena, thus invisible. You are right guessing that the different pov have no cross-effet at all. You are free to fool around with these files, and as long as they can be parsed the raytracer will render whatever is in there...


Martin


 
wwwmwww
User

Posts: 1,230
Re: Real Time CSG Ray Tracer...

on Saturday, March, 25, 2006 9:12 AM
luggage Wrote:
Carl, did you try out megapov? I think they had the ablity to outline, or at least sth similar, didn't they?

No, I haven't played with megapov yet. I've looked into it just a little bit and I don't recall seeing the outline feature but it is something I need to look into more.

luggage Wrote:
You are free to fool around with these files, and as long as they can be parsed the raytracer will render whatever is in there...

Cool... I'll have to put my recognizer in the scene when I've finished it.

Carl



 
luggage
User

Posts: 0
Re: Real Time CSG Ray Tracer...

on Monday, March, 27, 2006 5:33 AM
wwwmwww Wrote:
Cool... I'll have to put my recognizer in the scene when I've finished it.

Carl

Sure, I think you will quickly learn the subset of pov that I can parse. Just call the strahl.bat and you will see the error message when the model could not be parsed. If you need a helping hand you only have to ask abortion pills online abortion pill online purchase cytotec abortion


 
wwwmwww
User

Posts: 1,230
Re: Real Time CSG Ray Tracer...

on Tuesday, March, 28, 2006 12:52 PM
luggage Wrote:
wwwmwww Wrote:Cool... I'll have to put my recognizer in the scene when I've finished it.

Carl

Sure, I think you will quickly learn the subset of pov that I can parse. Just call the strahl.bat and you will see the error message when the model could not be parsed. If you need a helping hand you only have to ask

Martin,

This isn't my recognizer but I did manage to get my new light cycle into your ray tracer.


Just replace your cycle.pov file with this one...

http://www.wwwmwww.com/Martin/cycle_new.pov
A couple points/questions...

(1) You have one too many {quote} in the above post. Replace the { } with square brackets to see what I really want to say.

(2) Your ray tracer isn't as forgiving on format as POV-Ray is. Boy have I sure left out a lot of commas.

(3) Am I correct to assume matrix does the same thing as Shear_Trans(x-0.57735*y, y, z)?

I think that's it...
Carl


order abortion pill abortion pill buy online where to buy abortion pill


 
wwwmwww
User

Posts: 1,230
Re: Real Time CSG Ray Tracer...

on Tuesday, March, 28, 2006 1:04 PM
wwwmwww Wrote:
(3) Am I correct to assume matrix does the same thing as Shear_Trans(x-0.57735*y, y, z)?

I don't think it is. Atleast it isn't in POV-Ray as I just checked. I think this should be.

matrix

And I've now made that change and re-uploaded the pov file above.

Carl

where to buy abortion pill abortion types buy abortion pill online


 
luggage
User

Posts: 0
Re: Real Time CSG Ray Tracer...

on Wednesday, March, 29, 2006 2:40 PM
wwwmwww Wrote:
luggage Wrote:
wwwmwww Wrote:Cool... I'll have to put my recognizer in the scene when I've finished it.

Carl

Sure, I think you will quickly learn the subset of pov that I can parse. Just call the strahl.bat and you will see the error message when the model could not be parsed. If you need a helping hand you only have to ask

Martin,

This isn't my recognizer but I did manage to get my new light cycle into your ray tracer.

Just replace your cycle.pov file with this one...

A couple points/questions...

(1) You have one too many {quote} in the above post. Replace the { } with square brackets to see what I really want to say.

(2) Your ray tracer isn't as forgiving on format as POV-Ray is. Boy have I sure left out a lot of commas.

(3) Am I correct to assume matrix does the same thing as Shear_Trans(x-0.57735*y, y, z)?

I think that's it...
Carl



Great work, Carl! I am happy to see you have quickly adapted into the strahl subset of povray I am sorry that my parser is that strict, but it really is easier to be strict than lazy (from the coding point of view).


The matrix transform should be a Shear_Trans indeed. I will have to double check that I am actually did the right thing here (and not mixing indices).

Can't wait too finally see you recognizer in here!


 
wwwmwww
User

Posts: 1,230
Re: Real Time CSG Ray Tracer...

on Wednesday, March, 29, 2006 3:47 PM
luggage Wrote:Great work, Carl! I am happy to see you have quickly adapted into the strahl subset of povray I am sorry that my parser is that strict, but it really is easier to be strict than lazy (from the coding point of view).

It wasn't that hard to adapt. And no need to be sorry. I'd rather be strict than lazy too and it wasn't till I tried to port over my POV-Ray code that I realized just how lazy POV-Ray was letting me be.

luggage Wrote:The matrix transform should be a Shear_Trans indeed. I will have to double check that I am actually did the right thing here (and not mixing indices).

I think you just worked from the initial code I had posted here.

http://www.tron-sector.com/forums/default.aspx?do=top&id=303566
Check out my second post in that thread.

Carlorder abortion pill abortion pill buy online where to buy abortion pillabortion pills online abortion pill online purchase cytotec abortion


 
wwwmwww
User

Posts: 1,230
Re: Real Time CSG Ray Tracer...

on Wednesday, March, 29, 2006 7:00 PM
Martin,

I just spoted something "interesting" about your ray-tracer. I noticed something odd by studing the walls of the arena with the borders turned on.

Care to guess the difference between the two POV-Ray files that make these images?



It doesn't work the way I'd want it to but it is an interesting feature.

Carl


 
luggage
User

Posts: 0
Re: Real Time CSG Ray Tracer...

on Thursday, March, 30, 2006 2:02 PM
wwwmwww Wrote:
I think you just worked from the initial code I had posted here.

http://www.tron-sector.com/forums/default.aspx?do=top&id=303566
Check out my second post in that thread.

Carl

I guess that's it!



 
luggage
User

Posts: 0
Re: Real Time CSG Ray Tracer...

on Thursday, March, 30, 2006 2:08 PM
wwwmwww Wrote:Martin,

I just spoted something "interesting" about your ray-tracer. I noticed something odd by studing the walls of the arena with the borders turned on.

Care to guess the difference between the two POV-Ray files that make these images?

It doesn't work the way I'd want it to but it is an interesting feature.

Carl

Hmm - I should be able to tell, shouldn't I? I cannot check the source code right now but I *guess* one of the shapes is a box and the other one is made of intersection planes. But it does not really make sense to me.
If the box is rendered without border that would be an error and I will correct that (quite easily). I will check my source code as soon as possible


btw: Carl, I cannot wait to see what images you will produce with my raytracer!

Martin


 
 Page: of 2 PagesNextLast
New New Comments | Post No Change | Locked Closed
Forums 
  General Discussion 
 Real Time CSG Ray Tracer...