How can upgrade a mesh v1.41 to work with PB-6.21?

Everything related to 3D programming
User avatar
minimy
Enthusiast
Enthusiast
Posts: 551
Joined: Mon Jul 08, 2013 8:43 pm
Location: off world

How can upgrade a mesh v1.41 to work with PB-6.21?

Post by minimy »

Helllo, i have problems with shadows in my objects, after read the ogre.log i got this message:
Warning: barbudo.mesh uses an old format [MeshSerializer_v1.41]; upgrade with the OgreMeshUpgrader tool
My OgreMeshUpgrader like to be obsolete.
Where can download the last exe of OgreMeshUpgrader?
Thanks for help!
If translation=Error: reply="Sorry, Im Spanish": Endif
User avatar
minimy
Enthusiast
Enthusiast
Posts: 551
Joined: Mon Jul 08, 2013 8:43 pm
Location: off world

Re: How can upgrade a mesh v1.41 to work with PB-6.21?

Post by minimy »

If translation=Error: reply="Sorry, Im Spanish": Endif
User avatar
minimy
Enthusiast
Enthusiast
Posts: 551
Joined: Mon Jul 08, 2013 8:43 pm
Location: off world

Re: How can upgrade a mesh v1.41 to work with PB-6.21?

Post by minimy »

But may be not a problem with my mesh version.

After update the mesh i have no shadow. (old mesh no shadow too)
this is with PB-6.21
Image

This is with original mesh in PB-6.02
Image

Any idea why have no shadows... what may be?
Thanks for help!
If translation=Error: reply="Sorry, Im Spanish": Endif
miso
Enthusiast
Enthusiast
Posts: 407
Joined: Sat Oct 21, 2023 4:06 pm
Location: Hungary

Re: How can upgrade a mesh v1.41 to work with PB-6.21?

Post by miso »

Are you using the builtin shadows, or pfShadoko's new shader system?
Fred
Administrator
Administrator
Posts: 18153
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: How can upgrade a mesh v1.41 to work with PB-6.21?

Post by Fred »

IIRC the new mesh format has auto build shadow volume off, could you try by adding https://www.purebasic.com/documentation ... olume.html ?
User avatar
minimy
Enthusiast
Enthusiast
Posts: 551
Joined: Mon Jul 08, 2013 8:43 pm
Location: off world

Re: How can upgrade a mesh v1.41 to work with PB-6.21?

Post by minimy »

Hello and thank you for the help.
I'm using the native PB shadows. I've tried BuildMeshShadows after load the object, but it doesn't work either.
The weird thing is that shadows work, but when the (human) object enters the screen, all shadows disappear.
It is as if the geometry of the shadows disappeared.
with pf_shadoko shading, shadows work very good but the shadow over the object is corrupt, and i see vertex are moved out of place. (shadows are really nice with soft edges)
Here any captures to explain what happend. Thanks again!

This is with PB native material and pf_shadoko shadows. Shadows are fantastic but the object no catch shadows.
Image

