About Leadwerks 3D World Studio Exported Map

Community Forums/Developer Stations/About Leadwerks 3D World Studio Exported Map

Mortiis(Posted 2008) [#1]
Is it possible to call an UpdateNormals recursively for a 3D World Studio exported b3d map.

I tried this but it's giving me a memory access violation.

	Function UpdateNormalsRecursive( entity )
		UpdateNormals entity
		
		For c = 1 To CountChildren( entity )
			UpdateNormals GetChild( entity, c )
		Next	
	End Function



fredborg(Posted 2008) [#2]
Try something like this:
	Function UpdateNormalsRecursive( entity )

If EntityClass(entity) = "Mesh"
		UpdateNormals entity
EndIf

		For c = 1 To CountChildren( entity )
			UpdateNormalsRecursive GetChild( entity, c )
		Next	
	End Function



Mortiis(Posted 2008) [#3]
It doesn't produce any errors but it doesn't update any normals I think. Even it's in B3D format, doesn't 3D World Studio maps have normals?

I'm trying to get Swift Shadow System to cast shadows on 3dws maps with no success.


JoshK(Posted 2008) [#4]
It is probably updating the normals but the materials in the b3d file use lightmaps or vertex colors, so they won't work with hardware lights.


D4NM4N(Posted 2008) [#5]
Possibly you are trying to update normals on a pivot or non mesh??

More like this mabe?


Function RecursivePropertyUpdate(h)
	If EntityClass(h)="Mesh"
            entityfx h,0 
            updatenormals h
	EndIf

	For cc=0 To CountChildren(h)
		chi=GetChild(h,cc)
		If chi RecursivePropertyUpdate(chi)
	Next
End Function

Lightmapping/fullbright could be another problem


EDIT:

lol, ok fredborg got there first (by 3 days! :P) teach me not to post and scanread when in a real rush.

Still, what happens when you include the entityFX not to fullbright + vertex color into the mix, (added to code=)


Mortiis(Posted 2008) [#6]
Oh I forgot to post that I've sorted out the problem. My bad. I also used fredborg's code for a start. Thanks everyone.