HologramShader icon indicating copy to clipboard operation
HologramShader copied to clipboard

Moving an object with the shader applied to it causes the shader to show visual artefacts

Open sjoerdthedev opened this issue 7 years ago • 1 comments

I was trying out your shader (Absolutely amazing, by the way) and I noticed that when an object moved with the shader applied, it would cause the scanlines on the hologram to stay where they are relative to world space, ruining the hologram effect on fast moving objects. I wanted to try and fix it myself and then make a PR to your repository but I have no experience in HLSL. So, while I did manage to hack a "fix" in there, I think there should be a better solution compared to what I did.

Here is my workaround to the problem:

I changed o.worldVertex = mul(unity_ObjectToWorld, v.vertex); To: o.worldVertex = v.vertex

This fixed the problem but the scanlines appeared a lot bigger now since the scanlines' size is now depended on the object's size. So to "fix" that I multiplied v.vertex by 8 and that seemed to get the same visual effect, except now I can rotate and move the object around without the scan lines moving around. It does appear to introduce slight problems with lighting, though.

I hope you can/want to do something with this information to make a fix that is a bit less hacky than what I did.

sjoerdthedev avatar Sep 25 '18 21:09 sjoerdthedev

Thanks for the feedback, unfortunately object space scanlines can have some very bad results, I will add an option for this so thats up to the user to choose.

andydbc avatar Sep 28 '18 13:09 andydbc