[Open Source Lib] My latest library, fastlighting

Show off your games, demos and other (playable) creations.
User avatar
zorg
Party member
Posts: 3436
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: [Open Source Lib] My latest library, fastlighting

Post by zorg »

The point is, don't rely on stuff that's not guaranteed to work. name it main.lua, all lowercase.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
pgimeno
Party member
Posts: 3544
Joined: Sun Oct 18, 2015 2:58 pm

Re: [Open Source Lib] My latest library, fastlighting

Post by pgimeno »

Hello! I've tried to run the demo but I got a curious error.

Code: Select all

Error: Cannot link shader program object:
Fragment info
-------------
Internal error: assembly compile error for fragment shader at offset 1234:
-- error message --
line 35, column 35:  error: invalid local parameter number
line 40, column 13:  error: out of bounds array access
line 43, column 34:  error: out of bounds array access
line 46, column 17:  error: out of bounds array access
line 56, column 31:  error: offset for relative array access outside supported range
line 59, column 25:  error: offset for relative array access outside supported range
line 63, column 23:  error: offset for relative array access outside supported range
-- internal assembly text --
!!NVfp4.0
OPTION NV_parameter_buffer_object2;
# cgc version 3.4.0001, build date Jan  9 2018
# command line args: 
#vendor NVIDIA Corporation
#version 3.4.0.1
#profile gp4fp
#program main
#semantic _tex0_
#semantic love_ScreenSize
#semantic love_VideoYChannel
#semantic love_VideoCbChannel
#semantic love_VideoCrChannel
#semantic ambient_color
#semantic light_state
#semantic light_pos
#semantic light_colors
#semantic light_radius
#semantic light_count
#var float4 gl_FragCoord : $vin.WPOS : WPOS : -1 : 1
#var float4 gl_FragColor : $vout.COLOR : COL0[0] : -1 : 1
#var float4 VaryingTexCoord : $vin.ATTR0 : ATTR0 : -1 : 1
#var float4 VaryingColor : $vin.ATTR1 : ATTR1 : -1 : 1
#var sampler2D _tex0_ :  : texunit 0 : -1 : 1
#var float4 love_ScreenSize :  : c[512] : -1 : 1
#var sampler2D love_VideoYChannel :  :  : -1 : 0
#var sampler2D love_VideoCbChannel :  :  : -1 : 0
#var sampler2D love_VideoCrChannel :  :  : -1 : 0
#var float4 ambient_color :  : c[513] : -1 : 1
#var bool light_state[0] :  : c[0] : -1 : 1
#var float2 light_pos[0] :  : c[128] : -1 : 1
#var float4 light_colors[0] :  : c[256] : -1 : 1
#var float light_radius[0] :  : c[384] : -1 : 1
#var float light_count :  : c[514] : -1 : 1
PARAM c[515] = { program.local[0..514] };
ATTRIB fragment_attrib[] = { fragment.attrib[0..1] };
TEMP R0, R1, R2, R3, R4;
TEMP RC, HC;
OUTPUT result_color0 = result.color;
MUL.F R1, c[513], {0.0039215689, 0, 0, 0}.x;
TEX.F R0, fragment.attrib[0], texture[0], 2D;
MOV.F R3.x, fragment.position;
MAD.F R3.y, fragment.position, c[512].z, c[512].w;
MOV.S R3.z, {0, 0, 0, 0}.x;
REP.S ;
TRUNC.S R2.x, c[514];
SLT.S R2.x, R3.z, R2;
SEQ.U R2.x, -R2, {0, 0, 0, 0};
MOV.U.CC RC.x, -R2;
BRK   (GT.x);
MOV.U R2.x, R3.z;
SEQ.U R2.x, c[R2.x], {1, 0, 0, 0};
MOV.U.CC RC.x, -R2;
IF    NE.x;
MOV.U R2.z, R3;
ADD.F R2.xy, R3, -c[R2.z + 128];
DP2.F R2.x, R2, R2;
RSQ.F R2.x, R2.x;
MOV.F R3.w, c[R2.z + 384].x;
RCP.F R4.x, R2.x;
SLE.F R4.y, R4.x, R3.w;
TRUNC.U.CC HC.x, R4.y;
MOV.F R2, c[R2.z + 256];
IF    NE.x;
MUL.F R2, R2, {0.0039215689, 0, 0, 0}.x;
DIV.F R3.w, R4.x, R3.w;
MAD.F R2, -R3.w, R2, R2;
ADD.F R1, R1, R2;
ENDIF;
ENDIF;
ADD.S R3.z, R3, {1, 0, 0, 0}.x;
ENDREP;
ADD.F R2.x, -R0.y, R1.y;
MUL.F R2.y, R2.x, R2.x;
ADD.F R2.x, -R0, R1;
MAD.F R2.y, R2.x, R2.x, R2;
ADD.F R2.x, -R0.z, R1.z;
MAD.F R2.x, R2, R2, R2.y;
RSQ.F R2.x, R2.x;
DIV.F R2, R1, R2.x;
MAD.F R1, R2, {0.33333334, 0, 0, 0}.x, R1;
MAD.F R0, R0, fragment.attrib[1], R1;
ADD.F result_color0, R0, {-1, 0, 0, 0}.x;
END
# 44 instructions, 5 R-regs

stack traceback:
	[C]: in function 'newShader'
	lightlib/Lighting.lua:31: in main chunk
	[C]: in function 'require'
	main.lua:2: in function 'load'
	[string "boot.lua"]:440: in function <[string "boot.lua"]:436>
	[C]: in function 'xpcall'
Any idea how to get around that?
User avatar
Guard13007
Party member
Posts: 132
Joined: Sat Oct 25, 2014 3:42 am
Location: Internet, USA
Contact:

Re: [Open Source Lib] My latest library, fastlighting

Post by Guard13007 »

Nixola wrote: Thu Sep 28, 2017 3:07 pm Mac can be both case-sensitive and not, depending on a setting somewhere, if I recall correctly.
It's an HFS+ option (filesystem). So depending on which option was selected when your harddrive was formatted. And different drives can have different formats, obviously.
User avatar
astrochili
Prole
Posts: 7
Joined: Sun Jun 17, 2018 8:23 am

Re: [Open Source Lib] My latest library, fastlighting

Post by astrochili »

Nice and simple example of lighting on glsl. If you add shadows and normal maps, it will be wonderful.

In demo, I suggest adding a second light source tied to the mouse cursor, otherwise the example looks really quite static.
Post Reply

Who is online

Users browsing this forum: No registered users and 51 guests