Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Selba Ward  (Read 34027 times)

0 Members and 1 Guest are viewing this topic.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 9329
    • View Profile
    • development blog
    • Email
Selba Ward
« Reply #105 on: April 01, 2017, 12:56:16 pm »
Nice, good job! :)

I really should play around more with your libraries.
Official FAQ: https://www.sfml-dev.org/faq.php
Nightly Builds: https://www.nightlybuilds.ch/
——————————————————————
Dev Blog: https://dev.my-gate.net/
Thor: http://www.bromeon.ch/libraries/thor/

roccio

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
    • Email
Re: Selba Ward
« Reply #106 on: April 01, 2017, 10:04:44 pm »
Getting better and better! Thank you!

Mortal

  • Full Member
  • ***
  • Posts: 246
    • View Profile
Re: Selba Ward
« Reply #107 on: April 01, 2017, 10:29:06 pm »
awesome, gotta update Selba Ward libs  :)

Hapax

  • Hero Member
  • *****
  • Posts: 2776
  • My number of posts is shown in hexadecimal.
    • View Profile
Re: Selba Ward
« Reply #108 on: April 02, 2017, 05:16:30 pm »
Thank you!

After trying it (or anything else), let me know what you think and anything you think needs improving :)
Selba Ward - SFML drawables
Kairos - Timing Library
Rectangular Boundary Collision - Rectangular SAT Collision

@Hapaxiation - Hapaxia on Twitter

JayhawkZombie

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Re: Selba Ward
« Reply #109 on: April 25, 2017, 06:45:49 am »
Pardon me if I'm wrong here, but it appears m_thickness isn't initialized in the Spine class.  Without explicitly setting it, its value is undefined, just some garbage value.  Thus, the examples on the Wiki do not produce the expected results.
Not that it's that big of a deal, but I wanted to mention it.

JayhawkZombie

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Re: Selba Ward
« Reply #110 on: April 25, 2017, 07:28:51 am »
Sorry for the second post.

But regardless of that, I modified SelbaWard slightly to expose the interpolated points that the Spline class makes and wrapped a SplinePath class with it.  Combined it with Thor in our engine to make particle effects that follow a path.  Still working on making the particles look nicer, but it fits the bill.

https://youtu.be/Lo55-PfwSoc

Or see a gif if you don't wish to condone my shameless self-promotion: 

Hapax

  • Hero Member
  • *****
  • Posts: 2776
  • My number of posts is shown in hexadecimal.
    • View Profile
Re: Selba Ward
« Reply #111 on: April 25, 2017, 09:25:07 pm »
it appears m_thickness isn't initialized in the Spine class.
You are correct; an oversight on my part. I will fix this as soon as I can. Feel free to open an issue on Selba Ward's GitHub so I don't forget about this.

I modified SelbaWard slightly to expose the interpolated points
Although Selba Ward's objects are drawables by design and creating a spline control path isn't really within that design, exposing the interpolated points could be useful in a number of ways without introducing any complications to the class. Therefore, this simple feature is now "planned" ;)
Selba Ward - SFML drawables
Kairos - Timing Library
Rectangular Boundary Collision - Rectangular SAT Collision

@Hapaxiation - Hapaxia on Twitter

Hapax

  • Hero Member
  • *****
  • Posts: 2776
  • My number of posts is shown in hexadecimal.
    • View Profile
Re: Selba Ward
« Reply #112 on: April 29, 2017, 11:00:00 pm »
Update!

Spline (wiki)
v1.2
Added ability to specify initial vertices by a list of positions directly in the constructor using an initializer list (see simple examples)

Added ability to automatically close the spline. This also takes into account the angle connection of the first and final vertices for thick Splines:

With anti-aliasing:


Added ability to retrieve an interpolated position of the Spline as well as the number of interpolated positions in the entire Spline - useful for control paths:
https://www.youtube.com/watch?v=ppqqly7xtBA

Plus, a few fixes, including setting the colour not affecting the thick Spline - only the thin one - and an internal miscalculation.



