Please, I need help.
I would like to try to make a parallax system, so I would like to use spine with billboard effect.
Please can you provide a basic example with xna runtime?
best
Cristian Zerbinati
[XNA] Help billboard example
- Edited
Billboarding is implemented using a transform matrix that aligns the plane of the object being rendered with the camera's direction vector. This is not specific to Spine, and I'm afraid we don't have the resources to prepare an example for billboarding. You can find billboarding examples for XNA on the web, which will boil down to creating an appropriate matrix. You can then stick this matrix into the Effect
used by the SkeletonRenderer
to align your skeletons with the camera direction vector.
Hi Mario,
yes I know, I tried examples of billboards but I haven't been able to get them to work with spine, the meshes are visible but not spines.
Ok I'll try to understand where I'm wrong
I'm not eable to find Z property in skeleton?
I'm afraid I don't understand what you mean by Z property? There's no need to modify the vertices of a skeleton directly. You can do billboarding by (camera) matrix manipulation alone.
ok, but for a paralax effect I need to place the skeleton also in Z
then when the camera is moved the skeleton that is far form camera is smaller and move slow, than those in front
This can (and should) be expressed in the matrix. Simply modify the World
matrix of the Effect
set on the SkeletonRenderer
. Here we do that for the Projection
matrix, setting a 2D orthographic view. https://github.com/EsotericSoftware/spine-runtimes/blob/3.8/spine-xna/example/src/ExampleGame.cs#L199
Check out the XNA Matrix
class documentation. It even has a CreateBillboard()
function that appears to create a matrix that can help you do what you ultimately want to do: https://docs.microsoft.com/en-us/previous-versions/windows/silverlight/dotnet-windows-silverlight/bb197911(v=xnagamestudio.35)
Mario wroteThis can (and should) be expressed in the matrix. Simply modify the
World
matrix of theEffect
set on theSkeletonRenderer
. Here we do that for theProjection
matrix, setting a 2D orthographic view. https://github.com/EsotericSoftware/spine-runtimes/blob/3.8/spine-xna/example/src/ExampleGame.cs#L199Check out the XNA
Matrix
class documentation. It even has aCreateBillboard()
function that appears to create a matrix that can help you do what you ultimately want to do: https://docs.microsoft.com/en-us/previous-versions/windows/silverlight/dotnet-windows-silverlight/bb197911(v=xnagamestudio.35)
thank you very much I study the links you gave me :yes: :yes:
eprime wroteMario wroteThis can (and should) be expressed in the matrix. Simply modify the
World
matrix of theEffect
set on theSkeletonRenderer
. Here we do that for theProjection
matrix, setting a 2D orthographic view. https://github.com/EsotericSoftware/spine-runtimes/blob/3.8/spine-xna/example/src/ExampleGame.cs#L199Check out the XNA
Matrix
class documentation. It even has aCreateBillboard()
function that appears to create a matrix that can help you do what you ultimately want to do: https://docs.microsoft.com/en-us/previous-versions/windows/silverlight/dotnet-windows-silverlight/bb197911(v=xnagamestudio.35)thank you very much I study the links you gave me :yes: :yes:
Update:
I have seen, but this is for the camera, hat's exactly what I do now.
But the skeleton is all in the same Z axis.
If it were possible to move the spine objects in the z-axes it would be very useful for parallax. In practice it would be handled as Unity. For example, if I modify skeleton render ZSpacing property, the attachment are render in different Z position.
see the image attach, one with zspacing=0 and the other with zspacing=30
Ahhhh, now I understand! Sorry, I understood you wanted to move the entire skeleton on the z-axis. That's already possible in the SkeletonRenderer class, see https://github.com/EsotericSoftware/spine-runtimes/blob/3.8/spine-xna/src/SkeletonRenderer.cs#L63
Mario wroteAhhhh, now I understand! Sorry, I understood you wanted to move the entire skeleton on the z-axis. That's already possible in the SkeletonRenderer class, see https://github.com/EsotericSoftware/spine-runtimes/blob/3.8/spine-xna/src/SkeletonRenderer.cs#L63
wait Mario :-D you got it right, that of zspacing was just an example of z-axis.
I want to locate the skeletons on a specific z-axis.
if change the skeletonDebugRenderer.Effect.Projection
I must do End and Begin, that is expensive, I need to locate many skeletons, in different z-axis
ok I have write the solution, it is easy:
I have add the z property to the class Skeleton.cs
internal float x, y, z;
public float Z { get { return z; } set { z = value; } }
and in SkeletonRenderer.cs
row 214 add the instruction + skeleton.Z
itemVertices[ii].Position.Z = attachmentZOffset + skeleton.Z;
now with prospectic camera, the skeleton can be render in different z-axis.
Well... now I only do the billboard effect works with spine :grinfake