2
\$\begingroup\$

Processing is a Java library for working with computer graphics, providing methods by which to draw primitive objects, custom meshes, etc., as well as mathematical methods (such as Simple Harmonic Motion) by which to animate and control them.

p5.js is an equivalent library for JavaScript and working with graphics on the web. You also have openFramworks which is similar but for C++.

How can you achieve similar graphics capabilities in the Unity Game Engine?

Suppose, for example, I wanted to build a game like Duet. I can imagine how I might go about creating those graphics in Processing or p5.js, but not in Unity and C#. How can you have that kind of creative freedom to build and draw in Unity?

Thanks.

\$\endgroup\$
3
  • 2
    \$\begingroup\$ The bulk of the graphics in Duet would be straightforward to create with just the built-in primitives like Quads and Sprites. What have you tried so far and where did you get stuck? Is there a specific effect or object you've had trouble creating? \$\endgroup\$
    – DMGregory
    Commented Jan 2, 2019 at 17:38
  • \$\begingroup\$ @DMGregory No. I'm not actually building Duet (or I might as a small project), I'm just wondering how you would go about creating those kinds of graphics in particular with Unity. \$\endgroup\$
    – user117136
    Commented Jan 2, 2019 at 17:54
  • 1
    \$\begingroup\$ Try giving us one concrete example of a graphic you want to make in your game that you can't find a way to make with the graphical primitives & techniques you know so far. (I'm presuming you've worked through some basic tutorials about working with mesh objects, sprites, etc...) \$\endgroup\$
    – DMGregory
    Commented Jan 2, 2019 at 18:01

2 Answers 2

1
\$\begingroup\$

This is a really broad question. Unity is a very powerful and feature-rich game engine. It provides you with several tools which can help you to create unique procedural graphic effects:

  • Programming your own shaders gives you a lot of freedom to develop graphic effects on the GPU
  • The Mesh class gives you access to the vertex and UV coordinates of your 3d models. You can use it to deform or even generate new 3d objects at runtime.
  • The methods GetPixels and SetPixels of the class Texture2D allow you to procedurally change or generate textures from C# scrips. But keep in mind that real-time image manipulation like that should better be done on the GPU than on the CPU. When you are going to change a texture every frame, you should rather be doing this with a shader for performance reasons.

And then there is of course a lot of cool stuff you can do with the special effect tools Unity provides to you out-of-the-box:

If I would want to copy Duet in particular, I would do the trails of those red and blue balls with trail renderers. For the after-image of the blocks I would try the motion blur post-processing effect first and when that doesn't give me the effect I want I would use particle effects to generate fading clones of the same sprite used for the block. Those background animations could be done by creating a couple of sprites and animate their transforms with the animation system. When I run into performance problems due to having too many game objects, I would switch to the new Entity - Component - Systems architecture for the background objects.

\$\endgroup\$
0
\$\begingroup\$

making a game like duet should be easily done using unity 2d game objects but any simple art program could make those too and they can be imported into unity as an asset. and if you ever run into a situation where what you want to make is outside your ability i highly reccomend the asset shop on the unity site as people put up graphics and code all the time and some of it is available to be used for free.

\$\endgroup\$

You must log in to answer this question.