1
\$\begingroup\$

I would like to be able to produce a texture that essentially represents a 2D vector field (eg red represents vector {1, 0}.

What I would like is to draw a path and the vector at the point on the path should be tangential to the path. Ideally, I would like the path to be thick (i.e. the points on the path are the tangent colour and then all points within r perpendicular to the path at that point are a smaller version of that vector). All other points would have the zero vector.

So for example, if I had a circle path, the vectors would push a particle around the circle.

How would I easily produce this texture? I am currently considering writing a tool that parses a SVG file and produces a bitmap that can be used but I'm wondering if there are existing tools that do this already.

NB: I tried to tag this with "vector-fields" as I believe this could be a common theme (since UE4 supports using them with particles), but don't have enough rep to create the tag.

\$\endgroup\$
  • \$\begingroup\$ You can play with a fragment shaders on a fullscreen quad. \$\endgroup\$ – ratchet freak Sep 18 '14 at 14:06
  • \$\begingroup\$ I'm not really sure what you mean or how this would help me produce the required textures, could you elaborate? \$\endgroup\$ – T. Kiley Sep 18 '14 at 14:35
  • \$\begingroup\$ What do you need - calculating those vectors or storing them in a texture(you already have them)? If it is the first option, you should probably try some math-oriented site instead. \$\endgroup\$ – wondra Sep 18 '14 at 15:48
  • \$\begingroup\$ I have now actually just written a tool that converts SVG to BMP in the way described (prep-ing an answer now) but the original question was a tool/library that would automatically produce the texture as the artist drew the texture - i.e. computing the vectors and colouring the line accordingly as the artist draws the path. My solution is a process that I run the file through after which will slow down iteration. \$\endgroup\$ – T. Kiley Sep 18 '14 at 15:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.