Blood & Water Effects [Irrlicht 1.7.1]

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.

Postby jorgerosa » Fri Sep 10, 2010 2:43 am

Bate wrote:The CLIP_PLANE_OFFSET is meant to be used for slight adjustments only, which means it should be kept close to 0 (exactly 0 at best)...
Ok, thankyou for the advice. I had no idea that affect the Y axis. I have a light now. Anyways I´ll try some code and change other values in the main code and shaders to see if I can workaround with this. :)
User avatar
jorgerosa
Competition winner
 
Posts: 91
Joined: Wed Jun 30, 2010 8:44 am
Location: Portugal

Postby jorgerosa » Wed Sep 15, 2010 10:49 am

Ok, after a few days everything goes great so far. Irrlicht is amazing indeed, every past day I find great irrlicht functions, that I dunno. I can see with a bit of imagination and irrlicht, there is nothing that you cant do. I´ve solved transparency and many other issues. (Not irrlicht issues, but only a newbie issues as is the firsts steps on it).

Image

The water shaders do their work great!
HELP: There is a way to do NOT reflex some nodes? (In the case I want to hide/remove texts and lensflare reflexions, I´ve been trying with no luck)
User avatar
jorgerosa
Competition winner
 
Posts: 91
Joined: Wed Jun 30, 2010 8:44 am
Location: Portugal

Postby Bate » Wed Sep 15, 2010 6:49 pm

in OnAnimate() right before SceneManager->drawAll() simply set all nodes that shouldn't reflect invisible and afterwards visible again.

You probably wanna add a member array of scenenodes to be excluded.
Never take advice from someone who likes to give advice, so take my advice and don't take it.
User avatar
Bate
 
Posts: 364
Joined: Sun Nov 01, 2009 11:39 pm
Location: Germany

Postby hybrid » Wed Sep 15, 2010 8:17 pm

You might even separate them into two scene managers, which makes work sometimes much simpler.
hybrid
Admin
 
Posts: 13943
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany

Postby Krad » Tue Oct 12, 2010 6:23 pm

could you upload to another site, I can't download from google
thnx
Krad
 
Posts: 2
Joined: Thu Oct 16, 2008 9:30 am

Postby Bate » Tue Oct 12, 2010 11:40 pm

You can also find it in IrrExt:

http://irrext.svn.sourceforge.net/viewvc/irrext/
Never take advice from someone who likes to give advice, so take my advice and don't take it.
User avatar
Bate
 
Posts: 364
Joined: Sun Nov 01, 2009 11:39 pm
Location: Germany

Postby RaverGames » Wed Oct 13, 2010 2:45 pm

Wow thanks the Code is very helpful :)
RaverGames
 
Posts: 17
Joined: Sat Sep 25, 2010 8:54 am

Postby SG57 » Sun Dec 19, 2010 5:13 am

hmm... I'm having issues with the GLSH shaders for the Blood effect.. It works - but while any of the blood effects are active, my skybox/dome has 'fog' enabled which makes it turn colors. Same with the particle system itself, all the particles have the fog color'd background. I can't figure out why it's toggling the skybox fog enabled on/off, and why it wont be transparent... My code is the default stuff.

EDIT

Wait a minute, upon closer inspection that isnt my skybox fog being toggled, it's just a giant yellowish circle that takes up the entire back buffer (rendered on top of the skybox, but before everything else). Something to do with world projection or?
__________________________________
...you'll never know what it's like, living your whole life in a dream...
User avatar
SG57
 
Posts: 66
Joined: Fri May 18, 2007 5:51 am

Postby Valor » Sun Dec 26, 2010 6:22 am

The orginal post code download iis for opengl now but isn't changed in the main so you have to change this line if you want the water to show up correctly from the op.
deviceParams.DriverType = EDT_OPENGL;
Valor
 
Posts: 40
Joined: Fri Jul 30, 2010 1:20 pm

Postby Atraitus » Wed Jan 05, 2011 5:43 pm

