Comments (7)
How exactly does it break? does it just disappear?
from realistic-atmosphere-godot-and-ue4.
Hey Dimev,
Yes. I can tell you exactly how.
I get a SM5 Ray tracing closest hit shaders cannot read from the SceneTexturesStruct
error in the Stats tab in the material graph (I'm looking at the non-post version.
The issue is in your Get Max Distance custom expression node. Any ideas how we could re-write that Texture2DSampleLevel function to not need this struct? Maybe we can add an input to Get Max Distance to replace that or just try and do it all with nodes?
float3 Forward = mul(float3(0.00000000,0.00000000,1.00000000), ResolvedView.ViewToTranslatedWorld);
float DeviceZ = Texture2DSampleLevel(SceneTexturesStruct.SceneDepthTexture, SceneTexturesStruct.SceneDepthTextureSampler, ScreenAlignedPosition(GetScreenPosition(Parameters)), 0).r;
float Depth = DeviceZ * View.InvDeviceZToWorldZTransform[0] + View.InvDeviceZToWorldZTransform[1] + 1.0f / (DeviceZ * View.InvDeviceZToWorldZTransform[2] - (View.InvDeviceZToWorldZTransform[3] + 0.00000001));
return Depth / abs(dot(Forward, Parameters.CameraVector));
from realistic-atmosphere-godot-and-ue4.
Someone else also had this issue in the 4.25 preview
The code I'm using here essentially makes sure the distance returned by the depth buffer is correct, because using the scene depth node divided by the dot product of the forward and camera vector directly results in the depth not being 100% accurate at large distances.
I assume the issue has something to do with the material being involved in raytracing. maybe it can be fixed by somehow making the material not a closest hit shader, but I'll have to look at it, and maybe a different workaround of the max distance thing.
from realistic-atmosphere-godot-and-ue4.
If you have any ideas I may be able to implement, happy to try. If there is any way to do it without HLSL that'd be safer of course.
from realistic-atmosphere-godot-and-ue4.
The weird depth thing is because the ue4 devs added a very small value to DeviceZToWorldZ to avoid dividing by 0 in one shader in the engine (which is a stupid hack, just do proper divide by zero checking), causing the depth to be inaccurate, and needing this workaround (written by Dexyfex, not me)
There's probably a way to get around this with only nodes, but that needs investigation. Probably dividing the resulting depth by some values using nodes may work, but I haven't had success with that so far
from realistic-atmosphere-godot-and-ue4.
I found a fix for the issue, I'll soon upload a 4.25 version of the project and close this.
The new code for the Get Max Distance node is this:
float3 Forward = mul(float3(0.00000000,0.00000000,1.00000000), ResolvedView.ViewToTranslatedWorld);
float DeviceZ = LookupDeviceZ(ScreenAlignedPosition(GetScreenPosition(Parameters))).r;
float Depth = DeviceZ * View.InvDeviceZToWorldZTransform[0] + View.InvDeviceZToWorldZTransform[1] + 1.0f / (DeviceZ * View.InvDeviceZToWorldZTransform[2] - (View.InvDeviceZToWorldZTransform[3] + 0.00000001));
return Depth / abs(dot(Forward, Parameters.CameraVector));
from realistic-atmosphere-godot-and-ue4.
I uploaded the version with the fix, should work now
from realistic-atmosphere-godot-and-ue4.
Related Issues (8)
- Packages successfully on 4.24.2, but the packaged .exe won't run HOT 3
- Help eliminating the polygon quad looking lines HOT 4
- Known issues: very big atmosphere. [FIX] HOT 5
- PluginVersion + Add BPAtmo HOT 2
- Multiple Light Sources HOT 3
- Link to shader for Godot is broken link HOT 1
- Which UE Version to use, UE 4.26.1 Spitting out Errors in the atmosphere_non_post material HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from realistic-atmosphere-godot-and-ue4.