Best 'Polar' option to save pinched triangles

I can’t think of any other approaches than mesh or polar coords…

But I’ve started seeing the power of Polar coordinates on a flat quad/billboard rather than revolving a mesh

it helped me fix seams quickly from pinched triangles without having to throw a ton of uv/vertex info into engine

basics

  1. polar UV
  2. two panning textures multiplied with offsets to give hypnotic interference
  3. input Max Remap to overexpose texture; it thicken the lines at the center so you can fake some uniformity

polarBrighter_01

though a Mesh can save overdraw you can save batches and vertex while gaining higher level animation…
with the above 1 particle with size and color changes can do this polarBrighter_02

now I’m curious what other cool ideas are out there because other than this and a revolved mesh I’m out of ideas.

22 Likes

Wow, this looks so organic and 3 dimensional! Definitely gonna try this out!
Can you explain more about the remapping part? what exactly is the math doing there

It feels like levels/curves in photoshop +ramp as input to make it variable across UV’s

I think this break down will help more
ramp fed to the input Max
that defines the threshold when non white becomes full brightness polarBrighter_04

so with 0.5 as inputMax → 50% grey get’s remapped to the output of 1 = 100% white
So now it is like gradient over_exposure

I need to put more time into finding new ways to use it, I’m too into this 1 use and
rotating the previous panning texture 90 degree +a purple hue shift gradient
polarBrighter_03

EDIT
just to confirm it is multiply but since the output defines the boundaries it comes with offsetting to prevent 0’s


see with a simple multiply you’d have to compensate for the ramp down to black, remap handles it for you so it’s cleaner node use : at least cleaner to look at.

6 Likes

It’s like lerp, but instead of mapping 0-1 => Min-Max, it maps InputMin-Max to OutputMin-Max

Oh thanks for the breakdown! I missed the part where you uses polar coordinates to feed in the remap node so I was confused, thanks!

Ahhh that’s such an easy way to explain it. I’ve always just used power and multiply to add contrast to a texture, will try remap next time!

I am a bit suprised that you don’t see any mip mapping seams / blurring without using tex2dgrad (because that happened to me for sure more than once when using polar coordinates) :+1:.

just a note, we’ve a huge polar-thread here: How do I make a radial UV texture coordinate map?

2 Likes

I am a bit suprised that you don’t see any mip mapping seams / blurring without using tex2dgrad (because that happened to me for sure more than once when using polar coordinates) :+1:.

it is a problem; you have to disable mips

we’ve a huge polar-thread here

Bgolus noted that here disable mips or you get a horrible seam, as for point filtering I was able to leave it bilinear in most views.

you guys just gave me the silliest idea… how can I keep mips?
Im using 2 textures anyway, what If I rotate 1 and LERP them with
image
(If only I could figure out how to make that in shader maths… for time I just made it in photoshop)

it works, here I am sliding the LERP On vs OFF :laughing:
sillyPOlarLerp

4 Likes

Can you input explicit derivatives on your texture sampler? Here’s an unreal example:


This way, it’ll use the original UVs to calculate the mips, instead of the polar ones. I highly recommend keeping mipmaps - bunch of issues might arise from disabling them

7 Likes

I do not know where to learn that in Unity I will xpost to Unity to see if I can get info

https://forum.unity.com/threads/texture-sampler-urp-explicit-derivatives.1252902/

Somewhere in the unity forum is a post by bgolus (and only a few posts back in the thread bruno posted) in which he explains exactly what bruno is proposing. You calculate ddx and ddy of the regular uvs and use a different sampling function tex2dgrad() instead of tex2d() (which isn’t a node in shadergraph for some reason, but you can simply use it in a custom function node).

Nevertheless hiding it the way you did obviously works as well if your texture allows it :smiley:

1 Like

You calculate ddx and ddy of the regular uvs and use a different sampling function tex2dgrad() instead of tex2d() (which isn’t a node in shadergraph for some reason, but you can simply use it in a custom function node).

unfortunately this goes outside my skillset.

I found one about accessing mip levels in the frag
https://forum.unity.com/threads/calculate-used-mipmap-level-ddx-ddy.255237/

So maybe if I tell the frag what mip is used that could work too? Shader graph has a LOD sampler and override the mip manually
:exploding_head:
wait a second would that work? it works?!
lodsampler2D
but is it okay to do that? i just leave it at 0 and that would mean it is unoptimized from far

OMG box trilinear works so well for morphing!
lodsampler2D_02

6 Likes

using tex2dLod to set a specific mip level does indeed get rid of the seam too. I would not really worry about optimization, yes you keep using the highest mip level but I would argue that you would not spawn such an effect incredibly far away or heavily rotated away from the camera. But you might get some artifacts because you dont sample the downscaled mip versions (again there is an excellent medium article by bgolus about this xD)

sorry calculating ddx and ddy sounds needlessly complicated. It is very much just recreating the setup from bruno UE screenshot in shadergraph and the nodes are nearly the same. I didn’t want to blow this more than necessary but I am very happy that you were inspired and figured out some more approaches. The morph in the last gif looks great.

If you’re doing twirly flames polar coord are probably best. If you’re going for a different look there are a couple other ways to push pixels from the center of a plane.

ZoomLoop You could zoom in on a texture and swap it in and out like a flowmap.

Or you could pan it out from the center at various angles. Which makes it look like a kaleidoscope.

kaleidoscope

9 Likes

great points!

  • flow maps for clouds, especially to zoom/truck-in/out seems to be the best radial motion approach. I have seen that before and the results are fantastic.

  • kaleidoscope (pseudo mirrored) gives that uniformity benefit perfect for facet polygonal shape that are not intended to be circular e.g. architectural or technology/ huds/ laser shields etc

That’s amazing! I can’t remember seeing something like that done before (emphasis on can’t remember)
Thanks so much for sharing :star_struck:

Nice Radial UV Shader: https://twitter.com/Cerva_saiki/status/1584282244943781888
(they seem to get rid of the seam by lerping another texture in. this also makes it nicely tilable)

2 Likes