Lighting engine?

Discussion and feedback on Construct 2

Post » Wed Feb 22, 2012 9:13 pm

In some of that games i believe it's a custom made lightning. But it has nothing to do with ray tracing. In other cases it's per pixel lightning done with pixel shaders most likely. This and much more will be possible when C2 get's the full power of webgl, that is, shaders. Terraria for example in earlier versions used a custom made grid lightning system. I saw somewhere that it now uses pixel shaders. It's more efficient on most hardware, and easier to code. I believe most of this examples can be done in Construct Classic too.Kiyoshi2012-02-22 21:16:25
B
58
S
13
G
10
Posts: 632
Reputation: 12,505

Post » Wed Feb 22, 2012 9:32 pm

Thanks a lot for your answers.

Kiyoshi> What do you mean by "custom made lighting"?
I was pretty sure it's not "cheated" since the lighting is reacting in real time.

Are those Webgl shaders planned by the devs? Or is it an assumption?
B
6
Posts: 34
Reputation: 643

Post » Wed Feb 22, 2012 9:46 pm

This topic has grid based fov lighting:
http://www.scirra.com/forum/grid-based-lighting-field-of-view_topic44662_page1.html?KW=fov

It appears to be close to the effect you're looking for.
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Wed Feb 22, 2012 11:46 pm

See the Lighting.capx file in the examples directory. You should be able to make more advanced lighting techniques by working from that basic example, it's a very simple demo.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,518

Post » Thu Feb 23, 2012 1:46 am

[QUOTE=Ashley] See the Lighting.capx file in the examples directory. You should be able to make more advanced lighting techniques by working from that basic example, it's a very simple demo.[/QUOTE]

[QUOTE=Stampedo] [QUOTE=sqiddster] I don't see what the difference is between this and the lighting example provided by scirra.[/QUOTE]

If you're refering to the screen mode layer - fake lighting example, you should watch this video and get to the conclusion that it's nowhere near from this.

http://youtu.be/HhWphSiCl4E

It's like the lighting is calculated within "rooms", and not as an overlay effect.

It may be a raytrace engine as someone suggested above, that's why I'm asking your opinion (and devs opinion).

Thank you.[/QUOTE]

I appreciate the fact that you're taking the time to answer to my question, but as I said earlier in this post, that's not the kind of solution I'm expecting.

Are you planning in the future to integrate WebGL's shaders? (obviously I don't know what I'm talking about)

[QUOTE=R0J0hound] This topic has grid based fov lighting:
http://www.scirra.com/forum/grid-based-lighting-field-of-view_topic44662_page1.html?KW=fov

It appears to be close to the effect you're looking for.[/QUOTE]

Thanks for pointing this out, but that's not exactly what I'm looking for, I'm really expecting a real lighting engine (as Kiyoshi said, it may be related to WebGL and shaders).
B
6
Posts: 34
Reputation: 643

Post » Thu Feb 23, 2012 1:49 am

Summarizing the topic: the ability to do this kind of lighting may come eventually, but don't make any plans around it.
B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Post » Thu Feb 23, 2012 2:15 am

The link you posted is not a "real" lighting engine either, I don't think. If you look carefully parts of the shadows are "banded" which makes me think it's implemented just like the lighting demo in Construct 2, but with more sprites of customised shapes and some more advanced calculations to determine the opacity of each masking sprite. So it's just a more cleverly done version of the overlay lighting effect.

We do plan to introduce WebGL shaders at some point, but these are just effects that run in 2D. They're not going to do much for you beyond the overlay effect Construct 2 already has.Ashley2012-02-23 02:16:31
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,518

Post » Thu Feb 23, 2012 7:22 pm

Ashley> It looks like you were right, big up to you.
Here's a quote from Project Zomboid's dev:

[quote]In any case, it's done with multiplied overlay quads with vertex colours, since the tiles are 2D, so it's all completely faked. Not the fastest but we'll hopefully optimize it as we go. Problem is with iso viewpoint is the draw order is rigid so it means it's difficult to optimize to avoid binding new textures each draw.[/quote]

I'd be very interested into an advanced tutorial of this technique, since its still obscure to me.
B
6
Posts: 34
Reputation: 643

Post » Thu Feb 23, 2012 7:27 pm

Ashley> I assume that using shaders would save a lot of time and performances, and possibly looking prettier.

The overlay technique is an old schoolish approach, yeah you can do that but I'm guessing that using this on a large scale project is awfully time consuming.
B
6
Posts: 34
Reputation: 643

Post » Thu Feb 23, 2012 7:37 pm

I don't think it would be time consuming it all.

At start of layout, for each light source, create light object.
Always set position of light to light source <- takes care of moving light sources

Two events and you're done.
Moderator
B
87
S
32
G
33
Posts: 3,005
Reputation: 27,397

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: Avengium, MadSpy and 12 guests