Cheap Glass Shader

Community Forums/Graphic Chat/Cheap Glass Shader

Gabriel(Posted 2006) [#1]
I took a little time off from working on my game engine tonight to write a new shader. I've looked everywhere, but everyone seems to like totally realistic glass which is great, but it's also expensive. In a FPS you might get away with it, but multiple renders to cubemaps per frame just for some very small areas of glass just isn't practical.

Of course, in order to fit in with a scene, it needs a very generic reflection texture. If you use a scene specific reflection texture, you become much more aware that it's not very accurate in it's reflections. Obviously I would create a different reflection texture for each area/level so that the texture *somewhat* reflects ( pun not intended ) the environment, but only vaguely and probably with a photoshop twist and blur job to make it less clear.

http://www.youtube.com/watch?v=HVpXlluIyVM

And please don't ask me how to do this with Blitz3d, because you can't do this with Blitz3d. It's a pixel ( and vertex ) shader and you just can't do what I'm doing here without shaders. You can probably fake something very similar with a bit of effort ( and quite a slowdown ) but I'm afraid I wouldn't know how. That's why I'm not using B3D for this ;)


puki(Posted 2006) [#2]
Looks good.

I applaud you for using You Tube. Unlike the rest of the rodents around here.

However, you failed to mention Blitz so it won't show up when I do my monthly check of Blitz videos on You Tube - using the keyword Blitz, BlitzMax, etc.


IKG(Posted 2006) [#3]
Very realistic :)


Naughty Alien(Posted 2006) [#4]
@Gabe

I have exactly same effect in B3D with Andreymans library, and its damn fast..


Ash_UK(Posted 2006) [#5]
Very nice Gabriel :o) Keep up the good work.


Gabriel(Posted 2006) [#6]
However, you failed to mention Blitz so it won't show up when I do my monthly check of Blitz videos on You Tube - using the keyword Blitz, BlitzMax, etc.

Yeah, sorry about that. Technically it's not Blitz yet, as that was recorded in FX Composer. It will eventually be BlitzMax and TV3D when it's in my engine though.

I have exactly same effect in B3D with Andreymans library, and its damn fast..

Well it probably won't be exactly the same effect, because I think you can't do what I've done with the UV coords ( it's not even a recognised technique, just something I did by accident trying to do something else, hehe. ) But yes, it's basically environmental bump mapping to get the smoked glass effect, which is what Andreyman's library does.

His demo is what gave me the idea actually, as I thought his water didn't look much like water, but did look a lot like moving smoked glass. I assumed he was using a cubemap though, is that not right? I only use a flat texture there to save 5/6's of the VRam.


Naughty Alien(Posted 2006) [#7]
I said things about andreymans library regarding short video I saw..if it is something you looking for, then his library doing that very well..


Gabriel(Posted 2006) [#8]
Ah ok, well I think Tom had a demo of EBM going with one his DLL's so if anyone does want to achieve a similar effect in B3D, albeit they'll probably have to use a cubemap, then they can probably get something similar.

Although technically I'm using an RGB normal map, not a greyscale bumpmap, but it should be pretty comparable if a little more expensive.


Torrente(Posted 2006) [#9]
Looks very good, can't wait to see it in your engine.