Closed Andrej730 closed 1 year ago
I think I've debugged it a bit more and I can conclude that for some reason absolute world position when it's calculated for volumetric advanced output is replaced with just camera position. Any ideas why it could work like that, possible volumetric cloud bug?
Here's how I tested it. I came up with simple shader that would allow me to visually figure each coord one by one.
And turned out the coords I've found are camera position coords.
Hello, like you said, this looks more like a volumetric cloud issue.
_MF_Vdb_VolumeSample works for density so I see no reason why it wouldn't work for other material outputs.
Can you please take a look at shader code that calculates world position for pins in volumetric advanced output? Is there anything odd?
I don't see anything obvious. I recommend asking the same questions to Epic, they are usually quick to answer and if there is an issue they'll find it and fix it.
I've learned a bit more about the issue - some pins like PhaseG
evaluated per sample (not sure what it really means) and they work correctly. But MultiScatteringOcclusion
works per pixel and it results in errors.
Argument in favor of that is if you disable per sample evaluation for PhaseG
in Volumetric Advanced Output properties - it will result.
Results per sample (left cloud phase g = 0, right cloud phase g = 1):
Result per pixel (same phase g settings):
Not sure if it's possible to somehow switch MultiScatteringOcclusion
to be evaluated per sample too.
Good point. But MultiScatteringOcclusion
cannot be evaluated per sample, maybe you should try another approach.
But
MultiScatteringOcclusion
cannot be evaluated per sample, maybe you should try another approach.
You mean it's not possible in current unreal engine or it wouldn't be possible even changes were made (like creating custom volumetric clouds from some plugin or changing some code in the engine)?
You would have to change Engine\Shaders\Private\VolumetricCloud.usf
yourself. You can anything of course but I'm guessing modifying this MultiScatteringOcclusion approximation is meant to be per-pixel rather than per sample. Again, I'm not really qualified to comment on this, but you can reach out on Discord if you want to keep discussing about it privately, as this is not a plugin bug.
My idea was to create custom shading for each of the cloud from BP_VdbToVolumetricClouds (I need to use multiple cloud based VDBs in one scene). I've manged to achieve that for cloud color with shader below (first cloud is red, 2nd is blue etc).
I tried to use the same approach for MultiScatteringOcclusion in volumetric advanced output.
But it doesn't work - red cloud is suppose to be bright (and it is) but blue cloud is suppose to be very dark because of occlusion = 1.
https://user-images.githubusercontent.com/9417531/215183754-909cb18b-519e-4c9d-b83d-a97641f10194.mp4
Further investigation led me to the conclusion that the problem is that calculating sampled vdb value during
MF_Vdb_Volume_Sample
is incorrect.Simplest way to see it is to connect first volume density with
ceil
to occlusion. If volume values were sampled correctly then you would expect first red cloud to be dark (density = 1 => occlusion =1 => dark cloud) and blue cloud to be bright (density = 0 => occlusion = 0 => bright cloud). But both clouds are bright, meaning occlusion = 0 => density sampled as 0 everywhere which is incorrect.Maybe something goes wrong during calculating occlusion in hlsl (which is
VolumetricAdvancedMaterialOutput4
) but I'm not that familar with howMF_Vdb_Volume_Sample
works to solve that.Any way to fix that to get correct that density here?
Here's the map if need to test it - incorrect density sampling for VAO.zip
PS Red cloud without occlusion kind of looks like explosion, maybe it's possible to sample temperature vdb values and map them to occlusion to create temperature shading in volumetric clouds.