Okay, so I successfully got this implemented in my scene, and it looks great -- until I try to move it. As long as I just move it up and down, it continues to work. If I try to move its position, it does this:
Image
It will flicker as I move and turn the camera, fluctuating between the blue and the grey seen in the picture, with no reflectivity. I don't really understand why this is happening, as all I did was change its position. I tried moving the reference camera in CWaterSurface.cpp, to no avail. Here's what I have:
Code: Select all
CWaterSurface *waterplane = new CWaterSurface(smgr,vector3df(0,-3590,34147),
511.99,127.99,true,true,dimension2du(512,512),0,-1);

It works when vector3df is set to (0,-3590,0), but not if I change either 0. Yet it works with any value replacing -3590, as long as both of the other values are 0. I'm using Irrlicht 1.7.2, if that makes a difference.
Atraitus
 
Posts: 16
Joined: Sun Jan 02, 2011 11:44 pm

Postby tinhtoitrangtay » Thu Jan 06, 2011 2:30 am

Hi Atraitus
Please, You can upload source code.
tinhtoitrangtay
 
Posts: 70
Joined: Tue Oct 28, 2008 12:59 pm

Postby Atraitus » Thu Jan 06, 2011 6:38 pm

Sure, here's my project folder. This is just a test scene, to get used to the workings of Irrlicht; as such, it's a pretty sloppy mashing together of several tutorials. The project file is for Code::Blocks, and the problematic line is 120 in main.cpp.

http://www.mediafire.com/?f5pcaitcepabbm4
Atraitus
 
Posts: 16
Joined: Sun Jan 02, 2011 11:44 pm

Postby devsh » Thu Jan 06, 2011 7:04 pm

@Aterious:

The bug you are experiencing comes from the design of the water node itself... I bet the node only supports a fully horizontal water surface (that is with the normal 0,1,0 ) and it doesnt use a TRUE reflect() function but merely flips the camera position by doing this

vector3df distance = camera.pos-waterpos;
watercamera.pos = waterpos-distance;

which only works correctly when the X and Z are null, to correct this behaviour

float distance = camera.pos.Y-waterpos.Y;
watercamera.pos.Y = waterpos.Y-distance;
watercamera.pos.XZ = camera.pos.XZ;

Unless the behaviour comes from another thing.... Your camera might be a child of some node, or the water could. Check if the positions used are not ->getPosition() but ->getAbsolutePosition()
Portfolio (WIP) and Development Blog:
http://indirectlightandmagic.tumblr.com/

Do you want to hire a GLSL graphics programmer cheaply???
Try me!
http://indirectlightandmagic.tumblr.com/contact
User avatar
devsh
Competition winner
 
Posts: 1303
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK

Postby Atraitus » Tue Jan 11, 2011 3:16 am

Sorry I didn't reply earlier; today was the first day I had a chance to work on this. I've tried various permutations of

Code: Select all
float distance = camera.pos.Y-waterpos.Y;
watercamera.pos.Y = waterpos.Y-distance;
watercamera.pos.XZ = camera.pos.XZ;


(changed to suit my code, of course), and nothing I tried has worked after about three hours of working on it. Finally, I've just moved everything else in my scene by -37147. That's annoying to do, of course. In the first post, Bate states that this scene node is "...movable, scalable and works with parents", however, I've not found this to be the case at all. I've not worked with parents with it, and it is definitely scalable, but it doesn't seem to be movable except in the vertical, no matter what I do.
Atraitus
 
Posts: 16
Joined: Sun Jan 02, 2011 11:44 pm

Postby jorgerosa » Wed Jan 19, 2011 1:42 am

Bate wrote:in OnAnimate() right before SceneManager->drawAll() simply set all nodes that shouldn't reflect invisible and afterwards visible again. You probably wanna add a member array of scenenodes to be excluded.

hybrid wrote:You might even separate them into two scene managers, which makes work sometimes much simpler.


Thankyou all for the tips! Got it! It is working like i want to, now! :)
Last edited by jorgerosa on Tue May 08, 2012 8:46 pm, edited 2 times in total.
User avatar
jorgerosa
Competition winner
 
Posts: 91
Joined: Wed Jun 30, 2010 8:44 am
Location: Portugal

PreviousNext

Return to Code Snippets

Who is online

Users browsing this forum: No registered users and 0 guests