HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: [Resolved] God's fingers / Light shafts  (Read 2074 times)

PN-Dwight

  • General Accounts
  • *
  • Posts: 465
    • View Profile
    • Pirates' Nest
[Resolved] God's fingers / Light shafts
« on: Dec 02, 12, 05:06:17 PM »

Dear all,

Is there a way to make God's fingers / Light shafts in the engine without using a particle effect (or using planes to resemble them?).

We are currently working on some spotlights for our marine base, and want the player to control the 4 big lights available. It will look better if done in a way like God's fingers.

Lastly, is there a way to let the light be reflected on the surface of the water? [Attached a screenshot for clarification]


(I have a solution, though I would not like to use it if there are other solutions in the engine available: model a plane with the beams and parent it to the lightsource.)

« Last Edit: Dec 07, 12, 02:41:55 PM by HE-Cooper »
Logged

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: God's fingers / Light shafts
« Reply #1 on: Dec 02, 12, 06:04:10 PM »

For the first part, you could use cone-shaped models with transparency, though not sure how that'd look.  Else maybe a billboard, though that would be a plane.  Particles are still probably your best bet.

For the second part, I would doubt it.  Mirrors seem to only render what is above them.  You would probably need another light underwater or fake it with a light map.  I don't know if water really perfectly reflects like that anyways.

**EDIT: For the glow on the wall, SetStencilShape() can be used to create a spherical area of colored shading that looks like lighting, but it seems you can only use it to create one sphere at-a-time.
« Last Edit: Dec 02, 12, 06:37:37 PM by ScottZarnke »
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

PN-Dwight

  • General Accounts
  • *
  • Posts: 465
    • View Profile
    • Pirates' Nest
Re: God's fingers / Light shafts
« Reply #2 on: Dec 02, 12, 06:58:52 PM »

Problem is that these lights are moveable by players themselves... If it was a static light, your input will work.

Im sorry that I forgot to add this *little* detail. Else, the cone with transparancy would do the trick...

[Maybe a feature for HE2 -> Lightshafts] *Winks at Herb*

Stadi_Thompson

  • General Accounts
  • *
  • Posts: 324
    • View Profile
Re: God's fingers / Light shafts
« Reply #3 on: Dec 03, 12, 12:09:15 PM »

There are a few examples of godrays in HJ reference, but are particles. In sapphire if you set the lens effect to the right setting it looks like godrays. old camera and spectral sun I think, you have to experiment and see whats best. The sky must be bright as well to get a good effect.
Logged

Legacy

  • General Accounts
  • *
  • Posts: 117
    • View Profile
Re: God's fingers / Light shafts
« Reply #4 on: Dec 04, 12, 09:01:45 AM »

This is done through the use of meshes (conical or crossed planes) of particles (for vertical light shafts). In one game I was working one the technical engineer did this by using custom shader for those cones that calculated the distribution of light on the cone's surface based on camera viewpoint. Looked great, but I am not sure you can do it in Hero.

For the reflection, you could fake it with decals with alpha and additive blending, but I am not sure this can be done (so far I was not able to get even normal decals working in Hero).
Logged

HE-Cooper

  • *****
  • Posts: 2221
    • View Profile
Re: God's fingers / Light shafts
« Reply #5 on: Dec 04, 12, 09:53:51 AM »

Yeah, this isn't going to be some checkbox implementation that we do, as even if we tried a generic one, it would need to be dramatically different based on what game did what and how the game was styled. Most environments would look very odd with visible cones of light, as that doesn't actually happen in the real world unless there are particles in the air the light refracts off of like dust or fog.

Not knowing your game design, but assuming you are doing some sort of players moving spotlights around to show and or target things, I would either gamify it, meaning make it a notable game element that isn't meant to be realistic looking, or create an FX group that simulates what you need with textures and meshes but that also wires into a game system where values are passed in from script to manipulate the FX itself. ie, like how in the FPS Ref we have a "fire weapon" FX group that throws all of the particles at a tracked point in space, and that point is passed in from script.
Logged

Prometheus2012

  • General Accounts
  • *
  • Posts: 662
    • View Profile
    • Exile-Online
Re: God's fingers / Light shafts
« Reply #6 on: Dec 04, 12, 12:11:30 PM »

Yeah, this isn't going to be some checkbox implementation that we do, as even if we tried a generic one, it would need to be dramatically different based on what game did what and how the game was styled. Most environments would look very odd with visible cones of light, as that doesn't actually happen in the real world unless there are particles in the air the light refracts off of like dust or fog.

