Water not working right.

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
disanti
Posts: 367
Joined: Sat Jan 17, 2004 1:36 am
Location: California, US
Contact:

Water not working right.

Post by disanti »

I have this code:

Code: Select all

	watermesh = smgr->addHillPlaneMesh("animatedwater",
		core::dimension2d<f32>(100,100),
		core::dimension2d<s32>(15,15), 0, 0,
		core::dimension2d<f32>(0,0),
		core::dimension2d<f32>(10,10));

	waternode = smgr->addWaterSurfaceSceneNode(watermesh->getMesh(0), 3.0f, 300.0f, 30.0f);
	waternode->setPosition(core::vector3df(-500,-140,-920));

	mmanipulator->setVertexColorAlpha(watermesh->getMesh(0),10);

	waternode->setMaterialType(EMT_REFLECTION_2_LAYER);

	waternode->setMaterialTexture(0,watertexture);
	waternode->setMaterialTexture(1,watertexture);

	waternode->setAutomaticCulling(false); 
The water comes out black and not semi-transparent. What is wrong?
It says in the console that the water texture is successfully loaded. :?

Thanks ~ John DiSanti
________
Daihatsu Rocky
Last edited by disanti on Tue Feb 22, 2011 8:01 am, edited 1 time in total.
thesmileman
Posts: 360
Joined: Tue Feb 10, 2004 2:20 am
Location: Lubbock, TX

Post by thesmileman »

Do you have any lights in your scene?

also check if dynamic lighting is enabled or disabled.

If you are going to use the same texture for the second texture there is not need. Usually you put for the second texture what whould be at the bottom of the water.
disanti
Posts: 367
Joined: Sat Jan 17, 2004 1:36 am
Location: California, US
Contact:

Post by disanti »

Well, I would like the water transparent and visible from both the top and bottum but I don't know how to do that! :oops:

I have two lights, they are a bit far away from the water but they don't seem to effect the level mesh at all! WHY?! I want my lights to work!

My level mesh has EMF_LIGHTING set to true.
levelnode->setMaterialFlag(video::EMF_LIGHTING, true);

What do you mean by dynamic lighting?

Thanks!
________
HERBALAIRE VAPORIZER
Last edited by disanti on Tue Feb 22, 2011 8:01 am, edited 1 time in total.
disanti
Posts: 367
Joined: Sat Jan 17, 2004 1:36 am
Location: California, US
Contact:

Post by disanti »

Alright, I put a light over the water and it isn't black anymore! :D

Now how do I make it semi-transparent and so that it doesn't backface-cull?
________
Catastrophe bond forums
Last edited by disanti on Tue Feb 22, 2011 8:01 am, edited 1 time in total.
deps
Posts: 115
Joined: Sat Jan 10, 2004 5:22 pm
Location: Tranås, Sweden

Post by deps »

To turn culling off:
waternode->setAutomaticCulling (false);
disanti
Posts: 367
Joined: Sat Jan 17, 2004 1:36 am
Location: California, US
Contact:

Post by disanti »

deps, I already have that if you look at the source above! :(

Ok got the water to be semi-transparent my making the material a "transparent add color". :)

Works great. I just wish the lighting of my level would work right. :P
________
Dc marijuana dispensaries
Post Reply