naelstrof / UnityPenetrationTech

A gpu-based deformation system for mapping penetrators along orifice paths.
MIT License
107 stars 16 forks source link

Clip range listener doesn't work in HDRP Shader Graph #3

Closed bonzomi closed 2 years ago

bonzomi commented 2 years ago

Platform: Unity 2021.3.4f1 LTS on HDRP 12.1.7 Using PenetrationTech v3.0.5

Current output: image Expected output (Using ASE version): image

Using ASE also introduces weird artifacting as shown below image

On latest UnityPenetrationTech package, ASE version enlarges the penetrators and is inaccurate to actual geo. Problem persists with ShaderGraph version.

naelstrof commented 2 years ago

Clip range listener doesn't work in HDRP Shader Graph

Unfortunately Shader Graph doesn't support piping data from vert to frag (You can find out more here: https://forum.unity.com/threads/compute-value-at-vert-instead-of-frag.853015/)

Since the clipping is in un-distorted world-space, it needs to do a spline distance lookup to undistort the distance-- which as things are would need to happen per-pixel. I didn't want to accidentally make something highly unoptimized, so I just simply left it out completely!

On latest UnityPenetrationTech package, ASE version enlarges the penetrators and is inaccurate to actual geo. Problem persists with ShaderGraph version.

Make sure your Vertex Output mode is set to Absolute rather than Relative. This can lead to the model looking twice as big, and make clipping happen at the wrong points. It might also cause weird artifacting. Hopefully that's the only problem!

naelstrof commented 2 years ago

I also recommend upgrading to v3.3.2, large amounts of bugs and functionality was needed to get it working in my game the way I wanted.

bonzomi commented 2 years ago

image Thanks, the vertex fix helped! I've had no problems with different models but this particular one ended up with this rendering error on the game view, looks fine in scene view. I've tried swapping materials and it didn't work.

bonzomi commented 2 years ago

image Closing this issue, I just had to set the surface type to transparent