Animated realtime ASCII raytracing back

Board: Board index ‹ Ray tracing ‹ Tools, demos & sources

(L) [2007/08/29] [coldcity] [Animated realtime ASCII raytracing] Wayback!

Hi all,

I'm blown away by the talent on this forum.

Although I'm in two minds about posting and ranking myself low on the skill ladder, on reflection at least you might enjoy the joke.

Animated realtime raytracing - in text mode. It's easy for even us realtime newbies to get good framerates with an effective video resolution of 80x25!

[IMG #1 Image]

Windows binary and full source (VC++) available at [LINK http://www.coldcity.com/ my site].

Edit: It's blatantly VC++, not Dev-C++.
[IMG #1]:[IMG:#0]
(L) [2007/08/29] [coldcity] [Animated realtime ASCII raytracing] Wayback!

Hi all,


I'm blown away by the talent on this forum.


Although I'm in two minds about posting and ranking myself low on the skill ladder, on reflection at least you might enjoy the joke.


Animated realtime raytracing - in text mode. It's easy for even us realtime newbies to get good framerates with an effective video resolution of 80x25!


[IMG #1 ]


Windows binary and full source (VC++) available at [LINK http://www.coldcity.com/ my site].


Edit: It's blatantly VC++, not Dev-C++.
[IMG #1]:[IMG:#0]
(L) [2007/08/29] [greenhybrid] [Animated realtime ASCII raytracing] Wayback!

Heya and Welcome [SMILEY :D]

That looks very much like fun! I say: Trace more complex scenes, e.g. Sponza, that would be even more very much fun, yay!
(L) [2007/08/29] [greenhybrid] [Animated realtime ASCII raytracing] Wayback!

Heya and Welcome [SMILEY Very Happy]


That looks very much like fun! I say: Trace more complex scenes, e.g. Sponza, that would be even more very much fun, yay!
_________________
[LINK http://greenhybrid.net/ greenhybrid.net]

Real Men code Software Graphics.
(L) [2007/08/29] [toxie] [Animated realtime ASCII raytracing] Wayback!

Cool.. ASCII demos always rock!
_________________
Eat plutonium death you disgusting alien weirdos!
(L) [2007/08/29] [coldcity] [Animated realtime ASCII raytracing] Wayback!

Thanks! I'm going to backport in my object loading code from the most recent codebase of my raytracer and try Sponza and some others.


I'll be interested to see if I can still get realtime framerates with my pig-ignorant brute-force approach.
(L) [2007/08/29] [coldcity] [Animated realtime ASCII raytracing] Wayback!

OK, I took the latest version of my raytracer, stripped the hell out of it, and dropped in my ASCII renderer. 1.3K triangles, 2 point light sources, 3-4fps. It's not great but it's a start!

This is a very naive implementation with no space partitioning. Even some simple partitioning should get this up to a decent framerate! I'll keep playing and post anything worthwhile.

In the meantime, this:

[IMG #1 Image]

becomes

[IMG #2 Image]

It looks a lot prettier in motion! [LINK http://www.coldcity.com/wp-content/uploads/2007/08/dragontest.zip Here] is a binary download of the above; the camera animates around the scene.

(The lovely little dragon is from [LINK http://www.turbosquid.com/FullPreview/Index.cfm/ID/228397 here] and is one of my favorite test models.)

As an aside, is Dev-Cpp considered an acceptable compiler for realtime stuff? I've used it a fair bit but I've no idea of it's performance reputation to be honest. I'm not keen on these massive stubbed exes though. Since the last time I ripped out the guts of my raytracer to make a realtime ASCII thing I'd switched over to Dev-Cpp from VC++ 6. Coming back to it having not touched it for ages I now wish I'd stuck with an MS compiler. VC++ 2005 Express Ed shows no sign of wanting to compile my codebase [SMILEY :(]
[IMG #1]:[IMG:#0]
[IMG #2]:[IMG:#1]
(L) [2007/08/29] [coldcity] [Animated realtime ASCII raytracing] Wayback!

OK, I took the latest version of my raytracer, stripped the hell out of it, and dropped in my ASCII renderer. 1.3K triangles, 2 point light sources, 3-4fps. It's not great but it's a start!


This is a very naive implementation with no space partitioning. Even some simple partitioning should get this up to a decent framerate! I'll keep playing and post anything worthwhile.


In the meantime, this:


[IMG #1 ]


becomes


[IMG #2 ]


It looks a lot prettier in motion! [LINK http://www.coldcity.com/wp-content/uploads/2007/08/dragontest.zip Here] is a binary download of the above; the camera animates around the scene.


(The lovely little dragon is from [LINK http://www.turbosquid.com/FullPreview/Index.cfm/ID/228397 here] and is one of my favorite test models.)


As an aside, is Dev-Cpp considered an acceptable compiler for realtime stuff? I've used it a fair bit but I've no idea of it's performance reputation to be honest. I'm not keen on these massive stubbed exes though. Since the last time I ripped out the guts of my raytracer to make a realtime ASCII thing I'd switched over to Dev-Cpp from VC++ 6. Coming back to it having not touched it for ages I now wish I'd stuck with an MS compiler. VC++ 2005 Express Ed shows no sign of wanting to compile my codebase [SMILEY Sad]
[IMG #1]:[IMG:#0]
[IMG #2]:[IMG:#1]
(L) [2007/08/29] [coldcity] [Animated realtime ASCII raytracing] Wayback!

>> JuNC wrote:Cool!  
Which version of mingw does devcpp use?  Mingw with gcc 4.2 came out recently so you can possibly just drop that straight in.

- Good point, thanks.

I persuaded my installation to update itself to 4.1.2 via the autoupdater. I was previously on 3.4.2.

However, my framerate is now approx 30% what it was!
(L) [2007/08/29] [JuNC] [Animated realtime ASCII raytracing] Wayback!

Cool!  


Which version of mingw does devcpp use?  Mingw with gcc 4.2 came out recently so you can possibly just drop that straight in.
(L) [2007/08/30] [coldcity] [Animated realtime ASCII raytracing] Wayback!

Oh, I should mention I'm using the old Möller-Trumbore "Fast, minimum storage ray-triangle intersection", 1997.


Further to my previous, I got the codebase running on VC++ 2008 Express Edition Beta.


gcc 3.4.2: 3-4 fps

VC++2008 EE Beta: 2-3 fps

gcc 4.1.2: 1-2 fps


... which surprised me. I went back to a default gcc-3.4.2 installation of Dev-C++. The filesize of the exe was suddenly 200K smaller but it was as slow as 4.1.2!


Using the Dev-C++ web update I updated MinGW runtime to 3.11, keeping gcc-3.4.2, and finally got the speed back, while keeping the small(er) exe. I guess I'll stick with that combo for now.
(L) [2007/08/30] [greenhybrid] [Animated realtime ASCII raytracing] Wayback!

Highly Cool Demo. As your running now at 4 fps, I guess adding a naive kd-tree or a bounding interval hierarchy (toxie above, btw, wrote the bih paper together with Alex Keller) will increase that framerate by some orders of magnitude, keep on!



edit: hui, grats toxie: [LINK http://en.wikipedia.org/wiki/Bounding_interval_hierarchy]
_________________
[LINK http://greenhybrid.net/ greenhybrid.net]

Real Men code Software Graphics.
(L) [2007/08/30] [coldcity] [Animated realtime ASCII raytracing] Wayback!

>> greenhybrid wrote:toxie above, btw, wrote the bih paper together with Alex Keller

- I know - celebrity company!

Thanks for your encouragement; Ompf has inspired me back into working on my raytracer. I'll have a play, expect a faster demo soon [SMILEY :D]
(L) [2007/08/30] [coldcity] [Animated realtime ASCII raytracing] Wayback!

3000 triangles - 10fps [SMILEY :D]

If I can get 3000 sustaining 20fps with an additional lightsource or two, I swear I'm writing a first-person shooter.

Time to benchmark WriteConsoleOutput and find out how fast it can blit.
(L) [2007/08/30] [toxie] [Animated realtime ASCII raytracing] Wayback!

>> coldcity wrote:- I know - celebrity company!

bwahaha.. that was a good one.. :)

btw: do you generate the ASCII output on the fly or is it somehow downsampled from a slightly larger resolution?
(L) [2007/08/30] [coldcity] [Animated realtime ASCII raytracing] Wayback!

3000 triangles - 10fps [SMILEY Very Happy]


If I can get 3000 sustaining 20fps with an additional lightsource or two, I swear I'm writing a first-person shooter.


Time to benchmark WriteConsoleOutput and find out how fast it can blit.
(L) [2007/08/30] [greenhybrid] [Animated realtime ASCII raytracing] Wayback!

>> coldcity wrote:- I know - celebrity company!


?
(L) [2007/08/30] [coldcity] [Animated realtime ASCII raytracing] Wayback!

>> toxie wrote:coldcity wrote:- I know - celebrity company!
bwahaha.. that was a good one..
btw: do you generate the ASCII output on the fly or is it somehow downsampled from a slightly larger resolution?

- hehe - famous in some parts!

The ASCII rendering could be better and there are far nicer libs than mine around. Some of the [LINK http://www.taat.fi/tmdc/ tmdc] stuff is amazing.

The resolution is 80x25; one primary ray is fired for each character spot so there's no sub or supersampling. The renderer class accepts an RGB colour and assigns most appropriate char, then blits the buffer to the console when the frame's complete. I'd be able to pick more appropriate characters with 4x adaptive supersampling but I actually like the ultra-low-res subsampled look I'm getting. It's got a real charm when it's moving.

I have the option of an additional HDR pass before blitting to make the most of the limited palette range but I'm not doing that at the moment.
(L) [2007/08/30] [coldcity] [Animated realtime ASCII raytracing] Wayback!

just thought I'd share a little more progress and some badly cropped pics.

I've hacked in Sol's [LINK http://sol.gfxile.net/code.html TextFX] library, which turned out to be quite similar to mine but with far superior lookup tables.

Much better shading now:

[IMG #1 Image]
[IMG #2 Image]

And I get the bonus that I can do this!

[IMG #3 Image]

... which looks amazing animating. I'll post another demo soon.
[IMG #1]:[IMG:#0]
[IMG #2]:[IMG:#1]
[IMG #3]:[IMG:#2]
(L) [2007/08/30] [coldcity] [Animated realtime ASCII raytracing] Wayback!

just thought I'd share a little more progress and some badly cropped pics.


I've hacked in Sol's [LINK http://sol.gfxile.net/code.html TextFX] library, which turned out to be quite similar to mine but with far superior lookup tables.


Much better shading now:


[IMG #1 ]

[IMG #2 ]


And I get the bonus that I can do this!


[IMG #3 ]


... which looks amazing animating. I'll post another demo soon.
[IMG #1]:[IMG:#0]
[IMG #2]:[IMG:#1]
[IMG #3]:[IMG:#2]
(L) [2007/08/31] [JuNC] [Animated realtime ASCII raytracing] Wayback!

>> coldcity wrote:Oh, I should mention I'm using the old Möller-Trumbore "Fast, minimum storage ray-triangle intersection", 1997.
Further to my previous, I got the codebase running on VC++ 2008 Express Edition Beta.
gcc 3.4.2: 3-4 fps
VC++2008 EE Beta: 2-3 fps
gcc 4.1.2: 1-2 fps
... which surprised me. I went back to a default gcc-3.4.2 installation of Dev-C++. The filesize of the exe was suddenly 200K smaller but it was as slow as 4.1.2!
Using the Dev-C++ web update I updated MinGW runtime to 3.11, keeping gcc-3.4.2, and finally got the speed back, while keeping the small(er) exe. I guess I'll stick with that combo for now.

If you wanted to fiddle some more you can get the gcc4.2.1 'tech preview' direct from the mingw site.  Seems stable enough, or theres an unofficial 4.2.0 from [LINK http://forums.codeblocks.org/index.php?topic=5937.90].  I definitely saw a speedup going from 3.4.5 to both TDM's 4.2.0 and the latest mingw - nothing broke for all this 'preview' lark [SMILEY ;)])  Dev-c++ perhaps isn't quite so easy to configure direct from the mingw downloads though, I don't know since I don't use it.
(L) [2007/08/31] [coldcity] [Animated realtime ASCII raytracing] Wayback!

1200 triangles - 100 frames a second :O This is with a regular grid. I'm astounded..


@ JuNC - thanks, I've been meaning to play with Code::Blocks for a while so I'll try installing it and hooking the unofficial 4.2.0 up to it.
(L) [2007/08/31] [Lynx] [Animated realtime ASCII raytracing] Wayback!

Still strange if compilers are that far apart...you must be doing something evil in your code [SMILEY :)]
At least i have never seen more than about 30-40% between compilers (like mingw/gcc 3.3, mingw/gcc 3.4, msvc 2003 and gcc3.4 linux)
I hope you told the compiler to optimize code at least a bit [SMILEY ;)]

Anyway, that 100fps with uniform grid sounds quite nice already...
And it looks pretty cool with that new lib, nice!

Now i wonder how it would look in colored text output, just discovered "libcaca", the screenshots i found look nice.
(L) [2007/08/31] [coldcity] [Animated realtime ASCII raytracing] Wayback!

Yes, the speed difference is very odd... possibly I must get rid of my homebrew linked list  [SMILEY :oops:] (runs and hides)

libcaca does indeed look pretty, I might try and work it in and see how it is.
(L) [2007/08/31] [Lynx] [Animated realtime ASCII raytracing] Wayback!

Still strange if compilers are that far apart...you must be doing something evil in your code [SMILEY Smile]

At least i have never seen more than about 30-40% between compilers (like mingw/gcc 3.3, mingw/gcc 3.4, msvc 2003 and gcc3.4 linux)

I hope you told the compiler to optimize code at least a bit [SMILEY Wink]


Anyway, that 100fps with uniform grid sounds quite nice already...

And it looks pretty cool with that new lib, nice!


Now i wonder how it would look in colored text output, just discovered "libcaca", the screenshots i found look nice.
(L) [2007/08/31] [coldcity] [Animated realtime ASCII raytracing] Wayback!

Yes, the speed difference is very odd... possibly I must get rid of my homebrew linked list  [SMILEY Embarassed] (runs and hides)


libcaca does indeed look pretty, I might try and work it in and see how it is.
(L) [2007/09/22] [coldcity] [Animated realtime ASCII raytracing] Wayback!

Just to say, that was about as far as I got with this little project; you can get the final version (binary and full source) [LINK http://www.coldcity.com/index.php/more-ascii-raytracing-fun here].

I've since gone back to my "pretty" tracer, playing with kd-trees and BIH like everyone else [SMILEY ;)]
(L) [2007/09/22] [coldcity] [Animated realtime ASCII raytracing] Wayback!

Just to say, that was about as far as I got with this little project; you can get the final version (binary and full source) [LINK http://www.coldcity.com/index.php/more-ascii-raytracing-fun here].


I've since gone back to my "pretty" tracer, playing with kd-trees and BIH like everyone else [SMILEY Wink]
(L) [2007/09/22] [lycium] [Animated realtime ASCII raytracing] Wayback!

btw, a better way to compute your vertex normals is to:


1. set them all to null vector

2. add each face's normal to its constituent vertices' normal

3. normalise all vertex normals
(L) [2007/09/22] [coldcity] [Animated realtime ASCII raytracing] Wayback!

lycium - now done - the speedup on normal generation for 200,000 triangles is, of course, extreme [SMILEY :D]

thanks again. I do feel silly though  [SMILEY :oops:]
(L) [2007/09/22] [coldcity] [Animated realtime ASCII raytracing] Wayback!

Thanks lycium!


I knew the way I was doing it wasn't the best. Yours is far superior, I'll change my "pretty" tracer to do this.
(L) [2007/09/22] [coldcity] [Animated realtime ASCII raytracing] Wayback!

lycium - now done - the speedup on normal generation for 200,000 triangles is, of course, extreme [SMILEY Very Happy]


thanks again. I do feel silly though  [SMILEY Embarassed]
(L) [2007/09/22] [lycium] [Animated realtime ASCII raytracing] Wayback!

no problemo :)


i remember being really happy to discover that method back in my qbasic days: i could dynamically change geometry and still have vertex normals! :D
(L) [2007/11/07] [greenhybrid] [Animated realtime ASCII raytracing] Wayback!

coldcity: is this maybe interesting to you: [LINK http://taat.fi/tmdc/ textmode compo at taat]?

back