mos9527 / sssekai_blender_io

Project SEKAI Blender Asset Importer / PJSK 资源导入插件
https://github.com/mos9527/sssekai
MIT License
10 stars 0 forks source link

A edit i did for the shader #2

Closed ChicoEevee closed 7 months ago

ChicoEevee commented 7 months ago

https://streamable.com/7krzx7 i think might be helpful, the SDF need some tweaks but i guess it works?

mos9527 commented 7 months ago

Again, thanks for the PR! Didn't know ehl meant Eye highlight lol

So before this PR I've implemented something very similar in approach here for the SDF shadows. The effects (and issues) are quite similar - there are a lot of break-up in the shadows when there shouldn't really be.

Regarding correctly implementing the SDF shadows (at least, according to this blog and some other resources I've found), the distance field threshold is not really compared to per-vertex shading values (i.e. taking Diffuse BSDF outputs from Blender as the lighting value).

Instead the object's forward direction vector is taken as the surface normal, and shaded with one directional light source (which doesn't really need to be an acutal light? I did that) as the step term to derive the hard shadows. Plus some other terms to shade the faces from different angles since the SDF map is actually one-sided. Hence the method's limitation to be only able to shade symmetrical faces.

My implementation in Blender tried to achieve that. I won't be getting into the details here (it's a pain, honestly :/ ). Though I think the results do look better?

Here's a video showing what it looks like in action: https://streamable.com/c3kpov

And some screenshots! Why not. image image