Alternate lighting for different areas/rooms

solved

(Ranstone) #1

I think this is pretty self explanatory, but I’m trying to achieve a result where certain objects are affected only by certain lights. EG, you can have one area with a full sun lamp, and another area which is dark.

I achieved this before, but I lost the blend, and forget how I did it.
This is the same computer I achieved this on before, as well as the same version of blender.
I’m using GLSL.
The “This layer only” checkbox makes the light not render on any layers.

Everyone I talk to says this can’t be done in BGE. Besides the fact that I did it myself before, I’ve learned there’s allays a workaround, and would love any tips, ideas, or suggestions from you guys!

Thanks for your time!


(wkk.py) #2

You can use layers as you mentioned.

Layer in this case is the actual object layer in your scene, so in order to miss-and-match objects you will have to activate several layers at the time when running your game.


(Ranstone) #3

So, are you saying I should start with the layers off, then activate them once the game starts?
If I didn’t provide enough information, I want Layer A to have light and not layer B.
If I place a light in layer A, and check “this layer only”, it still lights up layer B if I run the game with both layers visible.


(wkk.py) #4

Are you using UPBGE?

I just tried to with:

  • Layer A
    • Cube
    • Sun (light all layers)
  • Layer B
    • Sphere
    • Light (this layer only)

And only Sphere was lightened by the two lights at the same time…

I had both layers activated at the same time, as I think you cannot activate them at runtime.

But not sure if BGE was meant to handle that kind of use case :confused:


(Ranstone) #5

UPBGE? * Googles * … Oh… I see… Actually, If I remember correctly, my old workaround in BGE was pretty annoying… I might just upgrade to UPBGE…

Thanks for telling my about the updated engine anyway!


(Ranstone) #6

UPBGE is really wonky. If I’m going to take the time to learn a new engine, I’m going to learn Unreal 4. I appreciate the recommendation, but many of the python scripts don’t even work properly in it.

Anyone have recommendations on how to achieve this in BGE?
Surely there must be some way to make certain objects not affected by certain lights, yet affected by others. I did it before.


(wkk.py) #7

Didn’t expect you to run into troubles with UPBGE, it is only supposed to be BGE but slightly better.

Anyway, I don’t have ideas for your issue, hopefully someone else will shim in :slight_smile:


(Cotaks) #8

it’s not a new engine, it’s BGE on steroids.
Some things indeed have changed a tiny bit but not that much, if you run into script problems, look into your console, it should say what you need to change for it to work. if you use libloads async option, this is changed into asynchronous. so there can be a few tiny changes that you need to make in order to work properly


(Daedalus_MDW) #9

i have a big project that works just fine in bge 2.74 and clear up to upbge 024. sure i had to add a version check for mouselook and globaldict, but otherwise its pretty similar.


(Ranstone) #10

I might try it again… The interface just looks so… Crappy… It’s like everything’s poorly anti-aliased… Some of the scripts work… Some don’t… Hmm… I’ll give it a try…


(Ranstone) #11

Also, why do they have the “This layer only” option in BGE if it doesn’t work?


(edderkop) #12

strange it works just fine on my machine using blender 2.79b

1 lamp in layer 1 set this layer only on it
1 lamp in layer 2 set this layer only on it
put a few object in both layers
have both layers active
set one lamp to a different value (change the color of the light)
press p


(Ranstone) #13

I set up that exact setup and when I set a light to “This layer only” the light turns off on all layers, including the one it’s on.

I need to do some more tests… This is really weird…


(edderkop) #14

GLSL or Multitexture ?
have you set shading mode to Texture or Material ?


(Ranstone) #15

Um… I think I’ve been wasting everyone’s time…
Every time I tried to test the lighting system, I zoomed out…
I forgot I was using “levels of detail”, and the low poly levels were on the wrong layer…

I’m really sorry guys… You were so helpful too…
Sorry for wasting everyone’s time. X|


(edderkop) #16

a side note you need to use different materials in both layer or you could get weird results.


(Ranstone) #17

Good to know. Thanks for all your help.