Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Shaders with multiple lights, Anyone ever gotten it to work?

Author
Message
Christopher Reeves
18
Years of Service
User Offline
Joined: 20th Dec 2005
Location: Texas, USA
Posted: 9th Feb 2010 12:33
Has anyone gotten shaders with multiple lights to work. For instance, the per pixel lighting shader has an array of 8 lights, and after following all of the instructions in the Dark Shader manual it doesn't work. I've never had a problem getting single light shaders to work but on per pixel lighting's shader, only ambient light has an effect.
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 10th Feb 2010 10:49
There should be no problem. More shader lights means just more calculations.
Remember to make sure that the shader version is at least 2.0
Christopher Reeves
18
Years of Service
User Offline
Joined: 20th Dec 2005
Location: Texas, USA
Posted: 10th Feb 2010 11:20 Edited at: 10th Feb 2010 11:21
It wouldn't work in Dark Shader itself if that were the case. The shader itself works fine. I'm using DarkGDK, NOT DarkBASIC Pro, btw.

There's no way in DarkGDK to access an effect constant that's an array. That's the problem. In other words, there is no way to get DarkGDK to tell the shader where to put the lights if its an array.
dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 10th Feb 2010 11:42 Edited at: 10th Feb 2010 11:44
Not natively, but(ripped from my lib) you can get the effect ptr using such hax:



Just keep in mind that GDK is written like poo so the above code actually causes a memory leak, so only call it once after you load the shader.

You can then use some slightly crap code to write things like arrays of booleans:



Also, that last method won't work on its own(obviously), but I'm sure you can get the gist of what's happening there to rewrite it.

Login to post a reply

Server time is: 2024-10-01 23:42:53
Your offset time is: 2024-10-01 23:42:53