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.
jorgerosa
Competition winner
Posts: 117
Joined: Wed Jun 30, 2010 8:44 am
Location: Portugal
Contact:

Post by jorgerosa »

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. :)
jorgerosa
Competition winner
Posts: 117
Joined: Wed Jun 30, 2010 8:44 am
Location: Portugal
Contact:

Post by jorgerosa »

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)
Bate
Posts: 364
Joined: Sun Nov 01, 2009 11:39 pm
Location: Germany

Post by Bate »

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.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You might even separate them into two scene managers, which makes work sometimes much simpler.
Krad
Posts: 2
Joined: Thu Oct 16, 2008 9:30 am

Post by Krad »

could you upload to another site, I can't download from google
thnx
Bate
Posts: 364
Joined: Sun Nov 01, 2009 11:39 pm
Location: Germany

Post by Bate »

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.
RaverGames
Posts: 17
Joined: Sat Sep 25, 2010 8:54 am

Post by RaverGames »

Wow thanks the Code is very helpful :)
SG57
Posts: 66
Joined: Fri May 18, 2007 5:51 am

Post by SG57 »

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...
Valor
Posts: 40
Joined: Fri Jul 30, 2010 1:20 pm

Post by Valor »

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;
Atraitus
Posts: 16
Joined: Sun Jan 02, 2011 11:44 pm

Post by Atraitus »

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.
tinhtoitrangtay
Posts: 70
Joined: Tue Oct 28, 2008 12:59 pm

Post by tinhtoitrangtay »

Hi Atraitus
Please, You can upload source code.
Atraitus
Posts: 16
Joined: Sun Jan 02, 2011 11:44 pm

Post by Atraitus »

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
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Post by devsh »

@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()
Atraitus
Posts: 16
Joined: Sun Jan 02, 2011 11:44 pm

Post by Atraitus »

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.
jorgerosa
Competition winner
Posts: 117
Joined: Wed Jun 30, 2010 8:44 am
Location: Portugal
Contact:

Post by jorgerosa »

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.
Post Reply