ID:2389314
 
Code:
/obj/screen/plane_master/floor
name = "game world plane master"
plane = 0
blend_mode = BLEND_MULTIPLY
invisibility = INVISIBILITY_LIGHTING
color = list(null,null,null,"#0000","#000f")

/obj/screen/plane_master/game_world
name = "game world plane master"
plane = 1
blend_mode = BLEND_OVERLAY
invisibility = INVISIBILITY_LIGHTING
appearance_flags = NO_CLIENT_COLOR | PLANE_MASTER | RESET_TRANSFORM | RESET_COLOR | RESET_ALPHA | KEEP_TOGETHER

/obj/screen/plane_master/lighting
name = "sun lighting plane master"
plane = -1
layer = LIGHTING_LAYER
blend_mode = BLEND_ADD
icon = 'icons/effects/alphacolors.dmi'
invisibility = INVISIBILITY_LIGHTING
appearance_flags = RESET_TRANSFORM | RESET_ALPHA | PLANE_MASTER
mouse_opacity = 0


Problem description:
I'm using 4 planes: lighting plane (-2), sunlighting plane (-1), floor plane (0) and game plane (1).

What doesn't work fine is a transition from lightings to floor and game plane. Lightings only applies to floor plane normaly while game plane applies to previous planes combined.

So that's why i need to apply sunlighting plane to lighting plane and game plane to floor plane at first instead of basic order. And only then to apply combined planes to each other.

Is there any way to do that?
I'm really not sure I follow how you're trying to put these together, but I know your order is way wrong. If you want lighting planes to affect the floor plane, they have to go above it. They have lower numbers instead, so they'll be drawn first and won't affect the floor at all.
In response to Lummox JR
Lummox JR wrote:
I'm really not sure I follow how you're trying to put these together, but I know your order is way wrong. If you want lighting planes to affect the floor plane, they have to go above it. They have lower numbers instead, so they'll be drawn first and won't affect the floor at all.

Yeah, I know the way it works is a bit strange, but it works. The problem is still a problem if lighting planes are above FLOOR_PLANE and GAME_PLANE.

This is how it would work:
First of all FLOOR_PLANE is being drawn. GAME_PLANE is being drawn above as an overlay. Everything is fine yet.

SUNLIGHTING_PLANE is multipled by previous planes. Everything is still fine.

And on the last step we have a problem. LIGHTING_PLANE multiplies everything beneath it, including SUNLIGHTING_PLANE, when I need it to multiply everything EXCEPT SULIGHTING_PLANE.
I still don't think your order is right, but I get what you mean now.

It looks like the problem is you want something like this:

(FLOOR <- GAME) * (LIGHT + SUN)

Currently that's quite impossible because planes do not do any kind of grouping with one another. All you can do with planes is draw to a plane, blend onto the scene, draw to the next plane, blend that onto the scene, etc. What you want is to draw two planes to the same surface before using it for blending. In 513 I'm looking to expand planes in some way so they can be grouped, which would allow you to add the two lights together first before doing a multiplication.

What I don't understand, though, is why you need two different lighting planes. It seems to me if you combined them into a single plane you'd have what you need.
In response to Lummox JR
Lummox JR wrote:
I still don't think your order is right, but I get what you mean now.

It looks like the problem is you want something like this:

(FLOOR <- GAME) * (LIGHT + SUN)

Currently that's quite impossible because planes do not do any kind of grouping with one another. All you can do with planes is draw to a plane, blend onto the scene, draw to the next plane, blend that onto the scene, etc. What you want is to draw two planes to the same surface before using it for blending. In 513 I'm looking to expand planes in some way so they can be grouped, which would allow you to add the two lights together first before doing a multiplication.

What I don't understand, though, is why you need two different lighting planes. It seems to me if you combined them into a single plane you'd have what you need.

Yes, that's what I wanted to do.
The lighting and sulighting can't work correctly on the same plane.
What's the reason they won't work on the same plane? It seems like that ought to be resolvable.
In response to Lummox JR
Lummox JR wrote:
What's the reason they won't work on the same plane? It seems like that ought to be resolvable.
The problem is the lighting system wasn't made by me. And the person who made it says it's impossible to combine lighting and sunlighting on the single plane.
Sunlight plane is being BLEND_ADD'ed to the light plane.
Since any other lights on the lighting plane are also using BLEND_ADD, I don't see why that's an issue. But it sounds like this is a discussion you should bring the author of that lighting system in on.
In response to Lummox JR
Lummox JR wrote:
Since any other lights on the lighting plane are also using BLEND_ADD, I don't see why that's an issue. But it sounds like this is a discussion you should bring the author of that lighting system in on.

It's an issue because of the way how sunlight gets it's color. Sunlight color is being set through planes.
So if you set lighting and sunlighting on the single plane, ighting plane also will be colored in the timeday's color.
In response to Narciss_f
Narciss_f wrote:
It's an issue because of the way how sunlight gets it's color. Sunlight color is being set through planes.
So if you set lighting and sunlighting on the single plane, ighting plane also will be colored in the timeday's color.

That really doesn't make any sense to me. If it's a solid color added to the rest of the lighting, that's something that can be done with a simple centered and transformed screen object on the very same plane, or it can be done by applying the base lighting directly to the background darkness object (which you need for a proper lighting plane anyway).

To me this doesn't sound the least bit insurmountable. I'd also be happy to take a look if you sent me the source and pointed out the parts where the lighting is done.
In response to Lummox JR
Lummox JR wrote:
Narciss_f wrote:
It's an issue because of the way how sunlight gets it's color. Sunlight color is being set through planes.
So if you set lighting and sunlighting on the single plane, ighting plane also will be colored in the timeday's color.

That really doesn't make any sense to me. If it's a solid color added to the rest of the lighting, that's something that can be done with a simple centered and transformed screen object on the very same plane, or it can be done by applying the base lighting directly to the background darkness object (which you need for a proper lighting plane anyway).

To me this doesn't sound the least bit insurmountable. I'd also be happy to take a look if you sent me the source and pointed out the parts where the lighting is done.

https://github.com/esthvan/call_of_flesh
Source-code. Search for lighting_overlay.dm and overlay.dm (in sun folder)
+ plane_master.dm and plane.dm for defines

I will also try applying your advice.
Since this is an SS13 branch and it's got many, many folders, you'll have to be more specific.
In response to Lummox JR
Lummox JR wrote:
Since this is an SS13 branch and it's got many, many folders, you'll have to be more specific.

\code\game\stalker\modules\lighting\normal\lighting_overlay.d m
\code\game\stalker\modules\lighting\sun\overlay.dm
\code\_onclick\hud\plane_master.dm
\code\_DEFINES\plane.dm