chateauferret / calenhad

Calenhad is GIS and terrain creation for imaginary worlds.
5 stars 4 forks source link

Range calculation for power module doesn't deal with imaginary results #53

Closed chateauferret closed 6 years ago

chateauferret commented 6 years ago

E.g. if input 1 is a constant 0.5 and input 0 is a noise module with range -1 to 1, then input 0 minimum to the power of input 1 minimum = -1 ^ 0.5 = sqrt (-1) = i. Range finder gives this as NAN. As it happens the render doesn't like this very much either. Consider what to do when the result of pow is not real.

chateauferret commented 6 years ago

Not sure if this is a bug. Maybe just needs a warning. After all the square root of a negative number is imaginary, the range finder is just following the module.

chateauferret commented 6 years ago

Moot now because the range is coming directly from the compute shader render of the module preview. However, it does't deal with what happens to the actual terrain when a power module with complex outputs (e.g. pow (v, 1/2) is run over an input that includes negative numbers, which is a fundamental aspect of the mathematics involved.