Page 1 of 1

Refraction

Posted: Sun Jul 20, 2008 10:11 pm
by Blue Hampster
Hey all, i have been looking for a way to implement refraction into a program of mine. I have found several pieces of code on this site, but they dont work on my system or any of the others in my house. There is however one type of refraction that works and is very good for my needs.

The example is at:
http://sio2.g0dsoft.com/modules/wmpdown ... .php?cid=1

called Dynamic Glass Refraction

It works perfectly on my systems, but I have no idea how to implement something like this of my own. Can anyone help?

Posted: Mon Jul 21, 2008 6:59 am
by Mirror
look at blindside's glass implementation it must be either in the code snippets or project announcement, not sure where exactly.
basically you render to a texture the current scene and use a shader to have the 'refraction' effect.

Posted: Mon Jul 21, 2008 12:09 pm
by Blue Hampster
Ok, that sounds very cleaver. I was wondering if anyone had a shader like this. Also, is there a way to implement it automatically into a program without leaving the file open to the public?

Posted: Mon Jul 21, 2008 12:47 pm
by JP
Do you mean so that people can't nick your shader? there's no perfect way of doing it really... You could bundle it into your .exe but someone could still get it out again if they wanted....

Posted: Mon Jul 21, 2008 12:59 pm
by Blue Hampster
Yup, an un-nickable shader, lol. Do you know where a shader to cause refraction based on a texture could be acquired?

Posted: Mon Jul 21, 2008 1:20 pm
by JP
:lol: i like how you want to nick someone else's shader but don't want anyone else to nick it off you!

search the forum for refraction and you'll probably find some people's efforts, whether they provide the shaders and source you will have to find out for yourself as i don't know ;)

Posted: Mon Jul 21, 2008 1:22 pm
by Blue Hampster
yup, i am the worlds biggest hipocrite. Its not so much that I want to steal it, its just that i dont know how to make shaders, and then i dont want to reveal the entire source of the shader to all that seek it.

Posted: Mon Jul 21, 2008 1:35 pm
by JP
But if it's not your own code then why does it matter? It hardly seems fair and if you manage to find the shader freely then they can too so it seems pointless protecting your copy of it.

Posted: Mon Jul 21, 2008 2:02 pm
by rogerborg
Blue Hampster wrote:yup, i am the worlds biggest hipocrite. Its not so much that I want to steal it, its just that i dont know how to make shaders, and then i dont want to reveal the entire source of the shader to all that seek it.
I actually find myself admiring your unabashed zeal to take, take, take without giving anything back. You're the Accounts Receivable of software development.

Posted: Mon Jul 21, 2008 2:06 pm
by Blue Hampster
Actually, my intention is to gain enought understanding of the entirety of the Irrlicht Engine and then I intend to return all i've taken.

Posted: Mon Jul 21, 2008 2:08 pm
by JP
but not this shader?

Posted: Mon Jul 21, 2008 2:11 pm
by Blue Hampster
as i said, i dont understand shaders, yet. but i soon will. I am trying to understand why some shaders wont work on my system, but have a large degree of sucess on others. The only main reason i am trying to incorperate the shader directly into a program is just to keep it tidy. I only want to have some of the models and textures available.

Posted: Mon Jul 21, 2008 2:55 pm
by rogerborg
Oh, no, no. Don't back down from it! Now I'm losing respect for you. Insert more Stig quotes!

Posted: Tue Jul 22, 2008 5:32 am
by BlindSide
As mentioned, just look at my refraction tutorial. It includes full source code that is even tutorial-style commented to teach you ever step of the way how it is accomplished in Irrlicht. I am too lazy to link you there however as you seem to want to rip me off entirely. :P (Just search the Project Announcements forum as previously mentioned)