*BUG* COPYENTITY b3d animmesh strange behaviour?

Archives Forums/Blitz3D Bug Reports/*BUG* COPYENTITY b3d animmesh strange behaviour?

FlagDKT(Posted 2006) [#1]
Copyentity a B3d loadedanimmesh works strange, or maybe there's something I dunno.
Those meshes are made by 2 texture, one of them Alphaed.
When duplicating those meshes, only the last looks right. The firsts don't display Alphaed textures...
Tried with other b3d models too...
Why only the *LAST* copied entity works??

BTW *Masked* flag works correctly...

Include "B3dExtensions.bb"

Global displaywidth=640
Global displayheight=480

Graphics3D displaywidth,displayheight,32,0
SetBuffer BackBuffer()


Global cpos#=-6
Global filemesh$=("castagnola.b3d")

Function SmoothTurn(Entity,entity2,entity3)
	gMXSpeed = gMXSpeed*.9 - MouseXSpeed()*.12
	gMYSpeed = gMYSpeed*.9 + MouseYSpeed()*.12
	AX# = EntityPitch(Entity)
	AY# = EntityYaw(Entity)
	AX = AX + gMYSpeed
	AY = AY + gMXSpeed
	RotateEntity Entity, AX, AY, 0
	RotateEntity Entity2, AX, AY, 0
	RotateEntity Entity3, AX, AY, 0
	MoveMouse GraphicsWidth()/2,GraphicsHeight()/2
End Function

; CAMERA INIT------------------------------------------------------------
	PositionEntity camera,0,0,-6
	CameraProjMode camera,1
	CameraClsColor camera,180,180,180
; -----------------------------------------------------------------------


	mesh=LoadAnimMesh (filemesh)
	mesh1=(CopyEntity (mesh))	MoveEntity(mesh1),1,0,0
	mesh2=(CopyEntity (mesh))	MoveEntity(mesh2),2,0,0

frameTimer = CreateTimer(30)
; MAIN LOOP -------------------------------------------------------------
While Not KeyHit(1)

	PositionEntity camera,0,0,cpos
	PointEntity camera,mesh1
	PointEntity light,mesh
	Select MouseZSpeed ()
	Case -1
	Case 1
	End Select

	Text 0,0,"Mousewheel to zoom"

Code+Models ** HERE **

MadJack(Posted 2006) [#2]
This code sample also shows oddness (with copyentity on an animated mesh) similar to the above glitch.


MadJack(Posted 2006) [#3]
Any update on this bug or official acknowledgement?

Thanks muchly

markcw(Posted 2006) [#4]
if you replace this line:
mesh=LoadAnimMesh (filemesh)
with this:
mesh=LoadMesh (filemesh)
you'll see it fixed.

i think it's because copyentity is for a mesh not a mesh hierarchy.
if you use Wireframe True you'll see there is only one mesh copied.

edit: this is wrong, sorry.

MadJack(Posted 2006) [#5]
'you'll see it fixed. '

It isn't 'fixed' - it's buggered.

Being able to use copyentity on animated meshes without needing workarounds is central to keeping surface counts down.

FlagDKT(Posted 2006) [#6]

markcw(Posted 2006) [#7]
did you test this in previous versions?

i just tested this example in v1.88,v1.89,v1.90,v1.91 and v1.95 and they all do the same thing.

so how is it "buggered" if it always did that?

edit: i just tested with another hierachy model and it works. maybe the problem is with the model itself?

MadJack(Posted 2006) [#8]
The answer is that it was 'buggered' in the previous versions as well.

And the issue relates to using copyentity on animated meshes that contain alpha masked textures or surfaces set to an additive blend.

jfk EO-11110(Posted 2007) [#9]
Probably CopyENtity wasn't intended to work with animated meshes in the first place. At least, it works "almost" today.

I have an other issue with CopyEntity, that maybe was already mentioned:

When using copyentity with a simple grass quad, all copies will use the light information of the original mesh, so when I turn the copies, the shading of DX lights won't be correct. Any ideas?

markcw(Posted 2007) [#10]

The difference between CopyMesh and CopyEntity is that CopyMesh performs a 'deep' copy of a mesh.

ie. it should have it's own light information, etc.

jfk EO-11110(Posted 2007) [#11]
Yeah, thanks. Problem is: CopyEntity was used due to its speed capabilities. Although, not sure if individual shading is possible this way at all.

MadJack(Posted 2007) [#12]
...the shading of DX lights won't be correct. Any ideas?

With copyentity I believe the only option available to you is setting each copy to its own colour (entitycolor). A rather blunt way of doing things but if you have a thick grass cover then this may work out.

Else it's the mysteries of single surface meshes for you ;-)

jfk EO-11110(Posted 2007) [#13]
Thanks. Single surface meshes would require to realtime deform the vertices for wind FX. Something that may be easier with entities that can be rotated. Also, hypoteticly there are zillions of grass quads that are positioned dynamicly around the player, each one using EntityAutoFade. You see this would be pretty complicated with Singlesurface. Singlesurface even forces to render the quads behind the players back (if there are any). After all, the copied entities work pretty well. I got dense grass all around, at high speed even in a real game enviroment.

FlagDKT(Posted 2009) [#14]
More than 2 years have passed and the bug is still there.

FlagDKT(Posted 2009) [#15]
Also try to:
EntityAlpha mesh1 , 0.8
the mesh will disappear...

Copyentity is bugged and I get ignored for over 2 years....
Just say "It is a bug and we won't fix it..."

I understand that you won't add new features to blitz3d, but you said you would fix the bugs...

simonh(Posted 2009) [#16]
Can you post a zip file that contains the model and textures you're testing? Or send it to support@...

simonh(Posted 2009) [#17]
From what I can tell the .b3d models you were using were faulty. Once I imported and exported them from Ultimate Unwrap, everything worked as expected.

FlagDKT(Posted 2009) [#18]
Your model just worked because ultimate unwrap modified mesh structure and created a wrong structure (3 meshes without bones)

The bug still exists.
Everey skinned model exported from 3dsmax, with 2 surfaces (1 alpha blended) have problems when doing copyentity.

FlagDKT(Posted 2009) [#19]
Finally, thanks to Mark Sibly for the fix.
Btw you can't use EntityAlpha on a model with vertex color ON.