Unreal-like depth fade parameter for opacity (v-ray gpu)

Hi, how we can recreate this effect (fake depth on a flat surface) with v-ray? It is an easy and fast way to create an atmosphere. You can watch it in the rebirth video by quixel here https://youtu.be/0iQJkSpOoOQ?t=1294
I played with fog parameter, but cant achieve such effect with a smooth transition on the plane with cloud texture. 2020-01-02_1611 - TechSmith Screencast
any suggestions?

I guess you can use the vraydistancetex as a mask and the ground plane as the object for the distance.

Yep, but it is not the same. With distance texture i get fading from bottom to top. But if you take a look on video, the effect i want to create is the fade “inside” the plane. If we take z-depth channel from render and input it with proper mapping on opacity slot, i think that we achieve something similar to depth fade. Fog parameter is working close to it, but i don’t know how to combine it with 2d texture in opacity
.

EDIT #2: I’m not sure i get what you mean: the video *is* fading the texture from the bottom of the sprite, as a distance from the terrain.
There is however a circular gradient mapped on Opacity, which likely multiplies the effect of the distance fade.

Not sure the Z depth channel info would be the way to go here actually. I’m not the tech savvy person Lele is for instance but the zdepth is calculated from the camera distance so if the camera changes, the effect changes as well. If you want to blend with the “inside” of the plane then you can use a softbox map blended with a distance tex map in a comptex map to achieve the effect I think, unless I really didn’t understand the video or what it is trying to achieve.

Indeed, Ashley’s approach would work too, i think.

yes, z-depth changes. But maybe there is some tip to use calculated depth from the camera on opacity? About distance texture, softboxes and so on: just take a look at the video I provided in the first post, here is not a simple gradient transition, but the transition in depth. I make a simple scene in unreal to demonstrate it and several screenshots with plane and depth fade parameter. Also, I take a screenshot from the alpha channel just take a look on gif-animation where I moving the plane back and forth. Similar effect demonstrated on video here https://youtu.be/0iQJkSpOoOQ?t=1384
And this achieved by using only a flat plane without any volume. I think now it is more clearly :slight_smile:

image_54527.gif

​


Eh well, then perhaps my setup was not so OT.
Check this out, and feel free to let me know where it doesn’t work.
The max file is for 2020, the attached image is the alpha of distant planes (the further they are, the more transparent they are.).
If you unlink the distance object from the camera, you can then drive the distance separately from the view.
depth_fade.zip (31.7 KB)

hi, thanks but it is not the same ^) By this setup you change the opacity on the whole object. The rasterization of gif animation clearly shows how the plane is fading in depth (from the camera, not from bottom to top).
Ok, let talk with another example, the effect I searching it is similar if we rendered the image, take it in photoshop and place some cloud image with alpha by the depth channel of that render. So we achieve a fake volume cloud. I take some renderers with your setup and illustrate it in photoshop. By default, you have a transparent object in case of distance, but the whole object, if we can somehow multiply that transparency on the depth we got that effect like in unreal engine.


So, i re-watched the video, and listened very closely to the author.
A) He adds something *identical* to the distance texture, but uses it with respect to the terrain, not the camera. (to quote the speaker “It allows the fading of the card from the intersection (with the ground, n.d.r.)”).
The modified setup using the ground as distance object is attached. For your convenience, i put the distance texture inside of an output node, with which i drive the distance gradient more precisely.
For easier viewing, i assigned the texture to the color of a self-illuminated material, so just starting IPR would show you the behaviour.

B) I’m not quite sure of what i am looking at in the GIF animation you last posted. That is what the first setup i sent you did, just as @Vizioen suggested.
If you wanted both behaviours combined, all you’d need would be to multiply the two distance textures (the one providing Z-Depth, and the one providing intersection distance from the ground).
distance_from_ground_fade.zip (55.8 KB)

yep, actually that parameter in UE expression is used to hide unsightly seams that take place when translucent objects intersect with opaque ones. But working it in world space and results have a volume look like. I combined Lit and alpha channel in 1 screenshot and draw green arrow by the way fade is applied.In distance texture, we got a transition on red and blue arrows in that example (in local space). So we got something like a portal, with depth inside the plane. Bad to me that I can’t describe it more clearly, so we can close that thread.

Nono, it’s me not getting it, not to worry.
I don’t think it’s doable right now, there is no way that i can think of to reproject the stuff behind the plane unto the plane itself, so any attempt of using, f.e., the vraysamplerinfotex with pPos would fail, as the plane covers the stuff behind it.

this is really interesting to have directly in 3d !
I use similar approach but in post ..if Vray allow as to use the zdpth pass inside the material tree that effect would be possible
it is like taking the z depth of the scene behind the plane and use it as mask on the plane itself .
Andrew used -kinda- similar approach here

Could be way of track here but what about using a camera map per pixel map? (never used it so can’t get it to work without some R&D).

Tried, with samplerinfotex in Point mode, didn’t work. ^^

Exactly! :slight_smile: as i wrote in the first message, fog (in material) transition work in global space (as i can see) but it doesn’t work if we apply texture. So zdepth in material slot - it is the solution, but how?:slight_smile: maybe OSL shader?

why not use just regular proper volumes? is it rendering that slow? mix of fog and aerial perspective I guess if we are talking mountains. how fast does it need to be?

If we talking about uniform dense fog without any wisps or «structures», so yep better combine volume fog and aerial perspective. But I often add in photoshop some wispy clouds, they are not physically correct but increase the artistic look on the renders. And if I can do it directly in 3d, it will be great.
Attached several examples. In the last work I tried to make dense, but slightly non-uniform fog with volume grid and noise textures, it is nice, but rendering too slow. https://www.artstation.com/artwork/VdXPDb


I was thinking VrayEnvironmentFog (no exp with grid). VolumeScatterMtl not yet ready on gpu but if remember correctly it should be faster for simple fog.

It is not trivial at all for a raytracer.
Rasterizers have Z before the final render render starts (so they can use it for a number of things), raytracers can get to it only as they trace.
It would need something like a separate render (either from behind the plane, or without it) to be able to repro the stuff on the plane correctly.
My memory of late is playing tricks on me, so take this with a pinch of salt, but i recall some render engine that was able to render a second scene viewpoint to then remap it unto f.e. a tv screen in the scene, which was visible from the main render’s viewpoint.
I can’t recall if this was a realtime shader (highly likely. Which makes the info useless, as we’re back to square 1) or a raytracer.
Any help figuring out what that was would be appreciated. :slight_smile:

If they’re just planar cards, though, you’re likely much better off doing it in Nuke (or PS, albeit a bit more laboriously) exporting your depth and fiddling with it.
You’ll have to fake shadows and such, but at least in nuke that can be done (with the help of pPos and such AoVs).