[Elemental Shader Jam] Ice
Played with making ice.
I want to do that cool fractal thing that you see in the middle here:
...but I'm failing at maths. :(
I was hoping that using a fresnel with some noisiness stuck into it would give me streaks, but that's not really what happens. Any suggestions?
I want to do that cool fractal thing that you see in the middle here:
...but I'm failing at maths. :(
I was hoping that using a fresnel with some noisiness stuck into it would give me streaks, but that's not really what happens. Any suggestions?
Comments
@hermantulleken: The star-like spikey thing in the middle that I assume is caused by air bubbles.
@Tuism: Life is so much easier when I don't give a crap about performance. XD
Added some noisiness/bumpiness to the reflections to make them not look so glassy. Unfortunately, the noise is done based on the sphere's UVs, and default primitive spheres have artifacts at the poles, which makes that look funny.
Also, I gave up on trying to create that fractal, and took the easy way out. Switched my project to DX11, and just used tessellation and displacement in a surface shader to get my spiky fractal shape. It's not quite the shape I want compared to the ice in the first post (it's currently too straight, regular and streaky), but it's okay. I'm not really sure it's worth the effort of trying to make a primitive look more complex though, so I might stop here.
Here's the code for the outer sphere. It's a mess (there may be some stuff left in there that I ended up not using... I tend to do that when I'm just messing around trying to prototype a look!), but I don't care! :D
The bloom shader isn't really worth posting, because I pretty much made a simpler version of what someone posted here. I just removed the dirt and added the possibility of biasing my blurring so that I could get more horizontal blurs.
And the tessellation I learnt how to do from here. The guy there takes a bunch of work from GPUGems and ShaderX and implements them in Unity, with some pretty kickass results, and shares the projects for free. Great learning material. :)
I think the spikes are a bit too harsh though, maybe put some stuff on top of them (like foggy ice surface-ness), but if you're going for a clear surface then it's probably right.
Why does rotating the ball rotate the room too? Cos that's the only way the reflecitions/refractions in it will move too, right?
I hate surface shaders.
And it's not the ball rotating -- it's the camera orbiting around the ball. :) I can see how that would be confusing, given that the camera's orbit pivot is in the same position as the ball's centre. :P
@Denzil: Thanks dude! I actually want to do some procedural volumetric fire next, just to have that under my belt. In particular, I've always been blown away by how Little Inferno had such dynamic fire fx, and I figure if I can get fire, water and some other fluids working, it could potentially be something around which another little game/sandbox can be built. I imagine Where's My Water might work in a somewhat similar way.
I was also being dumb and tried writing realtime raytraced caustics. XD Ideally, I'd like to move this off of the cpu onto the gpu using DirectCompute, but I dunno how useful that actually is for me to learn. Maybe a hybrid approach would work, where I do the raycasting on the cpu (because easy, Unity physics), but do interpolation and texture manip on the gpu... but I think I'll skip that and do some other shaders rather.
Also I like the first ice shader more - the one with the dots instead of these spikes. Looks better to me.
http://techartjon.com/unity/ice/_Build.html (~3.1MB)
[edit] Oh, btw, If you're not on a DX11 computer, the fractal thing won't show up. But the rest shoooould work. Unity seems to claim the ice shader now requires SM5 too, but I'm not doing anything special in there that wouldn't run on SM3... (definitely not SM2 though!)[/edit]
Bah, spent most of tonight trying to do stuff with compute shaders, and it turns out that it's the actual raycasting that's the bottleneck. Then I played with using a gridded sample instead of random samples, hoping that I could reduce the number of rays that I'd need, but I couldn't eliminate the obvious pattern that results. Then I tried blurring the texture, but that helped marginally (probably because I did it wrong). And finally, I had supper. :D
Enough! Next shader!
I'm trying to make an ice cube with this but I could not duplicate you very first example...how you do the bubbles inside and the cubemap? I take the same hdr but could not duplicate the result.
thank you for help :)