- Home /
distortion/refraction
Im trying to get an heat distortion effect into my game, I tryed different tecniques, for example using the the material: Fx/glass/stainedBumpDistort and putting it on particles, this works perfectly, but Objects beeing in front of the particles also become distorted. Looking at the pro-water, it seems to have the same effect, but the waterscript fixes this using "clip-plane offset", setting the nearplane of the camera to the refractionplane, so objects in front dont get distorted. Someone has an idea how to transfer this clip-plane-thing to other objects/shaders?
Thanks for looking into this...
edit: screenshot of the effect: character standing in front off a cube with Fx/glass/stainedBumpDistort(no diffuse, just normalmap) material:
Sounds like a z-sorting issue. $$anonymous$$ake sure your particles are sorted properly- there are some settings in the renderer for tweaking this kind of thing.
thanks for ur reply, i tryed tweaking the sorting modes, but this has no impact. This also happens when i use no particles but a plane or another solid object. Also i should have mentioned: the objects in front of my particle/plane/whatever dont get distorted completly like objects beeing behind. It looks like the object in front is drawn twice, one time distorted and onother time on top of that without distortion, but the distortion is still visible outside the silhuette of my object (hard 2 explain ^^).
I think I've experienced a similar problem, but I'm not sure how I fixed it. In any case, it's a subtle bug with the shader. I can't really help you that much there- my experience with shaders amounts to basically hacking together mods of existing shaders, and very basic surface shaders from scratch.
Answer by ScroodgeM · Jul 20, 2012 at 12:10 PM
solution depends on technique you use for this effect:
if this is a shader only effect, then you need to render distortion AFTER all that should be distorted, but BEFORE everything that should not. this can be achieved by setting shader queue in shader declaration
if this is a render texture with posteffect effect, then solution is layers-separation. e.g. you should use layer for distortion object and turn on render of that objects only to this camera
Your answer
Follow this Question
Related Questions
LWRP - particle shader - Distortion for Heat 2 Answers
Shader Forge : trying to get refractive particles 1 Answer
Glass Refraction Shader 2 Answers
How do I make refraction visible in 2d mode? 1 Answer
Texture distorted locally 1 Answer