UpdateNormals ????***

Blitz3D Forums/Blitz3D Programming/UpdateNormals ????***

I coded an UpdateNormals <mesh> at the end of the function who create the vertex for the mesh and it doesn't work, damn, i can't see any shadows... i can't understand why...

shadows?
What type of shadows are you exactly talking of?
it is only a little vertex coloring

btw
Did you perhaps use the fullbright EntityFX flag?

Function makeemptymap()
	l=CreateLight()
	PositionEntity l,400,200,-400
	ground=CreateMesh()
	For cx=0 To nbcasex
	For cy=0 To nbcasey		
	s.surface=New surface
	s\surface=CreateSurface(ground)
	xx=cx*casew
	yy=cy*caseh
		For cw=xx To xx+casew Step 2*tile
		For ch=yy To yy+caseh Step 2*tile
			
			v00=fAddVertex(s\surface,cw,ch,0)
			v10=fAddVertex(s\surface,cw+tile,ch,0)
			v01=fAddVertex(s\surface,cw,ch+tile,0)
			
			
			v20=fAddVertex(s\surface,cw+2*tile,ch,0)
			v21=fAddVertex(s\surface,cw+2*tile,ch+tile,0)
			
			v02=fAddVertex(s\surface,cw,ch+2*tile,0)
			v12=fAddVertex(s\surface,cw+tile,ch+2*tile,0)
			v22=fAddVertex(s\surface,cw+2*tile,ch+2*tile,0)
			
			AddTriangle s\surface,v10,v00,v01
			AddTriangle s\surface,v10,v21,v20
			AddTriangle s\surface,v02,v12,v01
			AddTriangle s\surface,v12,v22,v21
			
		Next
		Next
	
	
	Next
	Next

	
	EntityFX ground,2
	UpdateNormals ground
End Function

Function faddvertex(surf,x,y,z)
	v.vertex=New vertex
	v\x=x
	v\y=y
	v\z=z
	v\surface=surf
	v\vertex=AddVertex(surf,x,y,z)
	Return v\vertex
End Function


------------------------------------------------
I reviewed my code and in the old one, the shadows are working good... it's
Function initmap()
For casex=0 To nbcasex
For casey=0 To nbcasey

	ground(caseX,caseY,0)=CreateMesh()
	;EntityColor ground(caseX,caseY,0),Rand(255),Rand(255),Rand(255) COMMENT METTRE DES COLORS OU TEXTURE, PLZ
	ground(caseX,caseY,1)=CreateSurface(ground(caseX,caseY,0))
	;TurnEntity ground(caseX,caseY,0),-180,0,0
	
	PositionEntity ground(caseX,caseY,0),casex*mapw,casey*maph,10

	For gx=0 To mapw Step tile
	For gy=0 To maph Step tile
		vertex(caseX,caseY,gx,gy,1)=Rand(6); Relief du vertex
		vertex(caseX,caseY,gx,gy,0)=AddVertex(ground(caseX,caseY,1),gx,gy,vertex(caseX,caseY,gx,gy,1))
	Next
	Next 

	For gx=0 To mapw-tile Step tile
	For gy=0 To maph-tile Step tile
		AddTriangle(ground(caseX,caseY,1),vertex(caseX,caseY,gx,gy,0),vertex(caseX,caseY,gx+tile,gy,0),vertex(caseX,caseY,gx+tile,gy+tile,0))
		AddTriangle(ground(caseX,caseY,1),vertex(caseX,caseY,gx,gy+tile,0),vertex(caseX,caseY,gx,gy,0),vertex(caseX,caseY,gx+tile,gy+tile,0))
		
	Next
	Next 
	
	FlipMesh  ground(caseX,caseY,0)
	EntityFX ground(caseX,caseY,0),2
	;ground(caseX,caseY,3)=LoadTexture("texture/1mud.bmp")
	;ground(caseX,caseY,2)=CreateBrush();LoadBrush("texture/1mud.bmp");
	;BrushTexture ground(caseX,caseY,2),ground(caseX,caseY,3)
	;PaintMesh ground(caseX,caseY,0),ground(caseX,caseY,2)
	; ME renseinger Sur les textures et les mesh +
	; + Textures dynamiques
	;+ Comment les sauver....
	
	UpdateNormals ground(caseX,caseY,0)
	Next
	Next
End Function

hehehehe

Use the [code] [/code[ or the [codebox] [/codebox[ commands for displaying code.

er i don't remember anything in html i only use code twice. sorry

maybe your shadow mesh is faceing towards the ground?
try
EntityFX ground,2 or 16

to make it two-sided to check this out.

nope it doesn't work...

why did you use a flipmesh on the ground? chaning 2nd and 3rd vertex in the addtriangle command has the same effect and saves time :)

You say the first code worked but not the 2nd, right?
Is there any Lightsource in the whole source with part 2?
Do you modify the vertexcolors outside this function? ( you used VertexColor FX so I think you are doing something with it ) because the shading is done over vertex colors so if you modify the vertex color the shading is gone.

the first was an error, i din't notice 'bout the ...clocksmthing rotation...]]

there s a light source in my second code and i don't modify the color of the vertex...

if you don't modify vertex colors, comment out the EntityFX ground, 2 part and look if the "shadow" returns.

I never tried if it actually has any effect as I never used any entity FX flags when I didn't need them.

this FX is the only real difference between the 2 functions

0k thanks anyway...