This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

Duta
Duta presents ...

2013/3/9

3D Renderer

This 3d renderer has the following:
- Ambient Lighting
- Point Lighting
- Shadows
- Gamma correction

It's not fast enough for real-time rendering, for a few reasons:
- It's not hardware accellerated
- It's in Java, which is slower than C/C++
- I chose clean code rather than speed
- I've only spent a couple of hours on it

What I mean when I say that choosing clean code causes it to render slower, is that I use abstractions in the code such as Vector classes rather than just dealing with primitive data types.

Currently this just renders a single, static scene. This is just to show the renderer in action. In the future it will render different images.

Please bear in mind that this uses a technique called "raycasting" (or "raytracing"), which means the images are well-rendered but slow. Raycasting isn't used in games, it's used in things like animated movies where it doesn't matter if the rendering is not instant.

7669 views / 35 in the last 7 days

8 votes | 0 in the last 7 days

Tags: mouse game simulation physics demo with-source

open in greenfoot
Your browser does not support the canvas tag.
SPowerSPower

2013/3/11

'this uses a technique called "raycasting" (or "raytracing")' These are totally different things, raytracing is simulating rays going out of the camera and hitting things, being bent by glass, etc. Raycasting is also simulating rays, but they just stop when they hit something and the rays are casted in a 2 dimensional world. I hope this made it a bit clearer. And also, great work!
SPowerSPower

2013/3/11

And raytracing is what you're doing here :)
davmacdavmac

2013/3/11

"Raycasting is also simulating rays, but they just stop when they hit something and the rays are casted in a 2 dimensional world." Not correct; raycasting is usually used in a 3D world. Both ray tracing and ray casting map a view of a 3d world to a 2D surface (the screen).
-nic--nic-

2013/3/11

this is very interesting :)
SPowerSPower

2013/3/11

@davmac Do you mean the same as I do? http://qt-project.org/doc/qt-4.8/images/raycasting-demo.png is what I think of raycasting, where this is the map: http://sinepost.files.wordpress.com/2012/06/raycasting-map.png?w=540 Three tutorials: http://www.permadi.com/tutorial/raycast/ http://lodev.org/cgtutor/raycasting.html http://sinepost.wordpress.com/2012/06/16/raycasting/
davmacdavmac

2013/3/12

Spower, the picture you have is a raycast projection of a 2D world, yes, but you can use raycasting for 3D worlds as well. The difference as I understand it is whether reflections and light sources are taken into account. See the wikipedia entry: http://en.wikipedia.org/wiki/Raycasting
MatheMagicianMatheMagician

2013/3/12

This also concurs with davmac: http://www.gamedev.net/topic/431216-difference-between-ray-casting-and-ray-tracing/
SPowerSPower

2013/3/12

Ok, I understand it now. Thanks for the lesson, davmac!
MatheMagicianMatheMagician

2013/3/12

As a suggestion for speed Duta, you could make the screen smaller like in BuilderBoy's scenarios.
DutaDuta

2013/3/12

I could do, MatheMagician, but this is intended to be an example of the images that can be rendered with even simple "ray" + (new Random().nextBoolean() ? "tracing" : "casting"). And, as I attempted to explain in the description, this is never intended to be real-time. My internet had gone down and so I was bored. Hence I decided to spend a couple hours making this. I'll probably improve it at some point though..

See all comments

Want to leave a comment? You must first log in.

Who likes this?

GameCritic MatheMagician tylers SPower darkmist255 Builderboy2005 Game/maniac -nic-