Volumetric lightcones

Get some cool tips about how to tweak your UT graphic, gameplay, and much more!
Post Reply
Higor
Godlike
Posts: 1866
Joined: Sun Mar 04, 2012 6:47 pm

Volumetric lightcones

Post by Higor »

A lil informative game.
Guess and tell me how you think I made it, and I'll post the code/test package :loool:
Attachments
Shot0021.jpg
Shot0020.jpg
User avatar
Shadow
Masterful
Posts: 743
Joined: Tue Jan 29, 2008 12:00 am
Personal rank: Mad Carpenter
Location: Germany
Contact:

Re: Volumetric lightcones

Post by Shadow »

You're letting some sprite actors to be rendered on a line, like 32 sprites for each cone
Image
Higor
Godlike
Posts: 1866
Joined: Sun Mar 04, 2012 6:47 pm

Re: Volumetric lightcones

Post by Higor »

Shadow wrote:You're letting some sprite actors to be rendered on a line, like 32 sprites for each cone
Exactly.
I had a few inconvenients calibrating the distances and 2D 'expansion' the sprites had, giving a weird cone.
But it worked after a few arbitrary adjustments (no theoretics at all, but worked).

The sprites are created in runtime except for the master sprite.
The master sprite holds the normalized direction the new sprites should go, as well as the amount of child sprites, and target size/darken should be.
The child sprites inherit the master sprite's texture and style... but with some nice randomized hardcoded water/ice textures, a nice fog effect inside the cones can be simulated.

Code: Select all

//=============================================================================
// FV_ConeMaker.
//=============================================================================
class FV_ConeMaker expands Decoration;

var() int Cones;
var() float FinalMult; //Final Scale multiplier (glow divisor)
var() vector Dir; //Normal of dir to spawn shit
var() float TotalDist;
var float FinalGScale;
var float FinalDScale;

simulated event PostBeginPlay()
{
	local int i;
	local float alpha, fFactor, fCur;
	local FV_ModuParticle curM;

	if ( Level.NetMode == NM_DedicatedServer )
		return;

	FinalDScale = DrawScale * FinalMult;
	FinalGScale = (ScaleGlow / FinalMult);
	FinalGScale = ((FinalGScale * 3 + ScaleGlow) / 4) - FinalGScale; //Preserve some light scale
	Dir = Normal(Dir);

	fFactor = (1.3 ** (1+FinalMult) ) - 1.3;
	While ( i<Cones )
	{
		i++;
		alpha = ((1.3 ** (1+(FinalMult * i / Cones))) - 1.3 ) / fFactor;
		curM = Spawn( class'FV_ModuParticle',,, Location + Dir * TotalDist * Alpha);
		curM.DrawScale = DrawScale + (FinalDScale - DrawScale) * Alpha;
		curM.ScaleGlow = ScaleGlow + (FinalGScale - ScaleGlow) * Alpha;
		curM.Style = Style;
		curM.bUnlit = bUnlit;
		curM.AmbientGlow = AmbientGlow;
		curM.Texture = Texture;
	}
}
On the formula determining the interpolation points between 0 and 1 (alpha), instead of doing it in a linear fashion I had to employ an exponent on (1.3 ^ (the actual alpha) - 1.3) (1.4 works too, it's the SQRT(2) after all), that is because the sprites are square and would make the cone look very weird otherwise.

EDIT:
Base values for the screenshot:
Texture = Texture'XFX.inoxxy'
Style = STY_Translucent
DrawScale = 0.300000
ScaleGlow = 0.200000
bUnlit = False (should be true... well)
Cones = 15
Dir = (Z=-1) and (Z=1)
FinalMult = 5.000000
TotalDist = 600.000000
User avatar
papercoffee
Godlike
Posts: 10448
Joined: Wed Jul 15, 2009 11:36 am
Personal rank: coffee addicted !!!
Location: Cologne, the city with the big cathedral.
Contact:

Re: Volumetric lightcones

Post by papercoffee »

How to use this beauty ???
Higor
Godlike
Posts: 1866
Joined: Sun Mar 04, 2012 6:47 pm

Re: Volumetric lightcones

Post by Higor »

Well, ideally you should really embed this into maps in order to allow better customization and networking (1 less package).
Which is how I actually did it.

If somebody had some nice ICE/WATER textures with some distortion on them, a very cool fog effect might come out of it.
I'll have a U package tomorrow...

Some more eye candy:
Attachments
ThePlanet_Lights1.jpg
Higor
Godlike
Posts: 1866
Joined: Sun Mar 04, 2012 6:47 pm

Re: Volumetric lightcones

Post by Higor »

Opps, I forgot about the particle class:

Code: Select all

class FV_ModuParticle expands Effects;

defaultproperties
{
    DrawType=DT_Sprite
}
There, subclassing effects sets automatically RemoteRole to ROLE_None.
User avatar
Creavion
Godlike
Posts: 4497
Joined: Sun Feb 17, 2008 7:23 pm
Personal rank: About to be non-act.
Location: Germany, Lower Saxony

Re: Volumetric lightcones

Post by Creavion »

Too sad, nice stuff like this "always" comes too late.
About to be non-active
My very last UT map project: CTF-FacePalm (tropical CTF-Face remake)
Why do I leave? click here
What I want to do next: Joining an UDK team (uncertain however) and improve 3D modelling and texture editing skills
Thanks to those who visibly supported me until/at the end!
My reactivated account on indiedb.com.
Post Reply