sebh / unrealengineskyatmosphere Goto Github PK
View Code? Open in Web Editor NEWUnreal Engine Sky Atmosphere Rendering Technique
Home Page: https://www.unrealengine.com
License: MIT License
Unreal Engine Sky Atmosphere Rendering Technique
Home Page: https://www.unrealengine.com
License: MIT License
In order to have the project built using SDK v10 and Toolset v142, I had to include #include <string>
in Dx11Device.h.
Hi Sébastien,
thank you for sharing this awesome technique. I could already implement the approach in a toy project vr space flight simulator. https://www.youtube.com/watch?v=LGN-KqRX9Z4
Since the simulation is rather realistic I have a non-spherical earth.
Where would be the best place to skew the calculations so that the horizon (EarthBottomRadius) starts 21km lower on the north/south pole?
I assume replacing all ray to sphere intersection calculations might be too costly for a non-spherical on the Oculus Quest.
Thanks in advance.
Hello,
Thank you for sharing this code. It helped me a lot in understanding volume rendering algorithms.
I'm reading the path tracing implemention. I‘m a little perplexed by the following code. With uniform sampling, phaseValue / phasePdf
is not constant 1. Why throughput is not updated?
UnrealEngineSkyAtmosphere/Resources/RenderSkyPathTracing.hlsl
Lines 836 to 843 in f675c23
MieScattScale
larger than 1.0 (need to change SliderFloat v_max) and sun behind camera, sky will be brighter when MIE_PHASE_IMPORTANCE_SAMPLING
is disabled than when it is enabled.First off, thanks for publishing this code and the corresponding paper! Very cool work.
I'm working on an implementation, and I'm a bit perplexed by the use of SampleSegmentT
in the core integration loop. It looks like it has the effect of shifting the sample positions forward by 0.3 times the interval between samples. I also didn't see any trapezoidal weighting as used in Bruneton's method.
Could you clarify the reasoning behind the integration method you went with? Thanks!
The multi-scattering precompute shader numerically integrates incoming light using sample rays distributed uniformly along polar coordinates:
UnrealEngineSkyAtmosphere/Resources/RenderSkyRayMarching.hlsl
Lines 448 to 470 in f446f24
sin(phi)
factor, but that doesn't seem to be in evidence. Does NewMultiScattCS have an unintended bias, or is this compensated for elsewhere? If so, where?
As always, thanks for publishing this excellent paper and the very helpful example code regardless.
git submodule update --init does nothing.
I assume something is wrong with repo setup.
Maybe something like this:
https://stackoverflow.com/questions/39765663/git-submodule-init-does-absolutely-nothing
Not critical because it is possible to manually clone imgui and tinyexr.
Hello Sebastian,
Great contribution and thanks for sharing production ready code. One of the things I noticed is no matter the SKY LUT Format. (F16, F32) or resolution there will be visible banding.
I was able to fix this by applying a Jitter at the end post Tonemapping. I tried this pre-tonemapping and it won't work so well due to range of F16 or F32.
I think Unreal defaults to TAA which is inherently eating up these banding artifacts.
For any one interested here is sample code. This works well for F16 SkyLUT 256 x 144
/**
inline float sampleInterleavedGradientNoise(float2 pixelPos)
{
const float3 magic = float3(0.06711056f, 0.00583715f, 52.9829189f);
return frac(magic.z * frac(dot(pixelPos, magic.xy)));
}
inline float3 applyDitherToPixelColor(float3 pixelColor, float2 pixelPos)
{
const float2 scaleBias = float2(1.f/255.f, -0.5f/255.f);
float noiseDither = sampleInterleavedGradientNoise(pixelPos) * scaleBias.x + scaleBias.y;
return (pixelColor + noiseDither);
}
Hello,
First of all, thank you very much for providing the implementation example for your excellent document!
I tried to implement it in my own project, but now everything that is not the sky is way too bright with a 10.0 exposure used in this paper and in Bruneton's paper.
If I understand the equations and the code, the HDR buffer contains luminance values.
According to wikipedia (https://en.wikipedia.org/wiki/Orders_of_magnitude_(luminance)), an average cloudy sky has a luminance of 2 kcd.m^2 but in this implementation it seems that the bright blue sky has an order of magnitude of 10^-1 cd.m^-2.
Is a 10.0 exposure appropriate for outdoor scenes? Am I missing something with the values in the HDR buffer?
I am a little bit confused about the way, aerial perspective froxels are supposed to work. I mean, I understand that basically they store the integrated (in-)scattering and transmittance of a slice at a certain depth, however this also implies that if the sun is obstructed by terrain, all scattering effects will still be applied on top of the geometry, even if one would not expect them to be there. I realized this was an issue, when moving the sun behind a mountain and was still able to see the mie halo. I naively disabled mie scattering for AP, however I then realized, that this made no sense for situations where mie scattering is expected, i.e. if the sun is (partially) visible.
The following image demonstrates what I mean. Right is mie on, left is off. Top is sun obstructed, bottom is with sun visible. Basically I want to get rid of the mie effect in the top row, whilst retaining it in the bottom row.
I also tried pre-multiplying the transmittance with the luminance when applying the AP, which reduced the effect, but did not completely eliminate it - especially, if the obstruction happens by geometry that is far away from the camera. This makes sense, given the way I understand this implementation of aerial perspective. So... shouldn't the terrain already be considered when computing the froxel? Do you have any advice on how to solve this issue in an adapted implementation?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.