Jump to content
  • Advertisement
Sign in to follow this  

help with gemorphing

This topic is 4383 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

im trying to get geomorphing working in my program... im using the algorithm described in röttgers paper... everything looks fine expt when the morphing ocurs where to different detillevels meet... röttger says in his paper "the blending value for a shared edge is obtained by taking th eminimum of the blending values of the two involved blocks"... i dont rly understand is important sentence.. right now im taking the minimum blending value of the current node and its neighbour in the directing from the center to the current morphed vertex... blending for right fan vertex = min(node(x,z), node(x+nodesize,z)) which works fine until the neighbouring vertex one or more child and less than 4... since the child has a corner in the morphing vertex its corner vertex isnt morphed... my question is how do i take the neighbours child into account?
|\   /|\  /|
| \ / | \/ |
| / \ | /\ |
|/   \|/  \|

doesnt work:
|\   /|\  /|
| \ / | \/ |
| / \ |\/\ |
|/   \|/\ \|

here is the sourcecode for rendering a leaf node:
// BMatrix = Blendingfactors (= min(max(0,2*(1-f)), 1);)

		if (!(Matrix[GetIndex(x+ChildOffset, z+ChildOffset)] || Matrix[GetIndex(x+ChildOffset, z-ChildOffset)] || Matrix[GetIndex(x-ChildOffset, z-ChildOffset)] || Matrix[GetIndex(x-ChildOffset, z+ChildOffset)]))
			glBegin( GL_TRIANGLE_FAN );
			Height = (GetHeight(x+ChildEdgeSize,z+ChildEdgeSize)+GetHeight(x-ChildEdgeSize,z-ChildEdgeSize)+
				     GetHeight(x+ChildEdgeSize,z+ChildEdgeSize)+GetHeight(x-ChildEdgeSize,z-ChildEdgeSize))/4.0f*(1-BMatrix[GetIndex(x, z)])+
					 GetHeight(x,z)*BMatrix[GetIndex(x, z)];

			// CENTER
			RenderVertex(x, z, Height);

			// TOP RIGHT	
			RenderVertex(x+ChildEdgeSize, z+ChildEdgeSize);

			if ( (x+EdgeSize) <= m_size && Matrix[GetIndex(x+EdgeSize, z)])
				Blend = min(BMatrix[GetIndex(x, z)],BMatrix[GetIndex(x+EdgeSize, z)]);
				Height = (GetHeight(x+ChildEdgeSize,z+ChildEdgeSize)+GetHeight(x+ChildEdgeSize,z-ChildEdgeSize))/2.0f*(1-Blend)+
					 GetHeight(x+ChildEdgeSize, z)*Blend;
				// RIGHT
				RenderVertex(x+ChildEdgeSize, z, Height);

			RenderVertex(x+ChildEdgeSize, z-ChildEdgeSize);
			if ( (z-EdgeSize) > 0 && Matrix[GetIndex(x, z-EdgeSize)])
				Blend = min(BMatrix[GetIndex(x, z)],BMatrix[GetIndex(x, z-EdgeSize)]);
				Height = (GetHeight(x+ChildEdgeSize,z-ChildEdgeSize)+GetHeight(x-ChildEdgeSize,z-ChildEdgeSize))/2.0f*(1-Blend)+
					 GetHeight(x, z-ChildEdgeSize)*Blend;
				// BOTTOM
				RenderVertex(x, z-ChildEdgeSize, Height);

			RenderVertex(x-ChildEdgeSize, z-ChildEdgeSize);

			if ( (x-EdgeSize) > 0 && Matrix[GetIndex(x-EdgeSize, z)])
				Blend = min(BMatrix[GetIndex(x, z)],BMatrix[GetIndex(x-EdgeSize, z)]);
				Height = (GetHeight(x-ChildEdgeSize,z+ChildEdgeSize)+GetHeight(x-ChildEdgeSize,z-ChildEdgeSize))/2.0f*(1-Blend)+
					 GetHeight(x-ChildEdgeSize, z)*Blend;
				// LEFT
				RenderVertex(x-ChildEdgeSize, z, Height);

			// TOP LEFT
			RenderVertex(x-ChildEdgeSize, z+ChildEdgeSize);

			if ( (z+EdgeSize) <= m_size && Matrix[GetIndex(x, z+EdgeSize)])
				Blend = min(BMatrix[GetIndex(x, z)],BMatrix[GetIndex(x, z+EdgeSize)]);
				Height = (GetHeight(x+ChildEdgeSize,z+ChildEdgeSize)+GetHeight(x-ChildEdgeSize,z+ChildEdgeSize))/2.0f*(1-Blend)+
					 GetHeight(x, z+ChildEdgeSize)*Blend;
				// TOP
				RenderVertex(x, z+ChildEdgeSize, Height);

			// TOP RIGHT	
			RenderVertex(x+ChildEdgeSize, z+ChildEdgeSize);


i hope atleast someone understood... if there is something ive written unclear please tell me and ill try to sort it out... [Edited by - Dragon_Strike on July 21, 2006 12:01:20 AM]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!