spynaz
|
  |
| Joined: 17 Feb 2011 |
| Total Posts: 1326 |
|
|
| 03 Jul 2013 07:45 PM |
| Does anyone know what the trilinear interpolation function in lua looks like? |
|
|
| Report Abuse |
|
|
|
| 03 Jul 2013 08:27 PM |
From Wikipedia: "In practice, a trilinear interpolation is identical to three successive linear interpolations, or a bilinear interpolations combined with a linear interpolation"
The Wikipedia article should describe the concept well enough. |
|
|
| Report Abuse |
|
|
|
| 03 Jul 2013 08:30 PM |
| I had a quick look at wikipedia, but I dont really understand WHAT its supposed to do. Find the center of a square from the 8 corners? |
|
|
| Report Abuse |
|
|
|
| 03 Jul 2013 08:30 PM |
| ...square with 8 corners? I mean cube. |
|
|
| Report Abuse |
|
|
|
| 03 Jul 2013 08:31 PM |
| Given a regular lattice of points in 3D space, find the value of a point between the lattice, assuming that the change in value in any axis is linear. |
|
|
| Report Abuse |
|
|
|
| 03 Jul 2013 08:34 PM |
| So what are the practical applications? |
|
|
| Report Abuse |
|
|
|
| 03 Jul 2013 08:36 PM |
Well, bilinear (square case instead of cube) is a simple way of scaling images that doesn't produce the square artifacts of nearest neighbor. Scaling a 3D image of some sort, possibly voxel data or density data, you could use trilinear interpolation. |
|
|
| Report Abuse |
|
|
|
| 03 Jul 2013 08:41 PM |
But we are talking about Lua, so we cant exactly scale images...
Well thank you. I appear to have learned where the word "lerp" comes from. But I dont like my interpolations linear, I like them logarithmic.
So is this basically what the Camera:Interpolate method does? |
|
|
| Report Abuse |
|
|
spynaz
|
  |
| Joined: 17 Feb 2011 |
| Total Posts: 1326 |
|
|
| 03 Jul 2013 10:22 PM |
Well I need this to generate a terrain using a 2d perlin noise heightmap for the base and 3d perlin noise for overhangs and hills. But the overhangs that are generated have flat tops and way too many overhangs and floating chunks are created. If I increase the required density for a block to be considered "solid", there would be less overhangs, but also less steep hills. I think the problem for the flat tops on the overhangs is because I'm using just linear interpolation for both the heightmap and 3d perlin noise and not trilinear.
Also you said that a trilinear interpolation is just 3 linear ones. If so, how would that work with the following linear function I'm currently using?
function lerp(t,a,b) return a + t * (b - a) end |
|
|
| Report Abuse |
|
|
spynaz
|
  |
| Joined: 17 Feb 2011 |
| Total Posts: 1326 |
|
| |
|
spynaz
|
  |
| Joined: 17 Feb 2011 |
| Total Posts: 1326 |
|
| |
|