• 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

Upping the ante with the Poser atmosphere's Depth Cue (I'm still using Poser 11 with Firefly)

3dcheapskate

Engaged
Using the Poser atmosphere's Volume option really slows down my renders (usually by a factor of ten or so), whereas using the Depth Cue seems to have an almost negligible effect.

So I started wondering...

A quick reminder: The Depth Cue uses a simple linear interpolation between the Start Distance and End Distance to determine how much of the DepthCue_Colour to use. (I've never really understood why darker DepthCue_Colors don't work so well, nor why using black as the DepthCue_Color does what it does - which I can't recall exactly, but isn't what I expect)

bagginsbill created a shader way back that swaps the linear interpolation for a more realistic depth simulation somewhere in an 'underwater submarine' thread over at Renderosity (I don't have the link at hand, but I'll track it down and post later). But you need to put the x,y,z coordinates of the current camera into one of the shader nodes - you can either do this manually (rather a pain) or automate it with a callback function that he also provided.

But that's not what I want to talk about. I want to talk about this sort of thing...
VDCAv3.jpg

VDCAv3.png
 

3dcheapskate

Engaged
Notes:

1) The colours in the ColourRamp were chosen simply to help me see whether I'd got the maths correct.

2) The shader above is really intended for a camera positioned at the world origin looking directly along the positive or negative Z axis, but my camera was slightly offset

3) Using SQRT(X^2+Y^2)/Z as the Input to the ColorRamp is an attempt to ensure that the depth cue colours of foreground and background objects at the same point on the 2D render would have the same colour. That's the reason for note (2) above.

4) The main reason for posting this here is so that I don't forget !
:p

I plan to go through things in a bit more detail in the next few posts, but not today.
 

3dcheapskate

Engaged
Here's the link to helgard's Underwater Submarine thread over at Renderosity, mentioned in the OP. I first came across that thread when I was trying to create a more realistic atmosphere using the Poser depth cue and posted my own query towards the end of it here

In one of my subsequent posts on that thread I mentioned a (now-defunct) thread at RDNA, but luckily I started a similar one at CGBytes (N.B. before you click this link be warned that CGBytes sometimes has some 'mature content') - Distance From Camera To Point Being Rendered ? - The Node Knows! - CGBytes - CGbytes - CGbytes.com the online community for 3d digital art. It was there that bagginsbill helped me answer my own question.

But as I said earlier that's not what I want to talk about. And here's something else I didn't specifically want to talk about, but which is definitely worth mentioning as there are lots of useful links (and bagginsbill posted there too) - it's another one of my threads at Renderosity, How Do You Use The Poser Atmosphere ? (renderosity.com).
 

3dcheapskate

Engaged
The first bit I do want to talk about is how to create a basic height-dependent depth cue.
I'm not talking about the Easy Shader For Creating A Height Map Render Of Your Scene | HiveWire 3D Community I posted here back in 2016, although that is related.

To start with I'll assume that DepthCue_StartDist is set to zero, and DepthCue_EndDist is any value we want. For the purposes of this topic I've set my display units to feet, and I'm doing my calculations in feet.

Basics first: With DepthCue_Color set to white and DepthCue_EndDist = 250 that means that anything whose Z-depth is >=250 feet will appear totally white, anything whose Z-depth = 0 will be totally unaffected by the DepthCue_Color, and anything where 0 < Z-depth < 250 will use a linear interpolation to determine the percentage of DepthCue_Color. E.g. Z-depth = 125 is 50% white, Z-depth = 25 is 10% white, etc

The first thing I want to achieve is to make DepthCue_EndDist height dependent. After many hgalf-hearted attempts over several years, this one seems to work quite nicely, so here's an annotated screenshot of my basic height fog shader:
Basic Height Fog.png

and here's a render
250,50,-50.jpg


I've also attached a zipped MT5 created in Poser 11 for Firefly
 

Attachments

  • Basic Height Fog 250,0,50.zip
    1,007 bytes · Views: 239

3dcheapskate

Engaged
The nice thing about that simple Basic Height Fog shader is that it the zero visibility height can be lower than the max visibility height (as in the previous post) or higher than the max visibility height (see below)

250,-50,50.jpg
 

