# 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.

## 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?
works:
|\   /|\  /|
| \ / | \/ |
| / \ | /\ |
|/   \|/  \|

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);
}

// BOTTOM RIGHT
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);
}

// BOTTOM LEFT
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);

glEnd();

}


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]

1. 1
Rutin
24
2. 2
3. 3
4. 4
JoeJ
18
5. 5

• 14
• 19
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631761
• Total Posts
3002179
×