Model outlinerendering

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
white
Gnoblar
Posts: 2
Joined: Thu Dec 17, 2020 1:54 pm

Model outlinerendering

Post by white »

I want to render the outline of the text model,and Get the vertex of the text through freetype, and successfully load the text
but Rendered outline but it is not expected,here is my frag demo

Code: Select all

#version 330

//uniform mat4 modelMatrix;
uniform mat4 modelViewMatrix;
uniform mat4 worldViewMatrix;
uniform mat4 projectionMatrix;
uniform mat4 normalMatrix;

in vec4 position;
in vec3 normal;

void main()
{
	// Use standardise transform, so work accord with render system specific (RS depth, requires texture flipping, etc)
	vec4 mypos = modelViewMatrix * vec4(position.xyz + normal*10 ,1.0);
    gl_Position = projectionMatrix * mypos;
}
I hope some friends can provide me with ideas, thank you
Image
Hilarius86
Halfling
Posts: 48
Joined: Thu Feb 14, 2019 11:27 am
x 8

Re: Model outlinerendering

Post by Hilarius86 »

I also tried silhouette rendering some time ago and wasn’t happy with the “normal times offset” approach. If you really want a visually satisfying image, you would need to set the offset value dynamically by camera distance. Next rabbit hole will be that the offset would need to be specific for every vertex / edge. Next problem is corners. At the moment you are only moving the faces, so in corners you will see gaps as your faces aren’t magnified.

Next stop was using a scaled version of the original object. You first draw the scaled one and afterwards you draw the real one, resulting in kind of a silhouette. Sadly, this is also not working with arbitrary shapes very well.

What I tried last was a postprocessing approach where you render your object once normally into a texture and filter it in a later pass using an edge detector like Canny. You would test object pixel against background pixel and depending on the result you would pick the colour from your texture or set a specified edge colour.

Sadly, I used the same prototype for various ideas and at the moment the prototype doesn’t reflect outline rendering anymore.
white
Gnoblar
Posts: 2
Joined: Thu Dec 17, 2020 1:54 pm

Re: Model outlinerendering

Post by white »

Thank you for your reply. I have found the problem for me. The outline provided by freetype does not provide the normal vector of the edge, and what I obtained before is the normal vector of the triangle. The actual requirement is the normal vector of the contour. I will also Try what you said about Canny edge detection, but also consider the real-time performance of this detection
Post Reply