Creating custom polygon normals
-
On 09/02/2018 at 03:10, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R19
Platform: Windows ;
Language(s) : C++ ;---------
I know that I can callVector32* normalsVal = m_actual_obj->CreatePhongNormals();
for (int f = 0; f < m_actual_obj->GetPolygonCount(); f++) {
normalsVal[f * 4 + 0] = Vector32(0, 1, 0);
normalsVal[f * 4 + 1] = Vector32(0, 1, 0);
normalsVal[f * 4 + 2] = Vector32(0, 1, 0);
normalsVal[f * 4 + 3] = Vector32(0, 1, 0);
}
DeleteMem(normalsVal);But it drives me to a weird effect it still looks smooth (it is a human character) and the normal maps looks ok on the viewport and inverted on the render, or if I switch the normalmap channels that effect is switched (ok on the render but wrong on the viewport)
Is there any other way to define the normals of my polygon object manually?
-
On 12/02/2018 at 05:02, xxxxxxxx wrote:
Hi,
actually the way to go here is the use of a NormalTag. See also our NormalTag manual.
-
On 13/02/2018 at 00:17, xxxxxxxx wrote:
Thank you I figured that but unfortunatly after implementing that solution the problem persists.
It seems to be related on how tangents and binormals are constructed inside C4D, I cannot manage to have normalmaps on viewport and render working ok, they always seem to be inverted in one of them (ok on viewport and wrong on render or viceversa)
Regards, Víctor
-
On 13/02/2018 at 05:12, xxxxxxxx wrote:
Hello,
can you provide us with more of your code? We have no idea yet, what's going on or where the cause of the issue could be located.
-
On 14/02/2018 at 04:31, xxxxxxxx wrote:
Unfortunatly I cannot share the code since it is related to a commercial project.
I've faced this problem in the past in OpenGL when the UV tangents/binormals were not properly set but obviously I have no control over them in C4D.
I'm just creating a polyobject and placing there the uvs, they look ok (diffuse etc are sharing the same uv channel) but the normals seems to be inverted.
-
On 16/02/2018 at 02:09, xxxxxxxx wrote:
As it was expected "Use UVW for Bump" fixes this effect but I'm not sure if it could affect third party renderers.