Author Topic: Who chose to use per-pixel lighting?  (Read 1180 times)

Why did Badspot choose to use something demanding and have a lot of requirements such as per pixel lighting or whatever the hell it's called, rather than something less demanding and can be run on more computers such as Voxel lighting? With Voxel lighting you don't have that annoying 8 light limit (at least I think you don't) and you can also make Voxel light sources stay inside rooms/buildings (lights won't shine out through bricks) much easier without a lot of performance being affected (effected?)
« Last Edit: May 25, 2013, 08:27:24 AM by Altiris »

I don't know, but I'm pretty sure Badspot knows what hes doing since his JOB is being a programmer so he knows whats best.

OP are you literally handicapped?

It's very clear you have absolutely no understanding of this subject, because if you did you would know that this game doesn't use any voxels whatsoever.

probably because we don't use voxels lol


where did he get this idea from? (probably not but maybe idk)

Also: Per-Pixel is prettier.
Also: Blockland - wait for it - doesn't use voxels!

How the hell did you come up with the assumption that Blockland uses voxels?

Some points:

Voxel Lighting Systems == Voxel Game Engine
Voxel Lighting Systems =/= Standard Game Engine
Minecraft == Voxel Game Engine
Ace Of Spades == Voxel Game Engine
Blockland =/= Voxel Game Engine
Per-Pixel Lighting > Voxel Lighting
« Last Edit: May 25, 2013, 05:10:27 PM by chrisbot6 »


If anyone needs more detail on this subject, I beleive Blockland uses an Oct-Tree for it's brick grid. E.g: one of these:


If the picture is unclear, think about it like this: When you start blockland with an empty map, the brick grid is made up of only one square. When you place a brick, this square is devided up exactly 8 smaller squares, the one which the brick is in deviding into exactly 8 smaller squares, the one which the brick is in deviding into exactly 8 smaller squares, the one which the brick is in deviding into exactly 8 smaller squares, the one which the brick is in.... etc. Think about how the trench mod does it.

Until you have an area in the grid where it has split into squares small enough to put the brick into.

When you remove bricks a similar thing happens. Clearing bricks will reset the grid back into a big theoretical square. This means there is much less memory needed to run Blockland.

It also makes a lighting inplamentation that uses the brick grid inpractical and unneeded.


You're right Chris, in fact kompressor is credited for the Oct-Tree in the F1 menu. I didn't know what it was until now, it makes sense. It's actually pretty interesting.

With Voxel lighting you don't have that annoying 8 light limit

Er, no, the lighting method has nothing to do with light limits.
The reason we have a limit of 8 lights is because the point lighting uses a manually unrolled loop.

Code: [Select]
// Point lighting
uniform vec4     pointLightPos0;
uniform vec4   pointLightColor0;
uniform float pointLightRadius0;

uniform vec4     pointLightPos1;
uniform vec4   pointLightColor1;
uniform float pointLightRadius1;

uniform vec4     pointLightPos2;
uniform vec4   pointLightColor2;
uniform float pointLightRadius2;

uniform vec4     pointLightPos3;
uniform vec4   pointLightColor3;
uniform float pointLightRadius3;

uniform vec4     pointLightPos4;
uniform vec4   pointLightColor4;
uniform float pointLightRadius4;

uniform vec4     pointLightPos5;
uniform vec4   pointLightColor5;
uniform float pointLightRadius5;

uniform vec4     pointLightPos6;
uniform vec4   pointLightColor6;
uniform float pointLightRadius6;

uniform vec4     pointLightPos7;
uniform vec4   pointLightColor7;
uniform float pointLightRadius7;

vec4 accumulatePointLights()
{
   vec4 pointLightTotal = vec4(0.0f, 0.0f, 0.0f, 0.0f);
   vec3 lightDelta = vec3(0.0f, 0.0f, 0.0f);
   float lightDot = 0.0f;
   float ratio = 0.0f;

   // Calculate effects of the 8 point lights.

   lightDelta = worldPos.xyz - pointLightPos0.xyz;
   lightDot = max(dot(-normalize(lightDelta), worldNormal), 0.0f);
   ratio = 1.0f - (length(lightDelta) / pointLightRadius0);
   ratio = ratio * ratio * ratio * 0.4f;
   ratio = max(ratio, 0.0f);
   pointLightTotal.xyz += ratio * lightDot * pointLightColor0.xyz;

   lightDelta = worldPos.xyz - pointLightPos1.xyz;
   lightDot = max(dot(-normalize(lightDelta), worldNormal), 0.0f);
   ratio = 1.0f - (length(lightDelta) / pointLightRadius1);
   ratio = ratio * ratio * ratio * 0.4f;
   ratio = max(ratio, 0.0f);
   pointLightTotal.xyz += ratio * lightDot * pointLightColor1.xyz;

   lightDelta = worldPos.xyz - pointLightPos2.xyz;
   lightDot = max(dot(-normalize(lightDelta), worldNormal), 0.0f);
   ratio = 1.0f - (length(lightDelta) / pointLightRadius2);
   ratio = ratio * ratio * ratio * 0.4f;
   ratio = max(ratio, 0.0f);
   pointLightTotal.xyz += ratio * lightDot * pointLightColor2.xyz;

   lightDelta = worldPos.xyz - pointLightPos3.xyz;
   lightDot = max(dot(-normalize(lightDelta), worldNormal), 0.0f);
   ratio = 1.0f - (length(lightDelta) / pointLightRadius3);
   ratio = ratio * ratio * ratio * 0.4f;
   ratio = max(ratio, 0.0f);
   pointLightTotal.xyz += ratio * lightDot * pointLightColor3.xyz;

   lightDelta = worldPos.xyz - pointLightPos4.xyz;
   lightDot = max(dot(-normalize(lightDelta), worldNormal), 0.0f);
   ratio = 1.0f - (length(lightDelta) / pointLightRadius4);
   ratio = ratio * ratio * ratio * 0.4f;
   ratio = max(ratio, 0.0f);
   pointLightTotal.xyz += ratio * lightDot * pointLightColor4.xyz;

   lightDelta = worldPos.xyz - pointLightPos5.xyz;
   lightDot = max(dot(-normalize(lightDelta), worldNormal), 0.0f);
   ratio = 1.0f - (length(lightDelta) / pointLightRadius5);
   ratio = ratio * ratio * ratio * 0.4f;
   ratio = max(ratio, 0.0f);
   pointLightTotal.xyz += ratio * lightDot * pointLightColor5.xyz;

   lightDelta = worldPos.xyz - pointLightPos6.xyz;
   lightDot = max(dot(-normalize(lightDelta), worldNormal), 0.0f);
   ratio = 1.0f - (length(lightDelta) / pointLightRadius6);
   ratio = ratio * ratio * ratio * 0.4f;
   ratio = max(ratio, 0.0f);
   pointLightTotal.xyz += ratio * lightDot * pointLightColor6.xyz;

   lightDelta = worldPos.xyz - pointLightPos7.xyz;
   lightDot = max(dot(-normalize(lightDelta), worldNormal), 0.0f);
   ratio = 1.0f - (length(lightDelta) / pointLightRadius7);
   ratio = ratio * ratio * ratio * 0.4f;
   ratio = max(ratio, 0.0f);
   pointLightTotal.xyz += ratio * lightDot * pointLightColor7.xyz;

   return pointLightTotal;
}

Er, no, the lighting method has nothing to do with light limits.
The reason we have a limit of 8 lights is because the point lighting uses a manually unrolled loop.
Do you remember why he did that?

Do you remember why he did that?
He was on a lot of meth when he did that.