5 ms·
Something I've been really surprised and disappointed by is the lack of 2d vector graphics support in modern gaming engines. I'm an amateur enthusiast but I sp
by Waterluvian 8y ago
Something I've been really surprised and disappointed by is the lack of 2d vector graphics support in modern gaming engines.
I'm an amateur enthusiast but I spent hours and hours unsuccessfully trying to find any decent engine where I could make games using svg or other vector formats.
- paulryanrogers 8y agoGodot has a skeletal animator built-in which is a nice middle ground for rotating sprites. I imagine the lack of dedicated vector art support could be that 3D engines can simulate that vectorised style.
- pcwalton 8y agoI would love to see someone step up and add Pathfinder support to Unity, Godot, and other popular engines. I'd be very interested in taking pull requests to this effect :)
- jra101 8y agoDefold might be an option. https://www.defold.com/ https://www.defold.com/
- speps 8y agoDoesn't support vector graphics, only SVG import into a texture if I recall.
- DonHopkins 8y agoI know what you mean! Unity3D has no way to simply draw a circle or pie chart into a texture. It would be great to be able to use the canvas api (and any JavaScript library like d3 that uses canvas) to dynamically draw Unity3D textures. To address that problem (and others), I'm been developing a Unity3D extension called UnityJS, which integrates a web browser and JavaScript with Unity3D, so you can use the canvas api to draw images for use as 2D user interface overlays and 3D mesh textures in Unity. And of course the other (main) point of UnityJS is to use JavaScript for scripting and debugging Unity apps, and integrate Unity apps with off-the-shelf JavaScript web libraries (d3, socket.io, whatever). https://github.com/SimHacker/UnityJS/blob/master/doc/Anatomy.txt https://github.com/SimHacker/UnityJS/blob/master/doc/Anatomy... Drawing on canvases actually works pretty well in the WebGL build, because the JavaScript runs in the same browser tab and address space that's running the Unity app, so you can efficiently blit the canvas's pixels right into Unity's texture memory. (Although I don't believe there's a way to share the canvas texture directly through GPU memory, or even directly share Unity's ArrayBuffer memory, but it's fast enough for interactive user interface stuff, and millions of times better than the "portable" technique of writing out a data uri with a base 64 encoded compressed png file, which is the "standard" way of getting pixels out of the web browser! Web tech sure sucks!) https://github.com/SimHacker/UnityJS/blob/master/Libraries/UnityJS/StreamingAssets/UnityJS/bridge.jss#L640 https://github.com/SimHacker/UnityJS/blob/master/Libraries/U...
- bufferoverflow 8y agoActually a circle is very easy to draw using a shader: (4th answer down) https://stackoverflow.com/questions/13708395/how-can-i-draw-a-circle-in-unity3d https://stackoverflow.com/questions/13708395/how-can-i-draw-... A pie chart would be harder.
- DonHopkins 8y agoBut drawing that circle (or a pie chart) into a texture (so you don't have to draw each triangle every frame) is a whole can of worms. It might be fine in some cases on a big honking workstation, but reducing the number of draws and triangles becomes quite important when you're doing mobile user interfaces or VR. Also, it would take a hell of a lot of programming to duplicate the canvas api with LineRenderer and dynamic meshes. And then you've rolled yourself a custom C# drawing API, so there aren't any full featured well supported off-the-shelf libraries like d3 or chartjs to drive it. One of the nice things about the way UnityJS integrates JavaScript with a standard web browser in Unity apps is that you can use any of the enormous ecosystem of existing off-the-shelf JavaScript libraries without modification (both visual canvas drawing, and JSON based data wrangling libraries and APIs for services). It's all about leveraging existing JavaScript libraries and web technologies, instead of reinventing half-assed Unity C# versions. Given any JSON based web service or SDK you might want to talk to (google sheets or slack for example), the chances of finding a working well supported JavaScript library that talks to it are a lot higher than finding an equivalent C# library that runs in Unity. (Socket.io is a good example: there exist some for Unity, but they all have problems and limitations, and none of them compare in quality and support to the standard JavaScript socket.io library.)
- pcwalton 8y agoYou've described exactly why I want to integrate Pathfinder into Unity [1]. :) Pathfinder offers a subset of HTML canvas that I would like to expand over the next few weeks and months into the full API. (Ideally it will actually be the HTML canvas implementation for Firefox someday.) There's also the benefit that Pathfinder can transform the canvas in 3D while keeping the content in vector form (i.e. no quality loss), which is important for VR. [1]: https://github.com/pcwalton/pathfinder/issues/147 https://github.com/pcwalton/pathfinder/issues/147
- m463 8y agoWhat a great idea! Ever since I saw this wikipedia SVG animation example: https://upload.wikimedia.org/wikipedia/commons/6/6c/Morphing_SMIL.svg https://upload.wikimedia.org/wikipedia/commons/6/6c/Morphing... ...I've realized SVG has a lot of hidden depths.
- Impossible 8y agoUnity recently added a vector graphics package. https://docs.unity3d.com/Packages/com.unity.vectorgraphics@1.0/manual/index.html https://docs.unity3d.com/Packages/com.unity.vectorgraphics@1...
- newnewpdro 8y agoHave you looked at nanovg? [1] Not a game engine, but it facilitates vector graphics in GL. [1] https://github.com/memononen/nanovg https://github.com/memononen/nanovg