About Store Forum Documentation Contact



Post Reply 
LightPoint - Light intensity?
Author Message
Dwight Offline
Member

Post: #1
LightPoint - Light intensity?
Hi all,

Back to Esenthel after a coding workshop, and things are going great! I am creating some game objects, of which one is a particle that also emits light. Shown in the attached image.

However, the edges are quite "hard". Is there a way to soften the edges of a LightPoint? LightPoint takes a Vec(3) as parameter, excluding a possible alpha?

How would I tackle this?

Code:
virtual uint draw()
   {
      if(particles.is() && Frustum(Ball(1.8f, particles.matrix.pos)))
      {
         Vec pos; flt opacity = particles.opacity(&pos);
         LightPoint(0.03f*opacity, pos, Vec(colorl), 0.1f, 0, 0.1f).add(0.0f, this);
      }
      
      return particlesVisible() ? IndexToFlag(particles.renderMode()) : 0;
   }

Drawn in RM_PALETTE.


Attached File(s) Image(s)
   
10-20-2020 03:50 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: LightPoint - Light intensity?
Hello,

Are you sure the hard edges are because of the light and not a particle?

Because I don't have a problem like this with LightPoint.

I'll do some tests though.

If you are sure, can you please provide a reproducible test-case (a sample project so I can test it, or you can modify some tutorials from the engine to reproduce the problem).

Yes the lights take a Vec param without alpha, because alpha is useless for lights.

If you want to fade a light, you can just multiply the Vec color by a Flt alpha.
Since it's in linear gamma, then better use Sqr(alpha), example:
Vec lin_col=Vec(1,1,1)*Sqr(alpha);

Also, what's your 'colorl' value? is it around in range 0..1? Or much bigger? like 100 or something?
10-20-2020 04:12 PM
Find all posts by this user Quote this message in a reply
Dwight Offline
Member

Post: #3
RE: LightPoint - Light intensity?
(10-20-2020 04:12 PM)Esenthel Wrote:  Hello,

Are you sure the hard edges are because of the light and not a particle?

Because I don't have a problem like this with LightPoint.

I'll do some tests though.

If you are sure, can you please provide a reproducible test-case (a sample project so I can test it, or you can modify some tutorials from the engine to reproduce the problem).

Yes the lights take a Vec param without alpha, because alpha is useless for lights.

If you want to fade a light, you can just multiply the Vec color by a Flt alpha.
Since it's in linear gamma, then better use Sqr(alpha), example:
Vec lin_col=Vec(1,1,1)*Sqr(alpha);

Also, what's your 'colorl' value? is it around in range 0..1? Or much bigger? like 100 or something?

Hi Esenthel,

Thank you for the fast response!

colorl is defined as "colorl = obj.getParam("LightColor").asColor().v3;"

In the case at hand, it's Vec(0.251, 0.0, 0.0). Although now with the multiplication of Sqr(0.5f), the edges have greatly improved!

Thanks again!!
10-20-2020 04:38 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: LightPoint - Light intensity?
This patch:
https://github.com/Esenthel/EsenthelEngi...d7d353dc9e

Should help with the problem, however your image looks like it has much bigger problem than it should.
10-20-2020 04:40 PM
Find all posts by this user Quote this message in a reply
Dwight Offline
Member

Post: #5
RE: LightPoint - Light intensity?
(10-20-2020 04:40 PM)Esenthel Wrote:  This patch:
https://github.com/Esenthel/EsenthelEngi...d7d353dc9e

Should help with the problem, however your image looks like it has much bigger problem than it should.

"Bigger than it should" sounds quite reassuring!pfft
(This post was last modified: 10-21-2020 10:12 AM by Dwight.)
10-21-2020 10:12 AM
Find all posts by this user Quote this message in a reply
Post Reply