Ben Golus Profile picture
26 Feb, 10 tweets, 4 min read
I implemented a couple of different approaches to reconstruct normals from a depth texture. No separate script dependencies, and works for Unity's built in and URP as a post process or on world objects.

gist.github.com/bgolus/a07ed65… ImageImageImageImage
No script dependencies comes from @_kzr 's latest version of his inverse projection setup, which oddly still uses a script to setup an inverse view matrix Unity already provides by default.
github.com/keijiro/DepthI…
"Improved" method based on János Turánszki's Improved Normal Reconstruction with some minor optimizations. Works surprisingly well for getting rid of depth disparity artifacts, but adds others on interior edges.
wickedengine.net/2019/09/22/imp…
"Accurate" method based on Yuwen Wu's Accurate Normal Reconstruction, altered (based on comments in that article) to work with Unity's existing non-linear depth texture. Only minorly more expensive than János's "improved" method.
atyuwen.github.io/posts/normal-r…
It should be noted that all 4 options have different benefits and different problem cases.
Thanks to @_kzr @turanszkij and @atyuwen for posting their stuff.
If anyone is wondering why I didn't include a ddx/ddy based approach, that's because they're terrible and you should feel bad for suggesting it.
I should also note I don't exactly match @atyuwen 's example. I calculate the each derivative from the diff of the center position and one offset position rather than using the diff of two offset position. I'm not sure if the original approach is better?
Compared my "centered" modification to the original "offset" approach.

The original is definitely worse, so I have to assume it was a typo in the article? In the below there's a phantom ghost edge that pops up here. Image
I realized I was being dumb here. For a post process you do still need an external script since the inverse view matrix I’m using isn’t the same as when rendering the shader on a mesh.

However it might still work if replaced with unity_CameraToWorld instead. I’ll have to try.

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Ben Golus

Ben Golus Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @bgolus

3 Mar
Does anyone know if there's a proper name for anti-aliased pixel art scaling? I don't mean xRB / hq#x / MMPX. I mean the equivalent of integer scaling pixel art and down scaling via bilinear.
Maybe "super sampled nearest neighbor scaling"?

But, doesn't actually need to be super sampled. It feels like there should be a proper name for it, and maybe there is and it's just been appropriated by what people call pixel art scaling algos.
shadertoy.com/view/ltBfRD
Read 4 tweets
31 Aug 20
@IRCSS @benoitvimont @Atrix256 I use blue noise temporal dithering with A2C. Been meaning to post a tutorial on it at some point.

_MSAAQuality and _BlueNoise64Tex are set via a c# script, with the blue noise texture being swapped each frame.
@IRCSS @benoitvimont @Atrix256 That's the dithering code used to produce these examples:
@IRCSS @benoitvimont @Atrix256 This is the code I used for converting from a dithered alpha to explicit coverage mask (either SV_Coverage or gl_SampleMask).
Read 5 tweets
16 Jun 20
I want to rant a bit about recent price & spec reveal of the Samsung Odyssey G9, and why this it is an impressive bit of tech ... and how Samsung is lying by omission.

samsung.com/us/computing/m…
Basic specs their web site (and all the press dutifully copy paste everywhere):
1000R 49” 5120x1440 HDR1000 QLED 1ms 240hz with GSync and FreeSync Premium Pro support. This has all the bells and whistles you could ever hope for. Except there’s one more spec that’s important.
DisplayPort 1.4
Read 21 tweets
21 Feb 20
Weird new @unity3d bug I think I found. For the last few months I've had strange bugs with my builds that no one else on my team experiences. Totally clean projects will fail to build when using Build & Run, succeed when using Build, but may have crash at consistent points.
@unity3d I didn't really think much of it. They started happening on a single new platform that I was having other issues with, so I figured it was something with my dev environment for that platform that's broken.

Just started working on a new platform ... and I have the same issues.
@unity3d Both platforms error when doing Build & Run, and both errors are something deep inside Unity's c++ code, and are different errors. However, both were occurring inside sound related systems (one complained about the DSP not being available, the other that FMOD had no device).
Read 10 tweets
1 Jan 19
We shipped Planetary Annihilation on Win, Mac, and Linux. Linux uses we're a big vocal part of the Kickstarter and forums.

In the end they accounted for <0.1% of sales but >20% of auto reported crashes and support tickets (most gfx driver related).

Would totally skip Linux.
So yes, fragmentation is still totally an issue.
We eventually laid out a guide with known good versions of Linux and graphics drivers, but it didn't matter. Part of the allure of Linux is the customizability, so few actually stuck to it, and generally wanted to run the game on older hardware we didn't support.
Read 5 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!