get functions

Started by Thejazzshadow, January 08, 2010, 12:10:37 AM

Previous topic - Next topic

Thejazzshadow

I am really confused how get functions work. FOr example, get position. I know I need to plug this in to other functions like voronoi I don't understand why? What is the difference between all of these get functions?  I know this is a broad question but I think I need to understand this in order to get a deeper understanding of functions.

mogn

The get functions delivers a number (scalar) or a vector at a time to the underlaying functions.
What ever you do with this number or vector, you end up by giving this number or vector to a "system function"
e.g. a displacement function, and tg2 applies this displacment to the original placement you got from the get functions.
As an example:

                                                   Instance of the result of the operations 
P = Get_position_in_geometry                     P = [200, 0, 200]
P1 = Subtract vector [100, 0, 100]             P1 = [100, 0, 100]
D = Get length                                        D = 141.42  ( sqrt(100**2 + 100**2) )
Apply this to a displacement node               Creates a displacement of 141.42 m at the point x = 200 m and z = 200 m

mhaze

Any more mathmatical info about node operation you could pass on to us maths challenged terragen addicts would be gratefully received :)

Dune

Thanks for this explanation. I've been struggling with functions as well, but realize a lot can be done with them. Right now I'm looking for a function to flatten out a terrain under a certain height, preferably with a small (soft) overlap, so not resulting in an abrupt edge, but a slightly curved edge into flatness. I was thinking of using the color adjust with an adjusted black point, but perhaps a get function + something could do that trick by displacing with the opposite of the height or something like that.
Would you by chance have a quick solution for that, mogn? I'd be much obliged. It has to do with my wave explorations, and hopefully find a way to have waves roll onto a beach way up, without breaking up in patches. Nearly got it.

---Dune

Henry Blewer

I have been using functions for a little while. As long as you do not expect to get a specific result, I have found them quite useful. I give them a 'hard' scale, meaning that I type in a number for the size I need.

I strange thing can be done with functions which may be useful for animating waves. Use Get Camera Position for the input of a voronoi or perlin functions. When the camera is moved, the noise undulates.
http://flickr.com/photos/njeneb/
Forget Tuesday; It's just Monday spelled with a T

Hetzen

The thing to remember is that the Get functions return values at the point of render. So in Dune's case of flattening below a certain height won't work, as he is trying to influence the final displacment with a function that only looks at the final displacement.

Hetzen

Quote from: Dune on January 08, 2010, 02:59:53 AM
Would you by chance have a quick solution for that, mogn? I'd be much obliged. It has to do with my wave explorations, and hopefully find a way to have waves roll onto a beach way up, without breaking up in patches. Nearly got it.

I think a good way of maybe achieving this would be offsetting the the water level up the shore using the get altitude, but also decreasing the amplitude of the wave too. This will essentially mean that your breakers are further back from the shore, and the front end of the water is the wave wash/back wash. I've not had much time to work on this I'm afraid. I've got a large job that goes live on the 15th, I've also got some R&D to do on stormy water which I need to proof of concept, which I've had a crack at but needs some more work.

Dune

Thanks for pointing that out, Hetzen, I should have known  :-\  I've been using the get alti, and a complexity of mergers, displacements, etc. based from the original terrain (sometimes through a color adjust). Even merging more than 1 or a negative number gives interesting results. I've had water washing over the beach, but the offshore water then follows the terrain as well, thus dipping. Hence my quest for a way to use only the shore displacements of the terrain for water displacement, AND at the same time using the alti+sinus method to get surf.
It would be great to have foamy water creep up some rocks at the water's edge, and up into ledges.