C4D : problems with normals

Hello,
I’m really disconcerted by a conversion problem from Cinema4D.

Like the joined image, normals invert themselves after integration in Unity.

I unchecked “Automatically calculate normals” but I still have “holes”.

My meshes are correct, aligned normals, apparently all good. I tried to export in fbx and I opened the file in Cheetah. All is good. I imported this fbx in Unity, there are always this “holes”
Did someone have the same problem and resolve ?

Thank you.

45788--1663--$trees_202.png

Found !

It is the shader that I used.
This is the “Vegetation Vertex Lit” shader.
Its advantage is a better luminosity than the “Vegetation Two Pass”. It accepts lights like the “simple” Diffuse Shader.

But that makes holes…

Both c4d and cheetah display polygons double sided and you have to manually turn on back face culling in those apps to see backfacing normals.

Vegetation two pass shaders draws double sided, since it is much more convenient for leaves and grass to use double sided.

Other shaders do not draw double sided (for performance reasons), thus you want to make sure that your normals are correct.

Thank you for your post Joachim.

So, it’s the method that I use to modelise in C4D. In fact, the Vegetation 2 pass shader is nice but too dark.

But I mixed code with another and now I have a 2-sided single pass shader which makes no holes and suitably receives luminosity.

here is the code :

Shader "Alpha/VertexLit 2-sided" {
	Properties {
		_Color ("Main Color", Color) = (1,1,1,0.5)
		_SpecColor ("Spec Color", Color) = (1,1,1,0)
		_Emission ("Emmisive Color", Color) = (0,0,0,0)
		_Shininess ("Shininess", Range (0.1, 1)) = 0.7
		_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
		_Cutoff ("Base Alpha cutoff", Range (0,.9)) = .5
	}

	Category {
		ZWrite On
		Cull Off
		AlphaTest Greater [_Cutoff]
		Tags {Queue=Transparent}
		Blend SrcAlpha OneMinusSrcAlpha 
		ColorMask RGB
		SubShader {
			Material {
				Diffuse [_Color]
				Ambient [_Color]
				Shininess [_Shininess]
				Specular [_SpecColor]
				Emission [_Emission]	
			}
			Pass {
				Lighting On
				SeperateSpecular On
				SetTexture [_MainTex] {
					constantColor [_Color]
					Combine texture * primary DOUBLE, texture * constant 
				} 
			}
		} 
	}
}

May be it’s a half-solution (I need to learn more) but that works. :slight_smile:

Of course you can make a double sided shader and that will work around the problem. But it’s not fixing the problem at the root and you sacrifice performance while doing it.
But then again if you got the double sided shader already and it works… Good enough.

Ok but I think my meshes are very clean. So I don’t know what is the problem to fix apart from the shader.

To have a two pass shader which have a good luminosity like “simple diffuse” shader, I searched in the forum and tried to understand with my school english :wink: and I did’nt find the solution.

So… :slight_smile:

try to subdivide or
triangulate the problem areas

Norby

I had tried but no results.
Thank you :slight_smile:

So you’ve tried flipping the normals?
AC

Would you mind sending me one of those trees? I might be able to help if I could see the topology.

Thank you all ! What a nice community ! :slight_smile:

Targos : I checked if normals were not inversed and all is OK.

wadamw : Here is a zip file which contains .c4d and .fbx and the texture. Thank you very much !

45994–1668–$arbre5_949.zip (463 KB)

No Holes here
seems to be ok
normals are in the right direction.
just used native .CD file not the FBX one

these are my settings
Mesh scale Factor 0.01
Automatically calculate normals
smoothing angle is 60

Norby

I believe it’s really the “Vegetation Vertex Lit” shader that generates the problem.

Strange when it works with others meshes…

Thank you again Norby :slight_smile:

Yes

that’s the problem
look at the picture
this is with vertex lit

Norby

Exactly that !
It’s crazy :shock:

I forgot to say I isolated the problem with another mesh, a simple cube which I applied the texture with “Vegetation Vertex Lit”.

May be this topic should migrate in the shader forum ? ^^

As far as I know, C4D displays double sided polygons in the viewport. Is there somewhere an option to turn “backface culling” on in C4D?

Yes Aras.
In the viewport, there is “Display > Disable Backface Culling” to check or uncheck.