• Welcome to the Community Forums at HiveWire 3D! Please note that the user name you choose for our forum will be displayed to the public. Our store was closed as January 4, 2021. You can find HiveWire 3D and Lisa's Botanicals products, as well as many of our Contributing Artists, at Renderosity. This thread lists where many are now selling their products. Renderosity is generously putting products which were purchased at HiveWire 3D and are now sold at their store into customer accounts by gifting them. This is not an overnight process so please be patient, if you have already emailed them about this. If you have NOT emailed them, please see the 2nd post in this thread for instructions on what you need to do

More Realistic Distance Falloff For Poser Atmosphere Depth Cue

3dcheapskate

Engaged
Indeed, and it's (unsurprisingly) one of bagginsbill's - one that he left tantalisingly unfinished! It was part of an underwater environment that he did with Helgard over on Renderosity but never finished. I chased it up a few months ago and he helped me put this little bit of it together.

It's not like most other shaders - you have to manually enter the X, Y, Z coordinates of the camera you're rendering from into a node in the shader. Bagginsbill did a Python script using a callback fuction that automatically keeps this node updated, but I haven't got round to doing that part of it - manually entering the value is okay for me so far.

Here's a screenshot (explanation to follow in later posts):

falloff.jpg

The 'Camera_X_Y_Z' node is simply a 'User_Defined' (New Node > Math > user_defined) which is normally used to specify a user defined colour be specifying RGB values in the range 0.0 to 1.0. Bagginsbill pointed out that the internals of the Poser material treat vectors and colours as the same thing !?! Get your head around that concept

Camera X,Y,Z coordinates are in inches, regardless of your display units (mine are inches)
The Half_Distance defines how 'dense' the atmosphere is - the smaller the value, the thicker the fog. 500" is a good start (the 5,000" I have here was for a subtle atmospheric effect).

For more background, here's my post on the Renderosity "Underwater Submarine" thread where I found the tantalisingly unfinished idea...
I also started a "Distance From Camera To Point Being Rendered?" thread at RDNA, but bagginsbill had already abandoned ship there, although I managed to work out part of the solution on that thread.
Luckily bagginsbill saw the Renderosity post and said he'd moved to CGbytes, so I started a "Distance From Camera To Point Being Rendered" thread there, and he guided me to the solution above (any errors in that are mine!).

To avoid the need to keep thread-hopping I'll try and pull the most important bits from all those threads together here
 

3dcheapskate

Engaged
For bagginsbill's explanation of how Poser's Atmospheric Depth Cue works, and why it's wrong, start at this post on page 3 of the Underwater Submarine thread at Renderosity and continue reading bagginsbill's posts, past two of kawecki's posts, until bagginsbill's

b = x / (1 - .5 ^ (x / h))

Wow - Yay!

That's what the node staircase descending down and right from the Atmosphere node to the 'Half_Distance_In_Inches' node (which is just a renamed Math_Function node) is doing. 'h' is the half-distance-in-inches', 'b' is the DepthCue_EndDist that it plugs into, and 'x' is the two pinky-purple lines coming from the node group in the upper right.

That node group in the upper right is calculating the distance from the camera ('Camera_X_Y_Z' node) to the point being rendered ('P' node), which was the missing bit that bagginsbill guided me to.
 
Top