Question

I want to draw a triangle shape over a 3d head model.

I have tried with drawing the triangle on the texture and applied it over the 3d model. But it will not help completely. When texture render on the 3d model, it get stretch.

CC3MeshNode *tnode = [avatar getMeshNodeNamed:@"polySurface1-submesh0"];
tnode.material.isOpaque=YES; //set alpha value 

tnode.material.sourceBlend=GL_SRC_ALPHA;
tnode.material.destinationBlend=GL_ONE_MINUS_SRC_ALPHA;

CC3Texture *texture = nil;
texture = [[CC3Texture alloc] initFromFile:@"hairbuilder.png"]; //create texture image that added with the shape. 

[tnode.material addTexture:texture];

[texture release];

Is there any way to draw shape directly over the 3d model

enter image description here

Was it helpful?

Solution

I think you should look at Projective Texture Mapping, which is often used to render decals, like bullet holes on objects. With this technique you'll be able to draw your triangle with selected size and orientation.

Here're few other links that can help you:

http://www.ozone3d.net/tutorials/glsl_texturing_p08.php

http://blog.wolfire.com/2009/06/how-to-project-decals/

http://broniac.blogspot.com/2011/06/deferred-decals.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top