water surface

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
powerpop
Posts: 171
Joined: Thu Jan 08, 2004 1:39 am
Location: san francisco

water surface

Post by powerpop »

first, a silly thing - i noticed in the source for CSceneNode that the variable wavelength is spelled wrong throughout the code - its spelled at wavelenght

and i am puzzled why the water surface is a scenenode rather than an animator? seems like having it as a scenenode requires that it do processing during every frame - and really it doesnt need to to be realistic on fast cards - wouldnt it be better as an animator so that the game developer could decide how often to update the surface?

and one last thing - i have a modification that will make raindrops instead of waves on the surface - niko, would you want this mod? - it requires slightly different input variable than the wave surface - there are two ways this could be done:

- make it a separate node type with its own input (downside is that if you want to have waves and rain you have two copies of the mesh manipulator and two updates)

- add it to the current surface and add the extra paramaters (downside is the current api changes - upside is that you can have rain or waves or both in one call)


-----

also, i am new so this may be a stupid question - but what does the
->drop do to an object - reason i ask is that in CWaterSurfaceNode when it gets destroyed it calls OriginalMesh->drop which i found puzzling - is this just getting rid of a reference (its certainly not deleting OriginalMesh since that would be a bug - the water surface has its own copy of the surface mesh) - so what is drop doing exactly?
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Yes, sorry, I'm always spelling 'lenght' the wrong way - I bet you'll find this mistake in other places in the code as well. Sorry :)

I like the idea of making the water scene node an animator. The animator would only work with scene nodes which give access to their meshes, but why not. :)

A raindrop - mod? Sounds cool, just send it :)
I would prefer a new parameter in the scene node. Another solution would be to simply add a parameter to the factory method of the scene manager, and then let the manager create the original scene node or a derived one like yours. But it's just a question of taste and design.

The ->drop() call decreases the reference counter of the original mesh. The mesh, which is rendered, is stored in Mesh. It's reference is decreased in the destructor of the super class.
powerpop
Posts: 171
Joined: Thu Jan 08, 2004 1:39 am
Location: san francisco

Post by powerpop »

after looking at your water surface more closely i see rain is quite a bit different - for your waves you can just make a copy of the mesh and use the original as a reference to smooth the surface as waves move - problem with rain ripples is that the surface has to be updated in one pass without changes effecting other parts of the ripple - so that mean i have to make two arrays - one for the last pass and one for the current -its how i had to do it in flatland as well - so really, watersurface doesnt share much internally with rain - so best if i keep them separate

i think i will make raindrops an animator - one question on those - it seems they take in a node and time each cycle they are called - so in that regard they are stateless - things like the raindrops and the water surface will want to hold state about the node they are manipulating - should i subclass the animator and include a node variable on the constructor so that it can hold onto the mesh and other state information between calls?
keless
Posts: 805
Joined: Mon Dec 15, 2003 10:37 pm
Location: Los Angeles, California, USA

Post by keless »

i'd sub-class the animator, and let it expect only a certain type of scene node (wavescene, or rainscene) which will offer its data to the wave/rain animator (ie: 'friend class rainscene;')

then document this above the function call.
a screen cap is worth 0x100000 DWORDS
powerpop
Posts: 171
Joined: Thu Jan 08, 2004 1:39 am
Location: san francisco

Post by powerpop »

that seems awkward - the new scene type holds the state data - and the rain animator has all the code to manipulate that data (not likely that anyone else would ever use either of them) - i think i would rather make an animator type that knows about state and keep the code and data together - thanks for the suggestion though
mariusz_p
Posts: 15
Joined: Tue Jan 06, 2004 9:37 pm

Post by mariusz_p »

I hope that You will make demo to show Your's raindrops in action :) I would like to see it. Actually i don't need theese in my project but who knows what the future will bring :)

btw: Niko are You going to implement per pixel and per vertex lighting in irrich? Or maybe it's already implemented and i didn't found this :)
Yoshiko
Posts: 17
Joined: Mon Feb 23, 2009 7:04 pm

Post by Yoshiko »

How to write it in irrXML?
I tried like this:

Code: Select all

	<node type="waterSurface">

		<attributes>
			<string name="Name" value="" />
			<int name="Id" value="-1" />
			<vector3d name="Position" value="0.000000, 10.000000, 10.000000" />
			<vector3d name="Rotation" value="0.000000, 0.000000, 0.000000" />
			<vector3d name="Scale" value="1.000000, 1.000000, 1.000000" />
			<bool name="Visible" value="true" />
			<enum name="AutomaticCulling" value="box" />
			<int name="DebugDataVisible" value="0" />
			<bool name="IsDebugObject" value="false" />
			<float name="waveHeight " value="2.000000" />
			<float name="waveSpeed " value="200.000000" />
			<float name="waveLength " value="10.000000" />
		</attributes>

		<materials>
			<attributes>
				<enum name="Type" value="solid" />
				<color name="Ambient" value="ffffffff" />
				<color name="Diffuse" value="ffffffff" />
				<color name="Emissive" value="00000000" />
				<color name="Specular" value="ffffffff" />
				<float name="Shininess" value="0.000000" />
				<float name="Param1" value="0.000000" />
				<float name="Param2" value="0.000000" />
				<texture name="Texture1" value="../../media/rockwall.bmp" />
				<texture name="Texture2" value="" />
				<texture name="Texture3" value="" />
				<texture name="Texture4" value="" />
				<bool name="Wireframe" value="false" />
				<bool name="GouraudShading" value="true" />
				<bool name="Lighting" value="false" />
				<bool name="ZWriteEnable" value="true" />
				<int name="ZBuffer" value="1" />
				<bool name="BackfaceCulling" value="false" />
				<bool name="FogEnable" value="false" />
				<bool name="NormalizeNormals" value="false" />
				<bool name="BilinearFilter1" value="true" />
				<bool name="BilinearFilter2" value="true" />
				<bool name="BilinearFilter3" value="true" />
				<bool name="BilinearFilter4" value="true" />
				<bool name="TrilinearFilter1" value="false" />
				<bool name="TrilinearFilter2" value="false" />
				<bool name="TrilinearFilter3" value="false" />
				<bool name="TrilinearFilter4" value="false" />
				<bool name="AnisotropicFilter1" value="false" />
				<bool name="AnisotropicFilter2" value="false" />
				<bool name="AnisotropicFilter3" value="false" />
				<bool name="AnisotropicFilter4" value="false" />
				<enum name="TextureWrap1" value="texture_clamp_repeat" />
				<enum name="TextureWrap2" value="texture_clamp_repeat" />
				<enum name="TextureWrap3" value="texture_clamp_repeat" />
				<enum name="TextureWrap4" value="texture_clamp_repeat" />
			</attributes>
		</materials>
	</node>
But nothing.
FuzzYspo0N
Posts: 914
Joined: Fri Aug 03, 2007 12:43 pm
Location: South Africa
Contact:

Post by FuzzYspo0N »

Posted: Wed Jan 14, 2004

Thats a long time ago!
Yoshiko
Posts: 17
Joined: Mon Feb 23, 2009 7:04 pm

So what!

Post by Yoshiko »

Irrlicht Engine start at 2003 year. So what...
In topic http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=35029 Im posted too and... nothing.
Feature WaterSurface in irrlicht is dead?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

No, should work as expected as you've written. However, you must not use meshes that use CSkinnedMesh as a base. At least no until Irrlicht 1.6, which fixes this problem.
Post Reply