- Home /
Making a glass ball like a marble without HDRP?
I want something that will work in WebGL or Android, so HDRP is out. I can make a clear glass ball, but it has no depth. I need the Refraction piece, but without HDRP. Would prefer not to buy an asset. I trid using the code in the Glass Shader example, but couldn't get it to work.
Any suggestions?
Answer by JonPQ · Jan 31, 2019 at 08:31 PM
try this shader... http://wiki.unity3d.com/index.php/Refraction also could try 2 layers (2 meshes)... combine refraction layer, with a legacy shader , reflective->transparent with a cubemap environtment map
@JonPQ Yeah, I tried that as well, and it's not doing anything. I don't know if there's something in my settings that's preventing these from working, but no matter what I set the distortion to, it looks clear.
this worked for me in the past... https://assetstore.unity.com/packages/tools/particles-effects/heat-haze-4174 ....BUT.... its possible that you might need unity pro or paid, for refraction effects... So here are another couple of "cheat" possibilities... but would take a fair bit of work and knowledge...
1) Use the environment-mapped legacy unity shader, but copy and modify it... So that the reflection normals are reversed (ins$$anonymous$$d of reflecting like the outside of a ball, it will work more like the inside of a ball) this might make a decent effect, but requires shader program$$anonymous$$g skills. It wouldn't reflect nearby geometry... just the skybox. But would render fast.
or 2) setup a render camera that is looking at your marble/ball, and renders to a render texture (but without the ball (put it in a layer the camera doesn't render) then use this texture as an input to shader for the ball. It will need to caclulate uv's in the shader, projected based on the balls normals compared to camera look direction... again requiring shader skills.. and an extra scene render, but it would refract (sort-of) nearby geometry :/
Your answer
Follow this Question
Related Questions
Oculus rendeing bug 0 Answers
Glass Shader with Strumpy Shader Editor 1 Answer
Light Refraction, Glass, and Marbles 2 Answers
How can I switch between direct lighting and light probes in a shader? 0 Answers