How to make in-progress sprites have blueprint graphics?

In my game, every placeable object and structure will only be placed as a blueprint, which the characters will then automatically build.

An example from "RimWorld":

Objects placed as blueprints:

blueprints

Objects when finished:

finished

My initial thought was a shader of some sort, where we’d take the thickest black lines and convert that into the blueprint outlines. However, I have no prior experience with shaders so I don’t know how to do this.

The second option is making a separate blueprint texture for every single object which seems very tedious.

What’s the easiest way to implement this? Other than the mentioned options, is there any other way of doing this?

Is a point inside a graphics group composed of multiple Polygons and FilledCurves, not all overlapping?

I have many thousands of points, and I want to check if they are inside a GraphicsGroup that is composed of many Polygons and FilledCurves, similar to GeoWithin but without having to make tedious cloud inquiries.

I get RegionMember Errors and besides I suspect RegionMember is too smart to do a simple 2D numerical True/False test efficiently.

I’ve done this once many years ago by counting if a line from the point to infinity crossed all of the polygon segments an even or odd number of times, but would expect Mathematica to have an function already.

Graphics Ticks function evaluation on Wolfram Cloud

I have been trying to get something like ResourceFunction["GraphicsInformation"] to work in the cloud – however, it looks like the tick and grid functions are evaluated in some strange place, and not the main kernel: Consider e.g.

Graphics[{},Frame->True,FrameTicks->((range={##};{})&)] 

When displaying this plot on the desktop, the range variable contains the plot range, as expected. In the cloud however, the variable is not set. Does anyone know exactly is going on, and, more importantly, is there a workaround that allows you to get data from the ticks function back into the main kernel?

Facing text in 3D graphics with full options

I’m seeking a refinement/extension of the excellent and very valuable solution appearing here.

That solution indeed allows you to place text anywhere in a 3D graphics and then rotate it (by Euler angles) so it faces any direction you like.

However… it has two important limitations for my application:

  • For some reason it does not handle subscripts and superscripts: they are lost and not rendered
  • The solution does not allow a background color, such as Background -> White. (I need this when I’m placing a label atop a black line and want to hide a short section of the line.)

In sum: I’m hoping to get a version of text3D that could work with Style, of the form:

text3D[Style[Subscript[x, o], Italic, 24, Background->Yellow],  {x-position, y-position, z-position},  EulerAngle1, EulerAngle2, EulerAngle3] 

Minor point: I think the Euler angles should be grouped into a List… but again, minor suggestion:

text3D[Style[Subscript[x, o], Italic, 24, Background->Yellow],  {x-position, y-position, z-position},  {EulerAngle1, EulerAngle2, EulerAngle3}] 

Pass equations into shaders to define graphics – HLSL or other shaders

Is it possible with HLSL (or other popular shader languages) to pass instead of an image, an equation that would define the pixel color / position output by the shader? This would allow for more dynamic drawing of smooth shapes that could be sampled with infinite detail. They would also by able to change and morph in real time.

Not sure how this is possible without passing a string with the eq to the shader and having it parse it. Seems like that might lose all the performance gained by putting it onto the GPU.

Cannot get aspect ration to 1 with simple Graphics

I am learning Mathematica and doing a simple animation project which animates the harmonic motion of a pendulum. For some reason, I cannot get the simplest thing to work — the aspect ratio for my pendulum graph will not go to 1. I have whittled my code down to something extremely simple that illustrates my problem:

Graphics[Line[{{0, 0}, {.5, -.5}}], Axes -> True, PlotRange -> {{-1.1, 1.1}, {-1.1, 0}}, AspectRatio -> 1]

Output of the code above

Stretchable parentheses in text labels in Graphics

I’m trying to annotate a plot with points of the form $ \left(\frac{1}{2},\frac{1}{2}\right)$ ; my problem is that the parentheses don’t stretch to cover the fraction. I think that what I want to do is to use a StyleBox inside the Graphics primitive to allow me to format the string using SpanMaxSize, but StyleBox is not a text string. I cannot figure out how to make this work. Is there an easier way?

So for example, if I use

Graphics[Text[Style["(1/2,sqrt(3)/2)", Black, 12], {-1.1, .8}]] 

with the 1/2 and sqrt(3)/2 formatted in OutputForm, I get enter image description here

Using fewer mesh lines, 3D graphics

    I want to make the Final use fewer mesh lines,      the ideal version will look like the second image.     Where the triangle shape is more clear and clean. Can anyone give me some advice on how to fix my code?  

ex1 = ParametricPlot3D[{(3 + Cos[v]) Cos[u], (3 + Cos[v]) Sin[u], Sin[v]}, {u, 0, 2 Pi}, {v, 0, 2 Pi}, Boxed -> False, Axes -> False]

mesh = Import[Export[NotebookDirectory[] <> "ex1.stl", ex1]]

edges = MeshPrimitives[mesh, 1]

Final = Graphics3D[Map[Tube[#, .05] &, edges[[All, 1]]],Boxed -> False]

First image

Second image

Placing text over a rectangle using graphics

I need to add some text to rectangles that I am using as a scale bar. I want the text right above the rectangle and centered. Here’s my code:

Show[{Graphics[{Red, Rectangle[{0, 0}, {45, 15}]}, ImageSize -> 48],    Graphics[Text[Style["TEXT", 12, "TR", Black, Bold]]]}] 

enter image description here

Desired result:

enter image description here

How can I do that?

Edit: Ideally it should also work if the text is longer than the scale bar, like so:

Graphics[{Red, Rectangle[{0, 0}, {19, 15}],    Text[Style["TEXT", 14, "TR", Black, Bold], {10, 22}]},   ImageSize -> 19] 

The bar crops some of the text: enter image description here

slow and jerky Graphics in 12.1 compared to older version 9.0

Consider the following piece of code

Manipulate[ Graphics[ {{Gray, Line@Table[RandomReal[1.5 {-1, 1}, {2, 2}], {10000}]}, Dynamic[Disk[{0.1 a Cos[a], 0.12 Sin[a]}, 0.1]]}, PlotRange -> 1.5, FrameTicks -> False, Frame -> True], {a, 0, 4 \[Pi]}] 

Running the above code I find that the Graphics in newer versions of Mathematica (e.g. version 12.1) are jerky and are rendered considerably slower. I ran the same code in version 9.0 and it runs relatively smoothly.

Does someone know why this is so? and what changed between the older and the newer versions of Mathematica?