3dcheapskate

Engaged
More to come I hpoe, but I need to get all my experiments, along with shader networks, MT5s and sample renders, into some sort of logical order before presenting them here, otherwise I'll just confuse everybody - myself included !

But here are a couple of thoughts to be going on with about possible next steps from the basic height-dependent depth cue in post #5:

1) It should be fairly straightforward to replace the linear 0.0 to 1.0 between MaxVisHeight_Feet and ZeroVisHeight_Feet with bagginsbill's more realistic half-distance based method. I never ended up using the callback function, I always manually entered the camera coordinates into the relevant nodes. And I haven't tried to use bagginsbill's half-distance stuff in this yet, which is why I say "should be".

2) The reason I started playing with this depth cue thingy again was because it's something I needed for this particular picture. But in addition to the height dependent fog I also wanted the fog colour to change from left to right across the picture. That's where the ColorRamp in the OP shader came in, just as a test. But the actual shader in the OP was a few steps further along that track - the depth cue color changes radially , assuming that the camera is exactly on the Z axis and looking directly along the (+ve or -ve) Z axis. The ultimate goal (which I doubt I'll ever get to because I'll undoubtedly get bored and side-tracked) is to get that to work for any camera position and orientation.

3) After writing points 1 and 2 it struck me that what I'm actually trying to do is that looking directly at the sun on a foggy day in a forest sort of thing - If you don't know what I'm talking about google images of "photo misty forest sun" and ignore the ones with 'godrays*'. But now as well as colour changing radially, so does visibility..

*why, when I hear that word, do I always picture The Dude** in his sunglasses suddenly appearing from behind two clouds (think God appearing to the k-nig-hts in Monty Python and the Holy Grail)

**Jeff Bridges in The Big Lebowski, a film I've never seen.
 

Janet

Dances with Bees
Contributing Artist
Oh wow! I've played and played with atmosphere but can almost never get it to look right. Cool stuff!
 

KageRyu

Lost Mad Soul
Contributing Artist
great stuff. Wish I could get back to working and experimenting in Poser - so much about the materials room I wanted to figure out still.
 

3dcheapskate

Engaged
I think I've just got the realistic DepthCue (the one that bagginsbill came up with that Imentioned back in post #4) working again, along with the camera automation (which I'd never actually got round to using before). My big concern is that I'll lose it, so I'm uploading a zip with the two important files (plus a screenshot of the shader). You can play with it if you want, but it's not really user-friendly yet. The files are:
- DepthCueCamPosAutomation.mc6 - the Atmosphere shader.
- DepthCueCamPosAutomation.py - a script to set up a callback functionthat automaticallykeeps the camera position in the Atmosphere shader updated. It's just an expurgated version of bagginsbill's 'UnderWaterParameterAutomation.py' containing only the camera/atmosphere stuff.The script should be run just once, after the Atmosphere shader is loaded. It prints out a few lines when you run it and every time thereafter that you adjust/change the camera.

Screenshot of the shader below, plus a test render. Note that the disconnected nodes at the bottome are my standard height dependent stuff - I was having problems combining them with the realistic half-distance based depth cue stuff, but left them as that's the next step.
DepthCueCamPosAutomation.JPG Capture.JPG
 

Attachments

  • DepthCueCamPosAutomation.zip
    114.3 KB · Views: 63

3dcheapskate

Engaged
I'm still having problems connecting my height-dependent nodes to bagginsbill's realistic depth cue, so I've got to think this through. Or rather play around a bit.

To start with I just tried using my Height_In_Feet(PNode) instead of the PM:Half Distance node, so the halfdistance for this version of the shader starts at zero at ground level and increases with height. The render makes sense - dense fog at ground level getting thinner as we go up.
shader.JPG render.JPG

And I just realized/remembered that for my height dependent shader the Atmosphere node's DepthCue_EndDist isn't set to 1 - so I need to multiply the output of my shader network by the halfdistance, which I forgot to do. Here it is, with the halfdistance tweaked a bit, MaxVisHeight_Feet = 40 and ZeroVisHeight_Feet = 0 which renders similarly to the above which is what I would expect.
shader.JPG render.JPG
 

3dcheapskate

Engaged
And the other way round, thin fog at ground level, thicker as it goes up.

