Page 2 of 2

Re: Using shaders to compute lighting?

Posted: Mon Jun 23, 2014 3:51 pm
by Whatthefuck
Ranguna259 wrote:I dont' think that GLSL accepts tables that have more than 4 indexes (vec4)
I see, thank you.
Well, regardless, the lighting compute is fast as it is, so this shouldn't be a problem anyway.

Thanks for the answers, everyone.

Re: Using shaders to compute lighting?

Posted: Mon Jun 23, 2014 4:15 pm
by Ref
Probably way off base but is this anywhere close to what you want?

Re: Using shaders to compute lighting?

Posted: Mon Jun 23, 2014 6:12 pm
by slime
Ranguna259 wrote:I dont' think that GLSL accepts tables that have more than 4 indexes (vec4)
You can have arrays (even arrays of vec4's) via shader:send("arrayname", element1, element2, ...) where element1 can be a table if it's a vector in GLSL, or a number if it's just a float in GLSL.

There is a driver/GPU-specific limit to the number of extern/uniform values per shader though.

Re: Using shaders to compute lighting?

Posted: Tue Jun 24, 2014 7:04 am
by Whatthefuck
Ref wrote:Probably way off base but is this anywhere close to what you want?
No, what I want to do is compute static world lighting, but since it isn't exactly possible because I'd have to send a table containing 256 indexes, I'll just stick to what I have coded so far. :)

The shader you showed could be useful for torches and other dynamic light sources though.