Refraction

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Blue Hampster
Posts: 39
Joined: Tue Apr 29, 2008 1:41 pm
Contact:

Refraction

Post 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?
Mirror
Posts: 218
Joined: Sat Dec 01, 2007 4:09 pm

Post 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.
Blue Hampster
Posts: 39
Joined: Tue Apr 29, 2008 1:41 pm
Contact:

Post 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?
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post 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....
Image Image Image
Blue Hampster
Posts: 39
Joined: Tue Apr 29, 2008 1:41 pm
Contact:

Post 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?
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post 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 ;)
Image Image Image
Blue Hampster
Posts: 39
Joined: Tue Apr 29, 2008 1:41 pm
Contact:

Post 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.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post 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.
Image Image Image
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post 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.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Blue Hampster
Posts: 39
Joined: Tue Apr 29, 2008 1:41 pm
Contact:

Post 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.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

but not this shader?
Image Image Image
Blue Hampster
Posts: 39
Joined: Tue Apr 29, 2008 1:41 pm
Contact:

Post 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.
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Oh, no, no. Don't back down from it! Now I'm losing respect for you. Insert more Stig quotes!
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post 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)
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Post Reply