shader.JPG render2.JPG

That seems to work nicely !

I'll just do a bit of tidying up and a few more tests to make sure it's okay and then I'll upload it here as a zip.
 

3dcheapskate

Engaged
As part of the testing I wanted to make sure that the values I've said are in feet are actually in feet, so I ended up creating a simple test rig. It's a flat groundplane 2000' by 2000' with circles of radius 100', 200',...,1000' marked on it, an encompassing cylinder of 1000' radius and 1000' height, and ten 10'(ish) wide by 1000' tall columns placed just off the negative Z axis at 100' intervals.
Here's a render with the fog shader from the previous post, with no fog up to 120' height and maximum fog at and above 130'
Render 1.jpg


Looks as if the units are correct to me (provided of course that I created the mesh and textures for the rig correctly! :D )

I also thought it might be a good idea to change the names of the two nodes where you set the height at which the fog starts and ends
12.JPG


Still testing and tidying up, no ETA yet.
 

3dcheapskate

Engaged
Sometimes I think it'd be better not to bother with testing - I've just noticed that specular highlights appear to be unaffected by depth cue !

Just using the basic Poser DepthCue here, nothing else.
There are ten columns on the right set at 10', 20' etc up to 100'
There are another ten columns on the left at 100', 200' etc up to 1000'
Columns beyond about 60-70' vanish in the depthcue.
But the specular highlights don't.

enddist500ft.jpg
 

KageRyu

Lost Mad Soul
Contributing Artist
Perhaps there is a combination of nodes that could be placed on the Specular channel that emulates fade with distance? N or P nodes with some other nodes?
 

3dcheapskate

Engaged
That sounds as if it would require a mod to every specular surface n the scene, which is definitely not what I want. I vaguely recall running into this a long time ago when I was trying to get Poser to do Z depth renders using the DepthCue (before Poser had its Z renders option, or at least before I knew about that). I simply added specular to the things my Z-Depth-Prep script turned off in all the materials in the scene. But I don't think that's really an option here.

Could possibly do something like you suggest in the lights themselves (which may actually be what you're suggesting) but I foresee problems...

Maybe the best idea is to pretend I didn't notice it !

I think I like that last one :cool:
 

3dcheapskate

Engaged
Just a few notes (reminders for myself really) on using the height dependent depth cue fog with my fog test rig:
- The shaders don't work with superfly
- Depth-mapped shadows cause strange artefacts on the backdrop and 1000' radius ground. Don't use depth-mapped shadows
- In fact don't use any shadows with the test rig because the test columns cast big shadows.
- To start with use the Dolly Cam (NOT an orbiting cam) and set it to be vertically above the world origin (DollyX-0, DollyZ=0, DollyY=whatever height you want to view from). The X,Y, Z position of orbiting cameras is NOT the X,Y,Z of the actual viewpoint (see this Renderosity topic, which includes bagginsbill - Getting the same view from dolly/orbiting cameras | Renderosity )
- Don't forget to run the script to keep the camera position up to date in the shader ! (thanks again to bagginsbill for that). If you don't run the script then the fog calculations are being done from the wrong camera position. The depth cue height dependent fog may still look right to you, but it isn't.
- You should be able to match the height of your viewing camera with to the height markers on the test rig columns - for the renders below I have the dolly camera set to 6 feet high.

A few final test renders (testing the test rig, not the fog shader!)

First the basic test rig, dolly cam at 0, 6', 0. Left to right: 1) OBJ imported, MTs loaded, backdrop radius=1000', column offsets set so I can see a good proportion of the columns; 2) Texture maps applied with quality=none so the numbers are clear; 3) Ray traced shadows - 1+2 had depth-mapped shadows
Render 1.jpg Render 2.jpg Render 3.jpg


Basic DepthCue (Poser 11 default settings except the green colour):
Render 5.jpg Render 5 atmo.JPG

Basic Volume (Poser 11 default settings except the magenta colour):
Render 6.jpg Render 6 atmo.JPG

And the real;istic height dependent depth cue fog:
Render 8.jpg Render 8 atmo.jpg

And the parameters for the test rig:
rig parms.JPG

Zip coming shortly...
 
Last edited:
Top