mask vrayscattervolume with opacity map

ok i know this is a rewording of my previous post, but maybe ill get a bite with a more generic subject.

the scattervolume does not have an opacity map slot.

placing it in a blend material as a coat and using a mask map kills it completely

i kinda understand that an opacity map on a volumetric material is probably horribly physically incorrect.. however, the fastsss2 material has an opacity slot… so…

i just want to fade out my planet atmosphere at the edges…

We’ll see if we can think of something. For now, I guess you can try using a Falloff map for the Scatter radius for a fade effect.

EDIT: I’ve logged an improvement request (internal bug-tracker id: VMAX-10584) for opacity control in the VRayScatterVolume.

ive tried that, but unfortunately i already have the scatter radius at its maximum value to give the effect i want on a 2km wide sphere.. it would be even worse on a real-scale planet. its still quite visible at that scatter radius setting when the sun hits it.

if there is a way to go above that maximum spinner value i might be able to get something to work, but it seems a large radius is not the same thing as “invisible”

being able to fade out a sphere of vrayscattervolume at the edges would be a very nice way to to do planet atmospheres… as it is, ive seen several tutorials using a similar setup in other renderers, but it seems its not actually possible in vray to do a decent a planet atmosphere.

Try using this MaxScript to go above the maximum value and see if it makes any difference:
.scatter_radius

This is very quick and dirty and I have no idea how close/far to the planet you’re going but this is with a ramp, from whatever colour to black, in the overall colour slot, which seems to fade it out…

thanks for the test, however having it fading to black at the edges is no good.. i need satellites rotating around the earth.. they would be cut off by a hard edge you cant see. there is also a starscape/moon behind which would have the same problem.

Yeah I thought that may be an issue. I was looking at the alpha while testing it and I did at one point have a faded alpha, though it wasn’t right in the rgb iirc, so back to square one.

I was planning on looking at this again today but sadly my annoying client has now decided that they want all their 26+ final images asap, after of course weeks of silence :stuck_out_tongue:
Very interested to see your result if you get one any time soon.

I wonder if you could do this with Phoenix. Emit a tiny bit from a sphere with some smoke fading and no gravity or turbulence.

Or a volume grid with a texture.

Yeah that is a similar idea to one I saw whilst researching this yesterday…done with Maya fluids…similar to this I think Creating a Planetary Atmosphere in Maya Using Volume Primitives & Volumetric Fluid Shaders - Lesterbanks
Shame we don’t have the ability to do it in vray though…yet :slight_smile:

Here is a rough test with a VRayVolumeGrid (using no input file the Volume Grid makes a grid filled with Smoke). We then use a Falloff texture to control the density. I put a curve on the Falloff to get a more geometric falloff. This can be adjusted easily enough.

I put some cube “satellites” in there to show how it works with objects in the atmosphere. Note they cast volumetric shadows (you can see this next to the middle cube). This could be turned off if you don’t like it. There is a tiny bit of fill light from a dome light (not realistic, I know). The dome light excludes the VolumeGrid for speed. You could use a VRayAmbient light for fill on the VOlumeGrid if desired (MUCH faster, and you wouldn’t notice much difference here except for volumetric shadows.)

You can adjust the density of the grid (CellSize) in the Volume Grid to control the quality/speed. It looks like it will render slow, but then gets pretty fast at the end.

Note that this is its own atmospheric/volumetric shadier, and may not play nicely when combined with other volumetric shaders.

Note also, I think the bucket renderer goes faster with volume grids. I just left this scene on Progressive.

A Phoenix solution did render faster, but I was having trouble getting it totally smooth, even with input Smoothing. This VolumeGrid method is slower because it is rendering a volumetric texture, but it is more versatile. You could mix some fractal noise into the falloff to get some detail, etc.

SphereTest03.zip
SphereTest03.zip (101 KB)

Here’s another version with the sun increased a couple stops…

Scene:
SphereTest04.zip (142 KB)

Hehe, nice one and a good solution it seems :slight_smile:

I think the Phoenix solution requires further study, because it *is* faster to render, and could potentially have fluid dynamic noise in it (like turbulence). However, I think atmospheres are generally very smooth, and don’t have much variance that you could see. I tell you this from my extensive experience as an astronaut.. oh wait, that’s just my dream.8)

I just had some issue getting it to be smooth with 16million cells. You could go higher than that of course, and it would probably be smooth at 32 or 64 million. I like the Volume Grid method because you can change the resolution at any time. It seems like it is going to be very slow to render when you start the render, but then it ends up being relatively fast in that it doesn’t take much more refinement.

I think either method will give you a way to map a variety of colors to the atmosphere (by “altitude”). So if you wanted that variance I think it is possible (get creative with the maps, or animated RGB output from Phoenix.)

