ScreenPosition Parallax, Locked Axis? (Unity - ShaderForge)

Hey Folks,

Is it possible to lock the axis of a Screen Position material in Unity using ShaderForge?

Screen Position is great for that parallax effect that follows the camera, but I’d like to use it for a projectile trail. It does the revealing part very well but that’s about it. It would be an issue if I used it as a projectile trail since it doesn’t follow the angle of the mesh.

I think it would be a much nicer solution instead of having a trail that slingshots/stretches with the panning texture. I’m definitely using ScreenPosition for other stuff though. Any Ideas?

P.S. Looks like I can just set my trail to “tile” and it’ll have the same effect. I’d still like to know about ScnPos. though! :laughing:

I’m a little confused by what you want to use screen space projection for. It seems more like you want a camera facing, velocity / directionally aligned particle that uses a gradient to appear or “unrolls” like it’s attached to the original firing position. None of that is using screen space, unless you wanted the width of the effect to be locked to the screen as well.

The way I would do (and have done) an effect like this, assuming you want a projectile that leaves a trail, but which travels in a straight line for a consistent distance, is to draw the trail using a single velocity aligned quad particle, and use a shader that uses the alpha to reveal it with a panning gradient (usually just using a UV and some math) rather than just fading in. If it needs to only go a certain distance, like if it hits a wall, I do a trace and calculate the relative alpha value to make it look like it stopped at that distance and then clamp the alpha either in the shader or from script depending on how the alpha value’s animation is being driven.

I hope this illustrates what I mean better. I created an animation along with a basic image.
The texture is aligned in world space and is revealed by the trail’s alpha. In my animation, the first trail is what I want. The second trail is what generally happens.

I’m asking if there’s a good setup in ShaderForge that I can apply to my trails. I’m not a technical artist (just an artist).

I believe I understand what your saying- I should use a gradient (like a wipe effect) over distance/lifetime. However, wouldn’t the texture still stretch/move since its tied to the geometry? That’s what I’m trying to get around to create a “drawn out” effect.

1 Like

Ah, yes. What you want still had nothing to do with screed space btw, this is just a different behavior for handling UVs. Some people expected this to be added in Unity 5.5 with the “tiled” texture option, but that doesn’t work like you would expect. Supposedly 5.6’s “wrap” texture option is what you want, but I haven’t tested it myself yet to see if its working.

It’s been a frustration for a long time for many of us Unity users.

Ahhh, good to know. At least I can use it for cool parallax effects.

Yea, your right about the tiled option. It works to a degree, but doesn’t allow you to scale how it tiles (which is a problem if you have a detailed texture that you want to tile over a longer distance/stretch). Also, I don’t see a “wrap” option in Unity, just a “wrap mode” (repeat/clamp).

Yea, I can understand that frustration- that and having camera facing mesh particles would be nice :sunglasses:

1 Like

Aye, I’ve got one more question about trails-

Is there a “Velocity Trail Renderer” setting in Unity? In Unreal Engine 4 you can set the velocity to positive/negative for gravity. That way you can have a flowing ribbon that will also follow the sources movements.

I’m pretty sure that’s what’s going on in Kindred’s Wolf FX. I haven’t seen a setting like this in Unity so far.

Unity has an inherit velocity setting for particles, but there’s not anything like that for the trail renderer.

I’m pretty sure League is just using a panning texture to give the illusion of movement, as best I can tell apart from scaling the trail is stationary.

Aye, I see. To me it looks like it’s a ribbon (with a panning texture) since it adapts and waves around. A stationary trail would immediately collapse once it stopped moving and would need to move fast to have a trail that long.

I think I’ll just have to fake that aspect since my pieces are stationary anyways. I’ll just use a plane with a warped/vertical panning texture for a wavy aura. Hopefully they add velocity or something like that to trails soon.

Yeah the particle trails are still pretty basic in Unity.

It would be better if the Trails actually were connected particles so they could be simulated after creation (with the noise module for example). Right now the particles just drop mesh segments behind them exactly like the Trail Renderer component

These trails are also pretty weird to work with as they really don’t preview well in Editor mode (using a single local-space particle. eg. jet-pack or rocket trail)

Agree with @bgolus that the UV types is missing the world space feature, this is the type of UVs you are looking for.

fyi, CryEngine has outstanding particle trail support (especially their new particle engine)