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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - JayhawkZombie

Pages: [1] 2 3 ... 6
1
SFML projects / Light and Shadow Volume Generation for Sprite Sheet Objects
« on: December 16, 2017, 06:13:17 am »
Hello, all.

This was my first semester of graduate school, and I took a computer vision course.  For my final project, I decided to try to develop a method to generate shadows for sprites without having to meticulously find every corner in the sprite myself.

I hadn't seen anything out there do this yet, though there is likely something out there somewhere.  I doubt this is novel.

The result is a paper I wrote, titled "Light and Shadow Volume Generation for Sprite Sheet Objects using Outline Mesh Generation".

In short, it uses Canny edge detection and contouring to generate the contour of objects in sprite sheets and extracts the coordinates of every point along the contour.
This contour is used as an occlusion mesh for casting shadows.

It seemed to work pretty well for the sprite that I initially tested it on.  It is not a ready-to-go framework, but it is a working sample implementation.  It uses SFML (well duh) and OpenCV (for the contouring).

I've source code here: https://github.com/JayhawkZombie/SpriteMeshLighting 

In there is also the paper, if you've interesting in reading more into it.


An image of a plain sprite:



What the sprite + shadow volumes looks like after extraction is finished:



I will probably get an actual framework/library up for generating these in a cleaner way soon (will update when I do so), but this was just a first working version.

2
General / Re: How to measure which border will the ray "hit"
« on: September 27, 2017, 06:50:28 am »
Do you need to calculate where it intersects or just know if it intersects?
Neither require trig, but calculating the intersections just requires you to use a (linear) system of 2 equations.

3
Try manually defining _ITERATOR_DEBUG_LEVEL.

Project > Properties > Configuration Properties > C/C++ > Preprocessor

and add '_ITERATOR_DEBUG_LEVEL=0' to the 'Preprocessor Definitions' section.  Microsoft has more info here about the macro https://docs.microsoft.com/en-us/cpp/standard-library/iterator-debug-level

4
Are you linking all the libs?
I'm using the same version of visual studio as you, and I have these linked:
  • sfml-graphics-s-d.lib
  • sfml-window-s-d.lib
  • sfml-audio-s-d.lib
  • sfml-system-s-d.lib
  • flac.lib
  • freetype.lib
  • jpeg.lib
  • ogg.lib
  • openal32.lib
  • vorbis.lib
  • vorbisenc.lib
  • vorbisfile.lib
  • opengl32.lib
  • winmm.lib
  • sfml-main-d.lib

(someone already mentioned the need to link all the dependencies as well before I finished this)

5
If I may also chime in.

Try using interpolation when rendering.  If you have a fast moving object, it can appear to "jump" between positions, especially when limiting the framerate.

The rendering will not be entirely accurate (at most one frame behind), but the movement will appear much smoother.

Here's a good example of an implementation (but by no means the only one): http://kirbysayshi.com/2013/09/24/interpolated-physics-rendering.html

6
SFML projects / Precompiled Libraries for Visual Studio 2017 (STATIC)
« on: July 11, 2017, 05:47:18 am »
I went ahead and pre-compiled SFML for Visual Studio 2017 for both Debug and Release, and both for targeting x86 and x64.
It is all using STATIC libraries, so the "Runtime Library" is set to "MTd" for Debug, and "MT" for release. "Basic Runtime Checks" are set to "Default", and "Preprocessor" contains "SFML_STATIC" as is needed for static linking.

The target platform is set to "10.0.15063.0" by default, but it will also compile if set to "8.1" if you aren't using Windows 10.  First thing you should change if you get errors is to check "Properties > Configuration Properties > General > Target Platform" and change it to 8.1 if you're not on Windows 10.

I've linked a zip with a VS solution pre-made to unzip and go.  The include paths are relative to the solution direction ("$(SolutionDir)/Dependencies/include") so there's no need to put the files in any "special" directory, and the linker is set up to find the lib files based on the configuration and target platform (also relative to the solution directory).

"SFMLTemplate/Dependencies" has "include" and "libs". "include" is obvious.  "libs" is split into "x86" and "x64" and each has "Debug" and "Release" with the appropriate libs.

The executables will be generated in the following location:
<Solution>/<TargetPlatform>/<Configuration>

So you'll end up with the exe in one of:
"SFMLTemplate/x86/Debug", "SFMLTemplate/x86/Release", "SFMLTemplate/x64/Debug", "SFMLTemplate/x64/Release"

depending on how how you are set up to compile.  "openal32.dll" is dropped in the top folder, so just copy it to wherever the executable is if you use the audio library.

The template contains a short program, basically the same as the tutorial app, and I've compiled it and run it on all 4 configurations and verified it works for both targeting the Windows 10 SDK and Windows 8.1 SDK.
Provided all is sound, you should just be able to unzip it, open it up in VS, compile it, and go.

Size is ~40MB compressed, 190MB uncompressed.
I hosted it on my dropbox, since I don't know if GitHub will appreciate uploading such a large directory.

https://www.dropbox.com/s/qe3e32rt3qymubv/SFMLTemplate.zip?dl=0

7
SFML projects / Re: Selba Ward
« 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.


8
SFML projects / Re: Selba Ward
« 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.

9
SFML projects / Re: Selba Ward
« 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.



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.

10
SFML projects / Re: Selba Ward
« 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.



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

11
SFML projects / Re: Selba Ward
« 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.

12
Yes.  If they're on top of each other, the last one that gets drawn wins, so just draw them in the right order.

13
General / Re: Collision detect (advanced) for my SFML game
« on: April 23, 2017, 02:10:50 am »
If you do not wish to do it yourself, you can use something like Box2D: https://github.com/erincatto/Box2D

14
General / Re: Application hanging up.
« on: April 17, 2017, 03:51:08 am »
You could also fire a bullet only when the user initially presses down on the space key

if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Space) {
  //Launch here
}

15
General / Re: Need Help
« on: April 16, 2017, 08:36:14 pm »
How are you implementing it for your class?  sf::FloatRect assumes (left, top, width, height), so like 

sf::FloatRect getGlobalBounds()
{
  return sf::FloatRect(
    Position.x, //left
    Position.y, //top
    Size.x,     //width
    Size.y      //height
  );
}

Pages: [1] 2 3 ... 6
anything