Any good pointers on how to get the refractive look of glass? I'm looking to create a think piece of glass type of look, sort of the type that you'd have on bathroom shower doors.
|
I am a little confused about what you are asking. I think you might be asking how to create water droplets in an indirect way. I will answer both. =) If you want to create water droplets you can use a very simple distortion shader to offset the current pixel coordinates. However, there are many ways to do water droplets. Here is one which works well: http://blogs.msdn.com/b/shawnhar/archive/2009/04/13/motogp-raindrops-keep-falling-on-my-lens.aspx If you want to create the refractive look of glass then you are going to have to create an environment map. This essentially is your scene rendered from the 6 sides of a cube, if you choose a cube map. I suggest using XNA 4 because it now comes with a built in
Here are some articles which describe the process in more detail (keep in mind the new EnvironmentMapEffect for XNA 4.0): http://digierr.spaces.live.com/blog/cns!2B7007E9EC2AE37B!585.entry?wa=wsignin1.0&sa=736960100 |
|||||
|
|
If you want refractions, you will need to copy your back buffer to use as a texture for a distortion pass. There are a couple of ways to do this pass, but the most common is to create a distortion buffer some where early in your rendering pipeline after your Z has been written where you blend in your distortion directions. You can then do a pass where you find it suitable (after opaque and before transparent for example) where you copy screen to a texture and distort back onto the screen using your distortion map. It will not be correct but it will be quite fast. An alternative is to copy screen for each glass that is supposed to distort, this will give you a more correct look but it will cost a lot. |
|||
|
|