#### Archived

This topic is now archived and is closed to further replies.

# Voxel terrain rendering

This topic is 5486 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I read both flipcode.com articles about this and I feel still way too unclear about that topic. I only understood that I''ve to somehow cast an ray in 2D from my eye position into the terrain and check for the highest pixel of my heightmap hit by my ray. I''d need an very simple explanation/tutorial about this, maybe you could help me out a little bit?

##### Share on other sites
http://www.ur.co.nz/urcorp/default.asp

Go to the Tutorials section, take a look at his Voxel engine source, available in VB and C.

##### Share on other sites
Can I proposed a simple algorithm ?

The perspective projection formula are:

Xs = (focale*X)/Z;
Ys = (focale*Y)/Z;
where:
(Xs;Ys) is a screen point
(X;Y;Z) is the ascociated space point
focale is a constant (180 for exemple)

Do a loop on the Z between a little value to a big one (not necessarily linear progression)
Do a loop on the Xs. With that (Z and XS) you can find X.

Now you have the height map coordinate: heightmap(X;Z).
This map give you the Y and you can find Ys. Trace a vertical line between Ys and MaxYs: that give a good effect. You can now easily do a depth buffer that allow you to clip the hiden zones.
This buffer have only MaxXs length. I let you to find how you can do that

!o)

[edited by - Chuck3d on November 14, 2003 3:35:38 PM]

1. 1
Rutin
70
2. 2
3. 3
4. 4
5. 5

• 21
• 10
• 33
• 20
• 9
• ### Forum Statistics

• Total Topics
633421
• Total Posts
3011799
• ### Who's Online (See full list)

There are no registered users currently online

×