Skip to main content
GameDev.net gamedev.net
🔒 Locked

Glass

Started by superpig Apr 17, 2003 at 4:27 AM 5 replies 300+ views
Original Post
superpig
superpig
Hey all, I''m wondering about the best way to do glass in a game. I want to have a model made of glass (like a crystal) which can be fractured. As a result it would distort the image behind it. Is there a decent way of doing this, or would I have to render the backdrop, grab the texture, and project it onto my glass model? Superpig - saving pigs from untimely fates, and when he''s not doing that, runs The Binary Refinery.
Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse
Deficite
Deficite
Hello,

Sure you can do it, developer.nvidia.com has some really nice examples. I think they use Cg on a rabbit model to make it look like it''s made of glass. This is a screenie:
http://developer.nvidia.com/dev_content/cg/cg_examples/pages/refract_reflect_demo.htm

You can easily find the source on the nvidia website. If you don''t like Cg you can always look at the code and port it to the appropriate shader.

Regards,
Deficte
Regards,
Deficte
superpig
superpig
Ah - yeah, I forgot I had that demo I''ll check the source and see how they do it. But I have a feeling they use environment maps; you can''t generate those on-the-fly, can you?

Superpig
- saving pigs from untimely fates, and when he''s not doing that, runs The Binary Refinery.
Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse
NaliXL
NaliXL
And it probably only works with NVidia specific extensions.....
Newbie programmers think programming is hard.Amature programmers think programming is easy.Professional programmers know programming is hard.
superpig
superpig
quote:
Original post by Anonymous Poster
(maybe at reduced detail to keep speed cost down)..


Ah, that''s what I was really wondering about. I guess if the model is fairly small, then it should be ok...

Superpig
- saving pigs from untimely fates, and when he''s not doing that, runs The Binary Refinery.
Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse
Coincoin
Coincoin
Also, you dont have to generate the environement for every frame.
Doing it once before the effect should be enough to trick the eye.

______________________________
Oooh, you found the horadric cube!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.