Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sjoerd108 opened this issue Sep 25, 2018 · 1 comment
Assignees

Comments

@sjoerd108
Copy link

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.

@andydbc
Copy link
Owner

andydbc commented Sep 28, 2018

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 andydbc self-assigned this Sep 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants