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

Author Topic: jelly physics deformations with sfml, is it possible  (Read 7838 times)

0 Members and 3 Guests are viewing this topic.

mkalex777

  • Full Member
  • ***
  • Posts: 206
    • View Profile
jelly physics deformations with sfml, is it possible
« on: October 01, 2015, 11:06:36 am »
I want to achieve effect, something like this:

Is it possible?
How to implement it? Probably there is need to use shaders for transformations?
« Last Edit: October 01, 2015, 11:09:00 am by mkalex777 »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: jelly physics deformations with sfml, is it possible
« Reply #1 on: October 01, 2015, 11:34:56 am »
Why don't you first do a bit of research on the topic yourself?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

mkalex777

  • Full Member
  • ***
  • Posts: 206
    • View Profile
Re: jelly physics deformations with sfml, is it possible
« Reply #2 on: October 01, 2015, 02:15:11 pm »
Why don't you first do a bit of research on the topic yourself?

Yes, I'm research, so it's the reason why I'm writing here.
I'm interested if it possible with SFML architecture, because there is need to transform the geometry, but SFML hide it inside library...

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: jelly physics deformations with sfml, is it possible
« Reply #3 on: October 01, 2015, 02:27:22 pm »
You should first find out (and tell us) how it is supposed to be done, and then we can help you implement the technique with SFML.
Laurent Gomila - SFML developer

mkalex777

  • Full Member
  • ***
  • Posts: 206
    • View Profile
Re: jelly physics deformations with sfml, is it possible
« Reply #4 on: October 01, 2015, 04:26:25 pm »
I'm just trying to find the way on how I can fill multi point polygon with SFML, so I can use it to render soft body objects for further investigations...

G.

  • Hero Member
  • *****
  • Posts: 1593
    • View Profile
Re: jelly physics deformations with sfml, is it possible
« Reply #5 on: October 01, 2015, 04:29:15 pm »
Look for metaballs.

If you want to "transform the geometry", you can use a vector of sf::Vertex (or an sf::VertexArray).

AlexAUT

  • Sr. Member
  • ****
  • Posts: 396
    • View Profile
Re: jelly physics deformations with sfml, is it possible
« Reply #6 on: October 01, 2015, 07:42:03 pm »
I'm just trying to find the way on how I can fill multi point polygon with SFML

Have a look at VertexArray , there is also a section in the tutorials about custom shapes. They allow you to set each point by your own (Use sf::Triangle/TriangleStrip/TriangleFan, depending on your needs, to draw a filled polygon).



AlexAUT

mkalex777

  • Full Member
  • ***
  • Posts: 206
    • View Profile
Re: jelly physics deformations with sfml, is it possible
« Reply #7 on: October 01, 2015, 09:25:09 pm »
I'm just trying to find the way on how I can fill multi point polygon with SFML

Have a look at VertexArray , there is also a section in the tutorials about custom shapes. They allow you to set each point by your own (Use sf::Triangle/TriangleStrip/TriangleFan, depending on your needs, to draw a filled polygon).



AlexAUT

Yes, I read it. I'm using vertex array to fill a gradient rectangle (quad) and to render realtime fps graph (lines). I read about concaveshape, but it uses vertex array with specific flow direction. I tried it to fill multipoint polygon, but it gives strange shapes.
Is there any guide or example on how to generate vertex array in correct order for multipoint polygon?

AlexAUT

  • Sr. Member
  • ****
  • Posts: 396
    • View Profile
Re: jelly physics deformations with sfml, is it possible
« Reply #8 on: October 01, 2015, 09:48:48 pm »
Quote
multipoint polygon

I've never heard that word, but I think you meant just a concave polygon? To draw a concave polygon correctly you have multiple options, at my university we learned about cutting a concave polygon to multiple convex polygons (which would save your problem I guess?)

You just google "break concave polygon into convex" or "Polygon triangulation" and you should find a way to implement it.


AlexAUT

mkalex777

  • Full Member
  • ***
  • Posts: 206
    • View Profile
Re: jelly physics deformations with sfml, is it possible
« Reply #9 on: October 01, 2015, 10:27:44 pm »
Quote
multipoint polygon

I've never heard that word, but I think you meant just a concave polygon? To draw a concave polygon correctly you have multiple options, at my university we learned about cutting a concave polygon to multiple convex polygons (which would save your problem I guess?)

You just google "break concave polygon into convex" or "Polygon triangulation" and you should find a way to implement it.


AlexAUT

Yes, exactly. Sorry for terminology. I know about it, but I think that its probaly should be already implemented as a ready to use class or something like that. Does SFML provides some tools to work with it without implementation of complicated algorithms?
What I'm looking for is a way on how I can generate vertex array for a circle, make some transformations and pass it to the window.draw.
I think that it can be done in such way. But I never worked with such tasks, so please correct me if I'm wrong. May be there is a better way to implement it? What is your thoughts?

I'm using some physics in the game, but it works just with object models to calculate coordinates, speed, collisions and there is no graphics effects for collisions. So, I want to add some graphics effects, to make objects more alive and responsive :)
« Last Edit: October 02, 2015, 08:25:51 am by mkalex777 »

AlexAUT

  • Sr. Member
  • ****
  • Posts: 396
    • View Profile
Re: jelly physics deformations with sfml, is it possible
« Reply #10 on: October 02, 2015, 12:01:43 am »
SFML 2.x does not offer such a feature, but you could use Thor ConcaveShape (SFML extension written by a member of the SFML Team, Nexus).

What I'm looking for is a way on how I can generate vertex array for a circle, make some transformations and pass it to the window.draw.

If you need just a Circle you could use sf::CircleShape?
If you want to make it with VertexArray you have to generate the geometry data yourself and apply the transformation yourself, in case of a circle it isn't that hard (a bit sin and cos  :P).



AlexAUT

mkalex777

  • Full Member
  • ***
  • Posts: 206
    • View Profile
Re: jelly physics deformations with sfml, is it possible
« Reply #11 on: October 02, 2015, 01:45:04 pm »
If you need just a Circle you could use sf::CircleShape?

If you want to make it with VertexArray you have to generate the geometry data yourself and apply the transformation yourself, in case of a circle it isn't that hard (a bit sin and cos  :P).

Yes, I'm already using CircleShape, I just want to make it more alive by adding some deformations.
Thanks, I know how to draw a circle, I just interested if SFML provides any kind of helper to render polygon from array of points... It seems that it is not...

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: jelly physics deformations with sfml, is it possible
« Reply #12 on: October 02, 2015, 03:34:23 pm »
I just interested if SFML provides any kind of helper to render polygon from array of points...
What's the problem with sf::VertexArray? ???

You really have to be more specific. If you need a concave polygon composition, look at the Delaunay Triangulation I implemented in Thor, or use thor::ConcaveShape directly.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: