|
![](/i/fill.gif) |
<Mienai> wrote in message
news:web.44170d7a925a6bc093db03e80@news.povray.org...
> "Chris B" <c_b### [at] btconnect com nospam> wrote:
>> Hi Mienai,
>>
>> I think there are a few problems with this approach.
>>
>> One biggy is that the images won't contain some of the information you
>> would
>> need in order to create a height field - In particular the height.
>> ... snip ...
>>
>> Regards,
>> Chris B.
>
> The way I was thinking of it was that the normal is providing the delta in
> height (slope) that's why I was thinking that I could just run the image
> through a derivative to get an approximate height based of some +c value
> (or maybe I need to integrate I forget, should be basic calculus though,
> right?).
> ... snip ...
>
> I'm still looking of a good way to convert this.
>
OK. Well given all the caveats and the implicit innacuracies and the get-out
clause that says I wouldn't do it this way, here's how you might be able to
do it.
The information you've given isn't all that comprehensive, but I'm assuming
that the object is something akin to a height field to start with and that
the objects surface is smooth and of a colour that is uniformly reflective
to green and red light. Also I assume parallel light rays falling on the
surface (i.e. a distant light source where the falloff of light with
distance becomes insignificant in the calculation ). I'm assuming the camera
is above the object looking down from a great distance so that you get an
image where the pixels will map correctly onto the height field you want to
create.
If you process the image pixel-by-pixel you can work out an approximate
x-elevation and a z-elevation across a pixel based upon a normal that is
calculated from the Red and Green colour components of the pixel.
If my thinking on this is correct (based on a quick sketch and a little
paper-based trigonometry) I think the following would give you the normal
<X,Y,Z> of the surface :
X=Red/255,
Z=Green/255,
Y = square root of (1 - X squared - Z squared)
The rise from one side of the pixel to the other in the x-direction would be
Y/X pixel-widths and the rise in the z-direction would be Y/Z pixel-widths.
Note. This is untested and someone with more maths skills than me may be
able to advise if it's not correct.
Regards,
Chris B.
Post a reply to this message
|
![](/i/fill.gif) |