Scripts / Distance-based fading?

Author
Message
Avenging Eagle
18
Years of Service
User Offline
Joined: 2nd Oct 2005
Location: UK
Posted: 4th Apr 2020 17:03
I have a feeling I know the answer to this but...
I've been playing around with shafts of light using decals.



These look great from a distance, but not so good when the player passes through the mesh. It would look better if I could fade the light ray decal out before the player gets to it.

So my question is this - can you fade an entity out based on distance to the player?

AE

Attachments

Login to view attachments
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 4th Apr 2020 17:41
Wow, that's a real nice effect!
Yeah, I was trying to script decals once. Was was told that "they weren't
physical entities!" All the options for entities should be added to decals.
But my attempt was to place physics to the decals. Maybe visual effects
could be possible?
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 4th Apr 2020 18:53
Best you can do with decals is position them or turn them on or off depending on player position.

A custom shader would need to be created to allow for any effects.

Alternatively use the decal sheet in a particle emitter then you can control the alpha in real time.




Been there, done that, got all the T-Shirts!
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 4th Apr 2020 21:25 Edited at: 4th Apr 2020 21:30
you can't scale decals?
i would think as long as the origin is at the tip of the light it would look fine to scale the decal smaller as the player approaches
i.e. (i forget if Scale() is 1 or 100 for normal size in GG)
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 5th Apr 2020 02:53
You can scale them but scaling them smaller usually just makes them look more intense and a bit weird tbh.

For example the light smoke at full scale looks like fog but scaled down looks like snowballs!
Been there, done that, got all the T-Shirts!
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 14th Apr 2020 18:09
What if you scaled them a little bit (mostly 'Y' axis), but primarily moved
them UP toward the ceiling and out of view according to player position?
When quite close, they could be fully outside the building...

Wait, I just thought again...
Instead of scaling them smaller 'Y', scale them larger 'Y', and move them
UP and out exponentially-- would that create a dissipation effect?
PM
cybernescence
GameGuru Master
11
Years of Service
User Offline
Joined: 28th Jan 2013
Playing: Cogwheel Chronicles
Posted: 19th Apr 2020 16:07
Quote: "So my question is this - can you fade an entity out based on distance to the player?"


yes I posted a shader somewhere on the forum not that long ago when Teabone asked about it - allowed entity fade based on distance set. Found them - here:

https://forum.game-guru.com/thread/221164#msg2621788

https://forum.game-guru.com/thread/221055#msg2619986

Cheers

GPU: GeForce RTX 2070 SUPER PassMark: 14817

Login to post a reply

Server time is: 2024-03-29 15:38:19
Your offset time is: 2024-03-29 15:38:19