Planetside Software Forums

General => Terragen Discussion => Topic started by: paq on December 21, 2017, 12:12:07 PM

Title: Fit vector displacement.
Post by: paq on December 21, 2017, 12:12:07 PM
Hello,

I have a vector displacement texture (.exr), normalized, and I need to refit the value between 2 specific Min/Max value. Is it possible to do that with the blue nodes ? I don't see any refit operator, and I'm too dumb to recreate the maths myself :S
Title: Re: Fit vector displacement.
Post by: Hetzen on December 21, 2017, 01:31:00 PM
Can you use a colour adjust and set the black and white points to your range? You may want to un-check clamp black and white.
Title: Re: Fit vector displacement.
Post by: paq on December 21, 2017, 02:28:51 PM
Hello,
Well I finally use this :

OLD PERCENT = (x - OLD MIN) / (OLD MAX - OLD MIN)
NEW X = ((NEW MAX - NEW MIN) * OLD PERCENT) + NEW MIN

Seems to work fine with vectors.

I have tried the color adjust, but it very difficult to enter color value like : 0.811485, 1.25989, 0.903355 with the actual interface.
Title: Re: Fit vector displacement.
Post by: Hetzen on December 21, 2017, 04:43:48 PM
Glad you found your solution. Can you explain why you wanted to do that?
Title: Re: Fit vector displacement.
Post by: paq on December 24, 2017, 01:23:30 PM
Hi Hetzen,

It's for the vector displace project here : http://www.planetside.co.uk/forums/index.php/topic,23959.0.html (http://www.planetside.co.uk/forums/index.php/topic,23959.0.html)

I can't find a way to write negative value in .exr when exporting my vector displace data from Houdini (something that bugs me a lot grrr), so I refit the range between 0-1 before the export, and I had to refit the value back in Terragen between the original min/max value.

Title: Re: Fit vector displacement.
Post by: Hetzen on December 25, 2017, 07:35:14 PM
Hey Paq

Thanks for explaining. Yes I've been following your thread. I'm keen to try your method out.

Something I do, which may not be relevant here, is when I want to raise a normalised -1 to 1 range into the positive I tend to add 1 then multiply by 0.5. So the new range is 0 to 1, the old zero point is now 0.5. This can be useful to put a curve on the graph shape with bias or gain scalers amongst other uses. Then to bring back into -1 to 1 range, simply multiply by 2 then subtract 1.
Title: Re: Fit vector displacement.
Post by: paq on December 25, 2017, 11:07:04 PM
Hi Hetzen,

Well, for my first prototype, I didn't pay attention to the size of the model, so mix/max value could be way over -1 1.
I'm such a noob for this kind of stuff  8) ... but now I do my normalization in Houdini before exporting, so whatever the geometry I create, x/z always fit between 0 and 1 ... so I shouldn't get to much trouble to get the right result in Terragen.