Of course the way we used to do it 20-30 years ago was to just use a second sphere, possibly with a second (wider) light source to create the “scatter” effect, and then comp that in add mode in post, which obviates the need for any sort of specific transparency, but requires a basic knowledge of rendering in passes and compositing (which I would encourage any 3d artist to learn anyway).

Or, from the cat-skinning methodology manual, there is always this method https://www.youtube.com/watch?v=iT12Q9O-Q30&ab\_channel=VideoCopilot
As a valid comment I read went, it’s shot dependent, so whatever works with one shot may not translate to another…so always nice to have options :slight_smile:

hey nice set of replies going on! thanks for your input, its a very interesting project. -in fact its not due to start till after christmas, but im enjoying playing.

im interested in the volumegrid option, however i discounted it since as far as i knew you dont have the “scatter colour” settings you get with sss… this is, unfortunately, the whole point of the exercise. i can get a relatively convincing bluish atmosphere with a few extra spheres and some falloff (minus the nice atmos. shadows) .. what i can’t get, is the colour shift at the sunrise/set terminator. with vrayscattervolume, i can just about get something nice looking (colour shifts not totally accurate when backlit by sun at edge of earth, but better than without)

does volumegrid allow sss/scatter colour effects? (im away from pc atm)

im now working on a hack to tint the clouds at the terminator too… i tried with fastsss2, which kinda worked, but rendered slow. now im going “full hack” with a plane intersecting earth, lookat constraint to sun, non renderable… this drives a distance tex to mask area at terminator, and drives a gradient ramp to change diffuse of clouds in that area from white to yellow then red. finally thats masked with a falloff set to light/dark mode, to change colour of clouds only on sunlit side.

think it will work, but my goodness the material editor is going slow… even with manual update enabled on the sample swatches, wireframe in viewport, im getting 10-30second delays on each tweak.

Still away from machine but brain keeps spitting out ideas. If i can increase scattervolume radius setting much higher than ui limit with that script, then i could use vraydistance tex, with earth as driver geometry, to get a realistic exponential density reduction as altitude increases.. Might even start to look quite realistic!

That is assuming that a) distance tex gives a volumetric output and b) scattervolume radius can be varied throughout volume and not only on geometry surface.. If i remeber correctly the answer is yes to both.

​​

All that remains is to get muuch higher max radius value than scattervolume ui allows - high enough to be effectively invisible even when backlit by sun

Another thought, if the texture to drive radius is a multiplier of the radius setting, with white being 1 and black being 0, maybe i could crank output of map beyond white to get bigger radius values..?

The script snippet might work, but given my total lack of scripting, im not even sure how to actually use it 8)

Ugh! Its saturday but i wish i was at my desk
​​​​​​. What a nerd.

Interesting. The VolumeGrid does not give you specific scatter color. I was able to map colors based on a VRayDistanceText to change the color by altitude (distance from the planet). This looks pretty cool. I wanted to mess with Camera axis falloff maps, but I could not get them to work with the Volume Grid. Even the OSL one didn’t seem to work.

I have not researched it, but I assume the color changes at the terminator are based on particulates in the atmosphere varying in size based on altitude, with larger particles closer to the planet causing more of a red shift due to their size (pollution). So I guess the blue atmosphere would go out over the red at the terminator (like in this example). (Since the sun would hit more of the high-altitude finer particles causing Rayleigh scattering (blue sky) where the planet shaded the lower altitude stuff at the edge). But I could be totally wrong.

This is a lower quality render because I didn’t want to wait for it, but the noise would go away of course:


Scene: SphereTest05.zip
SphereTest05.zip (166 KB)

You can likely forget about the MIE part of scattering (that’s the one which deals with dust-sized particles.) and concentrate on the Rayleigh part (which deals with molecule-sized obstacles instead.) at this distance.
You’ll see MIE being predominant if, f.e., you’re looking at a polluted city, or at a dust storm, or at a foggy environment (then water isn’t molecule-sizes, but droplet-sized.).
It’s generally quite localised an effect, on Earth.
MIE also generally results in a desaturated, grayish color.
Anything else is Rayleigh.

thanks for continued brainstorming guys..!

so i did a quick test boosting the scattervolume radius using an output map to take values waaay above 1 in the scatter radius map slot (driven by distance tex providing exponential density reduction as distance from earth increases… i actually start to get some quite nice effects with sun peeping out from behind earth ( redder at lower altitudes, fading to blue at higher altitudes, as would be expected.. however i just cant get a soft faded edge on the damn thing. even if it appears somewhat soft when front lit, the moment the sun hits it from behind, its solid all the way to the sphere edge.

i am also painfully aware that using scattervolume means i have no possibility to enter the atmosphere.. since it does not support cameras inside volume.

which i guess means i should be looking at volumegrid. however that does not appear to support true light scattering in the same way scattervolume does. ? or am i wrong?

could you save a copy of your test scene out for max 2018? cant open it!