PDA

View Full Version : height map to (x,y,z) conversion


sky_blue
01-03-2007, 07:35 AM
hi,

how do i convert the indices of a height map array(i,j) to the (x,y) points on the object. for example, suppose i have an nxn height map array and a sphere having radius 'R'. i'm not being able to understand the following mapping

for (i=0 to n){

for (j=0 to n){

x = j-n/2
y = i-n/2

x = x * R/(n/2)
y = y * R/(n/2)
............

}

}

dave_
01-03-2007, 07:42 AM
You've got the answer on gamedev.net (http://www.gamedev.net/community/forums/viewreply.asp?ID=2863434) already.