Lighting-related block variables
#1
Can someone tell me what's the diffrent between "m_SpreadLightFalloff" and "m_Transparent"? I noticed the list is incomplete while adding my own blocks to the list Smile I would guess that when the SpreadLight_Falloff = 1 the light values gets devided or subtracted by 1 but i don't know.... If it would be devided it would be very useless btwBig Grin
I wanted to add missing things to the list^^
Reply
Thanks given by:
#2
(07-14-2014, 09:03 PM)AntherusCraft Wrote: Can someone tell me what's the diffrent between "m_SpreadLightFalloff" and "m_Transparent"? I noticed the list is incomplete while adding my own blocks to the list Smile I would guess that when the SpreadLight_Falloff = 1 the light values gets devided or subtracted by 1 but i don't know.... If it would be devided it would be very useless btwBig Grin
I wanted to add missing things to the list^^
"m_Transparent" is a bool if a light can pass trough a Block and "m_SpreadLightFalloff" is the value, how much the light level is reduce by passing the block.
At least I think so Wink
Reply
Thanks given by:
#3
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.
Reply
Thanks given by:
#4
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?
Reply
Thanks given by:
#5
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.
Reply
Thanks given by:
#6
(07-14-2014, 09:52 PM)worktycho Wrote: 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.
That can cause problems when a player lighten up his house, he thinks that the light level is high enough, to prevent mobs from spawning, but it isn't on server side.
The result from the calculation has to be 100% the same on client an server side.
Reply
Thanks given by:
#7
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?
Reply
Thanks given by:
#8
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.
Reply
Thanks given by:
#9
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.
Reply
Thanks given by:
#10
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?
Reply
Thanks given by:




Users browsing this thread: 2 Guest(s)