@JayhawkZombie, I noticed you're spinning the SFML card at the beginning of your video. Are you using Selba Ward's Sprite3D? If so, consider increasing the subdivision amount ;) Also, if you set its origin to its centre, it rotates around the centre in 3D too!
« Last Edit: April 29, 2017, 11:03:18 pm by Hapax »
Selba Ward - SFML drawables
Kairos - Timing Library
Rectangular Boundary Collision - Rectangular SAT Collision

@Hapaxiation - Hapaxia on Twitter

JayhawkZombie

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Re: Selba Ward
« Reply #113 on: April 30, 2017, 12:07:23 am »
Added ability to specify initial vertices by a list of positions directly in the constructor using an initializer list (see simple examples)
That will make the syntax much cleaner.
It probably would have been proper of me to tell you how I extended Spline, but it appears you exposed identical functionality that I did, minus a difference in the parameter list.

All I added was:
sf::Vector2f getInterpolatedVertex(unsigned int index);
unsigned int getInterpolatedVertexCount() const;

Added ability to automatically close the spline. This also takes into account the angle connection of the first and final vertices for thick Splines:
That will (probably) take care of the hitch that occurs when paths meet.  I had duplicated the meeting vertex at that point.

Added ability to retrieve an interpolated position of the Spline as well as the number of interpolated positions in the entire Spline - useful for control paths:
;) My particle effects much appreciate
Can this allow you to retrieve the interpolated thick points?  One could create several parallel paths that way with only one spline.

@JayhawkZombie, I noticed you're spinning the SFML card at the beginning of your video. Are you using Selba Ward's Sprite3D? If so, consider increasing the subdivision amount ;) Also, if you set its origin to its centre, it rotates around the centre in 3D too!

We are!  Actually, it would be more accurate to say we're integrating SelbaWard into our Engine, but that was there for just showing it off.  The subdivision amount completely slipped my mind - I'll try that!
We used SelbaWard in our "tech" demo a couple days ago.  We had "smokey" particles following a path in one menu, and used your Starfield in the physics / time dilation demo.
Having time freeze for everything but the starfield had a cool-looking effect.

https://www.youtube.com/watch?v=96tadraw8Ho&t=3s

The anti-aliased spline looks really nice.

We're migrating our code base from our old design repo to our official open-source repo.  Once that's done, I'll try to make a tech demo and leverage some more SelbaWard functionality.

OH, we also used your Bitmap font/text classes to speed up text rendering.  Those things are a godsend.

Hapax

  • Hero Member
  • *****
  • Posts: 2776
  • My number of posts is shown in hexadecimal.
    • View Profile
Re: Selba Ward
« Reply #114 on: April 30, 2017, 11:55:03 am »
I have a few other things planned for Spline - one of which will allow parallel control paths. One important thing to note about these parallel paths is that the interpolated positions that are equivalent are not equal distance apart. For example, through a bend, the outside of that bend has the same number of points that are further away than the inside of that bend. The solution for that in animation paths is to use the points as a target and then move towards that target using a velocity.
Also, on sharp bends, the sides aren't always as expected - a sharp corner only becomes that angle for its single position and any positions before and after are still "normal" so inners can cross in a weird way (you can see this effect by drawing a thick spline with a semi-transparent colour).

Adding an extra vertex at the end that matches the first vertex was not enough to close the Spline correctly. The angle of the ends still didn't match as they don't take into account the angle of the path before or after it. To see what I mean, create an open spline with very few interpolated positions and a bend at connection.

Note that, with Spline, I intentionally only use the word vertex to refer to the control vertices of the Spline and never the actual rendered vertices (that only occurs in the implementation code).

I see you have quite a few libraries in your engine! I happen to use Plinth in everything I make. It even has some things designed alongside Selba Ward things (Frame Sequence was designed alongside Gallery Sprite, for example) ;) and you may want to consider Kairos, the timing library, especially since you seem interested in "bending time" ;D

Oh, and one thing to note about subdivision in Spline 3D: don't overdo it! It increases exponentially so double digits could easily kill computers :P
Selba Ward - SFML drawables
Kairos - Timing Library
Rectangular Boundary Collision - Rectangular SAT Collision

@Hapaxiation - Hapaxia on Twitter

JayhawkZombie

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Re: Selba Ward
« Reply #115 on: April 30, 2017, 10:40:13 pm »
Note that, with Spline, I intentionally only use the word vertex to refer to the control vertices of the Spline and never the actual rendered vertices (that only occurs in the implementation code).
Yes, I wasn't as deliberate.  My path class was the only one referencing the functions.