And this is with pf_shadoko anim material and shadows. (#SO_Txcolor|#SO_Anim)
Image
If translation=Error: reply="Sorry, Im Spanish": Endif
miso
Enthusiast
Enthusiast
Posts: 407
Joined: Sat Oct 21, 2023 4:06 pm
Location: Hungary

Re: How can upgrade a mesh v1.41 to work with PB-6.21?

Post by miso »

I understand, that it works with old pb versions stencil shadows, still my guess would be wrong face normals injected by the 3d software exporter you use. If possible, try to save your mesh in a format that saves only triangles, not using any quads. Also, buld mesh tangent after that (if not presented). (It can be done in pb with buildmeshtangent() command. Shadokos shaders requires it. (and those considers bones).

I find his latest contribution very versatile and upgradeable.
User avatar
minimy
Enthusiast
Enthusiast
Posts: 551
Joined: Mon Jul 08, 2013 8:43 pm
Location: off world

Re: How can upgrade a mesh v1.41 to work with PB-6.21?

Post by minimy »

First of all, thank you for the help with this problem. Yes, that makes sense.
But the meshes are triangulated. I have confirmed that the faces or normal are well oriented (outwards) in all the models I have tested.

Image

This model is designed with makeuman, the result is the same as exported with other CAD software.

Image

In all models i add build shadows and tangents.
prota_mesh= LoadMesh(#PB_Any,"salvaje.mesh")
BuildMeshTangents(prota_mesh)
BuildMeshShadowVolume(prota_mesh)

And tested with double-side material like this MaterialCullingMode(prota_mate,#PB_Material_NoCulling). but no result.
If translation=Error: reply="Sorry, Im Spanish": Endif
User avatar
pf shadoko
Enthusiast
Enthusiast
Posts: 385
Joined: Thu Jul 09, 2015 9:07 am

Re: How can upgrade a mesh v1.41 to work with PB-6.21?

Post by pf shadoko »

can you give me your mesh so I can see where the problem comes from
(try without WorldShadowsEx to see)

PS: BuildMeshTangents is only useful if you use a normalemap
BuildMeshShadowVolume is not useful here, it's for stencil shadows, I use shadows texture
User avatar
pf shadoko
Enthusiast
Enthusiast
Posts: 385
Joined: Thu Jul 09, 2015 9:07 am

Re: How can upgrade a mesh v1.41 to work with PB-6.21?

Post by pf shadoko »

the problem comes from the number of weights in the skeletal animation
CreateMaterialEx takes into account a maximum of 3 weights, which should have been more than enough
but obviously the software you're using takes 4, without sorting them
I might take into account #SO_Anim4 (for 4 weights), if I can't find a more elegant way of solving the problem
in the meantime you can correct the bug by replacing :
line 135 with

Code: Select all

  wcooa="opos=vec4(0);onormal=vec3(0);@otg1%for(int i=0;i<4;i++){%if(blendWeights[i]>0.0){%mat3x4 bonemx=P4[int(blendIndices[i])];%opos+=vec4(gl_Vertex*bonemx,1)*blendWeights[i];%onormal+=(gl_Normal*mat3(bonemx))*blendWeights[i];%@otg2%}%}%opos=world_mx*opos;%onormal=mat3(world_mx)*onormal;%@otg3%"
(I've just replaced i<3 with i<4, but this will cause problems for animations with weights <4 (ideally the same should be done for shadow caster code).
Last edited by pf shadoko on Mon Jul 14, 2025 5:50 pm, edited 1 time in total.
User avatar
minimy
Enthusiast
Enthusiast
Posts: 551
Joined: Mon Jul 08, 2013 8:43 pm
Location: off world

Re: How can upgrade a mesh v1.41 to work with PB-6.21?

Post by minimy »

Hello PF Shadoko, thanks again for your time and help.
After change line 135 with the new 'wcooa' return an error in line 213 MaterialShaderTexture(material,tx1,tx2,tx3,tx4) material not initialised.
Im testing with same model 'salvaje.mesh' if change to original line 135 work fine but like in this image:
Image
Is the salvaje curse :lol:
If translation=Error: reply="Sorry, Im Spanish": Endif
User avatar
pf shadoko
Enthusiast
Enthusiast
Posts: 385
Joined: Thu Jul 09, 2015 9:07 am

Re: How can upgrade a mesh v1.41 to work with PB-6.21?

Post by pf shadoko »

hi,
I put the line to modify in "code" tags (cf post above)
it should work
User avatar
minimy
Enthusiast
Enthusiast
Posts: 551
Joined: Mon Jul 08, 2013 8:43 pm
Location: off world

Re: How can upgrade a mesh v1.41 to work with PB-6.21?

Post by minimy »

YEEEESSS!! Now is working perfect! thanks a lot pf_shadoko!!
If you were around I would buy you a couple of beers! :lol:
If translation=Error: reply="Sorry, Im Spanish": Endif
miso
Enthusiast
Enthusiast
Posts: 407
Joined: Sat Oct 21, 2023 4:06 pm
Location: Hungary

Re: How can upgrade a mesh v1.41 to work with PB-6.21?

Post by miso »

Does the shader code runs faster, if I change this downwards? For simpler models, where theres only 1-2 weighted bones? (I assume the answer is yes)
User avatar
pf shadoko
Enthusiast
Enthusiast
Posts: 385
Joined: Thu Jul 09, 2015 9:07 am

Re: How can upgrade a mesh v1.41 to work with PB-6.21?

Post by pf shadoko »

@minimy :
I think it would be preferable to reduce the number of weights (it's rare to need more than 2)
your conversion software doesn't offer this?

@miso :
I don't think this will have a significant impact on performance
(I recommend using BuildMeshLOD instead)
Post Reply