Posts: 783
Threads: 12
Joined: Jan 2014
Thanks: 2
Given 73 thank(s) in 61 post(s)
m_SpreadLightFallOff is how much light is lost when going through that block. Its a scale of 0 - 15 where 0 is no light lost and 15 which is completely opaque. Transparent blocks are 1 not 0 though. Those that aren't in the list get the default of 15. m_SpreadLightFallOff is not used outside of the Lighting engine. Everything else uses m_Transparent which is the more simple bool value of can you see through it.
Posts: 39
Threads: 6
Joined: Jul 2014
Thanks: 0
Given 1 thank(s) in 1 post(s)
07-14-2014, 09:50 PM
(This post was last modified: 07-14-2014, 09:59 PM by AntherusCraft.)
So you mean the "setLightOpacity" in client = "m_SpreadLightFalloff"?
But for example: When you place a glass block directly next to a glowstone, the light shines still 15 blocks wide, because it shines through the glass because the LightOpacity in the client is set to 0.
The MCServer says that the LightOpacity is 1 so when you place a glass block next to a glowstone it still shines through BUT only 14 blocks wide.
Isn't that completly wrong?
Posts: 783
Threads: 12
Joined: Jan 2014
Thanks: 2
Given 73 thank(s) in 61 post(s)
Not definite as I don't do client side stuff but it seems likely. Note that we don't transmit our lighting calcs, its only used for server side stuff like mob-spawning.
Posts: 39
Threads: 6
Joined: Jul 2014
Thanks: 0
Given 1 thank(s) in 1 post(s)
07-14-2014, 10:19 PM
(This post was last modified: 07-14-2014, 11:09 PM by AntherusCraft.)
I think the default value of the m_SpreadLightFalloff should still be 15 but the minimum should be reduced to 0 instead of 1. I know by know that m_Transparent also means, that grass can grow beneath the block that has the m_Transparent set to true so we can't just delete m_Transparent and just use m_SpreadLightFalloff. But in my opinion the server should handle the same Lightning-System as the vanilla one because of some issues like the one that LO1ZB explained. So my suggestion is: list everything that has the m_Transparent bool set to true in m_SpreadLightFalloff too with a value of 0 (not the water and lava, of course) and add the missing ones too...
[edit:] I Noticed that blocks like the mushroom is only listed in the m_Transparent list... Does that mean that everything that is listed in the Transparent list automatically has a m_SpreadLightFalloff of 0/1 or does the light don't get through the mushroom because the default SpreadLightFalloff is 15?
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1074 thank(s) in 852 post(s)
Actually the light values that MCS calculates ARE sent to the client and the client uses them initially; however it then recalculates light locally, so when you place a block in MCS, the client will calculate the light to display, there is no way for the server to send a "lighting update" other than sending the entire chunk.
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1074 thank(s) in 852 post(s)
The light should always decrease when going through a block, there is no block in MC that has the falloff of 0 - that would mean you could build an optical fibre in MC, having the light spread indefinitely by such a block. No, that makes no sense.
The desync between m_Transparent and m_SpreadLightFalloff is caused by partial "fixes" - when someone implements a new block, they update just one of the arrays and forgets the other. That's how we get the lighting bugs.
A block can be transparent and still reduce light by more than 1 - see water and lava, for example. So there's no real way to reduce the two arrays into one.
Posts: 39
Threads: 6
Joined: Jul 2014
Thanks: 0
Given 1 thank(s) in 1 post(s)
07-15-2014, 12:58 AM
(This post was last modified: 07-15-2014, 12:59 AM by AntherusCraft.)
Well, i can't find anything in the code where it says that fence etc reduces the light value by one but i think i miss understood that. Of course every block reduces the light value by one because the light travels one block but then every single block that is in the m_Transparent list has to be in the m_SpreadLightFalloff list because the light can travel trough the block (because it's transparent) but would be reduced by min. 15 because the default m_SpreadLightFalloff value is 15.
For example: The E_BLOCK_ACTIVATOR_RAIL is in the "m_Transparent" list. That means light can travel through the block but it isn't in the "m_SpreadLightFalloff"
list so the light that travels through the block will get reduced by 15 and no light would made it through the Activator rail...
Do you understand me now?