I see you have quite a few libraries in your engine!
Yes... Is that bad?  Only a couple graphical helpers, but the rest are scripting/physics/serialization.

you may want to consider Kairos, the timing library, especially since you seem interested in "bending time" ;D
I had no idea that existed, lol.  It looks pretty cool.  Probably doing time management better than we are currently.

Hapax

  • Hero Member
  • *****
  • Posts: 2776
  • My number of posts is shown in hexadecimal.
    • View Profile
Re: Selba Ward
« Reply #116 on: May 01, 2017, 11:54:30 pm »
Updates!

Nine Patch (wiki)
v1.4
Added ability to provide a rectangle that specifies which part of the texture to use; this include the control edges. This allows for a Nine Patch texture to be a sub-texture rather than requiring the entire texture to itself.

The axis-aligned content area bounds can now be retrieved for both local and global.

Added ability to test if a point is inside the actual transformed content area; this is not limited to axis-alignment!

Spline (wiki)
v1.3
Added ability to specify colours and thicknesses per vertex.
These values are multiplied with the global values and are interpolated linearly between vertices:

With anti-aliasing:


More information is available from the interpolated positions:
  • the tangent (unit vector),
  • the normal (the tangent rotated 90 degrees anti-clockwise),
  • the interpolated vertex thickness,
  • the thickness correction scale (highest at sharper corners and one for straight sections).
Example animation using this information:
https://www.youtube.com/watch?v=CrvOsypfYMQ



I see you have quite a few libraries in your engine!
Yes... Is that bad?  Only a couple graphical helpers, but the rest are scripting/physics/serialization.
If a library already provides what you need, using it makes sense.
Selba Ward - SFML drawables
Kairos - Timing Library
Rectangular Boundary Collision - Rectangular SAT Collision

@Hapaxiation - Hapaxia on Twitter

JayhawkZombie

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Re: Selba Ward
« Reply #117 on: May 02, 2017, 08:15:05 am »
More information is available from the interpolated positions:
  • the tangent (unit vector),
  • the normal (the tangent rotated 90 degrees anti-clockwise),
  • the interpolated vertex thickness,
  • the thickness correction scale (highest at sharper corners and one for straight sections).
This is awesome.  I can come up with quite a number of uses for the tangent vector here.


If a library already provides what you need, using it makes sense.
Yes, we saw no point in reinventing the wheel.


Speaking of libraries, I did checkout Kairos, and rewrote our ticking system and rendering system to use it and interpolate between physics states when rendering.  Makes everything look soooo much smoother. No more jittery colliders, and them being rendered 1 tick behind isn't really noticeable, since the physics logic is still being updates at 40fps. I think the smoothed-out motion is worth the 1 frame of lag.

https://www.youtube.com/watch?v=i09kn48DdxE

roccio

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
    • Email
Re: Selba Ward
« Reply #118 on: May 02, 2017, 05:12:54 pm »
Can those spline be textured? I mean following the curve.
Top work yours!

Hapax

  • Hero Member
  • *****
  • Posts: 2776
  • My number of posts is shown in hexadecimal.
    • View Profile
Re: Selba Ward
« Reply #119 on: May 03, 2017, 10:17:26 pm »
@JayhawkZombie, glad you like the new Spline stuff! :) and Kairos too! ;)

@roccio, no. Splines cannot be textured at all. Although I have considered the implementation of texturing the Spline, I don't think that it would be the result expected/hoped for.

Note that there are limitations/restrictions to using the "per vertex" attributes (colour and thickness). Using thickness per vertex can cause "slightly off-looking" angle at sharp corners as well as a slight sharp bump on the inner edge whereas using colour per vertex may not be interpolated as expected; note also that the Spline segments are drawn in order so if a corner overlaps itself, the colour behind would be overdrawn. Colours and thicknesses per vertex are more useful if there are no sharp corners.

With that, image the result that could occur with texturing!
Selba Ward - SFML drawables
Kairos - Timing Library
Rectangular Boundary Collision - Rectangular SAT Collision

@Hapaxiation - Hapaxia on Twitter

 

anything