Not knowing your game design, but assuming you are doing some sort of players moving spotlights around to show and or target things, I would either gamify it, meaning make it a notable game element that isn't meant to be realistic looking, or create an FX group that simulates what you need with textures and meshes but that also wires into a game system where values are passed in from script to manipulate the FX itself. ie, like how in the FPS Ref we have a "fire weapon" FX group that throws all of the particles at a tracked point in space, and that point is passed in from script.

Sounds very resource intensive.

PN-Dwight

  • General Accounts
  • *
  • Posts: 465
    • View Profile
    • Pirates' Nest
Re: God's fingers / Light shafts
« Reply #7 on: Dec 04, 12, 01:12:13 PM »

Well, replicating the rotation of the light every X miliseconds in that area might be resource intensive; though that is most likely the only area, and there are only 4 lights :)

What about light reflecting on water? any ideas? (Besides checking the rotation, and then spawning a semi-transparant plane at the water surface to let the light shine through?)

HE-Cooper

  • *****
  • Posts: 2221
    • View Profile
Re: God's fingers / Light shafts
« Reply #8 on: Dec 04, 12, 02:54:29 PM »

Again, I don't know what your game design is, but needing to replicate anything at the milisecond level between players and have it matter is a terrible idea, and if your game design requires it, I would rethink the design. Regardless of whether you do it with particles or with an internal engine graphical feature, it's the replicating that data between players that will be the issue, not the graphical rendering or particles.

Bouncing actual real time rendered lightsources off of water at the graphical level is a thing reserved for the Cry Engine (which I honestly don't even know if it does). :-) If it's actually a necessity to your game design, then you could just use math, have there by two lights at all times, player controls light A, collide at x calculated distance, *do something*, angle of incidence, procedural change light B to point off in new direction, etc.

But personally, if I was your producer, I'd probably just cut that feature and make you do something else. of course, if I was your producer I would have cut making an MMO focused on water in the first place. :-P
Logged

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: God's fingers / Light shafts
« Reply #9 on: Dec 04, 12, 04:09:25 PM »

To expand on what Cooper was saying about the reflection, its actually pretty simple by putting a light underwater shining upward.  I attached a diagram.  For a light which is h distance above the water with a vertical angle of theta, there is a light underneath with the same cone, distance, etc. but which is h below the water and whose angle is -theta so that it shines upward.  As the one above would change position/angle, change the one underneath to be the same but with vertical position (relative to water) and angle reversed.  The bottom one will shine on the walls or whatever at the right spot, size, etc as if the one on top was reflected.

If you make a plane at the water surface that reacts to light, it can show a spotlight at the surface where the light hits it.

And best of all, if the one above will only shine on the water, it does not need to be an actual light source. Just have a model to represent the light, but the only real lights are underwater.

Now, you still would not have visible rays, but it at least addresses the reflection easily enough.
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

Legacy

  • General Accounts
  • *
  • Posts: 117
    • View Profile
Re: God's fingers / Light shafts
« Reply #10 on: Dec 05, 12, 12:28:58 AM »

I don't think Dwight needs the light to bounce from water's surface and shine on other objects, guys... He was just asking for reflection on water's surface. I guess this means he'd like to have a circle of light projected onto the water's surface (to fake the end of his light-cone).

As I said before. Try to experiment with decals and additive blending. This should work pretty well.
Logged

PN-Dwight

  • General Accounts
  • *
  • Posts: 465
    • View Profile
    • Pirates' Nest
Re: God's fingers / Light shafts
« Reply #11 on: Dec 05, 12, 01:35:24 AM »

I don't think Dwight needs the light to bounce from water's surface and shine on other objects, guys... He was just asking for reflection on water's surface. I guess this means he'd like to have a circle of light projected onto the water's surface (to fake the end of his light-cone).

As I said before. Try to experiment with decals and additive blending. This should work pretty well.

Cooper missed the board there a bit, good thing you are not my producer :P. This was exactly what I was talking about :)

Thanks for the input!!

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: God's fingers / Light shafts
« Reply #12 on: Dec 05, 12, 10:24:59 AM »

I was thrown off by the spots on the walls. Nevermind :-[
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

HE-Cooper

  • *****
  • Posts: 2221
    • View Profile
Re: God's fingers / Light shafts
« Reply #13 on: Dec 05, 12, 10:30:15 AM »

Agreed. You want to "project" onto the water. Not "reflect" off of the water. Semantics wins again.
Logged