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.

DarkBASIC Professional Discussion / Shader and Lights

Author
Message
MateiSoft Romania
12
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 6th Apr 2015 22:28
Hello,

I have this shader:



and i want to add lights to it with different colours directly from dbpro code. How can i do that?

Thank You!

Alex Matei CEO
www.alexmatei.com
WickedX
17
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 7th Apr 2015 02:23
Evolved - Multipass Normal Mapping Shader. Up to 6 lights and 1 flashlight.

MateiSoft Romania
12
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 7th Apr 2015 10:53
Hello,

So this is another shader. But if i want to place lights in my scene through dbpro using this shader, how the code sounds like?

Thank You!

Alex Matei CEO
www.alexmatei.com
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 7th Apr 2015 11:56
Quote: "So this is another shader."


Yes. The shader you posted uses only one light - and is very old so it might not work on some modern graphics cards. You will require a different shader if you need more than one light at the same time.

The shader posted by WickedX is probably not the most efficient way of working with multiple lights - a better one comes with Dark Shader which you should get if you haven't already got it. However, for the one posted by WickedX you just pass values to the lighting variables in the usual way using a DBPro vector4 and the DBPro commands set effect constant vector and set effect constant float as appropriate.



Powered by Free Banners
Cescano
11
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 7th Apr 2015 19:44
Green gandalf, I am using the same normalmapping shader he posted, but I see that at the end my shader uses version 2.0 of pixel and vertex shader, will I have problem with new graphics cards?
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 7th Apr 2015 20:02
I doubt it - those old shaders often work with newer cards when you change them to PS2/S2.



Powered by Free Banners
MateiSoft Romania
12
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 7th Apr 2015 21:45
Hello all,

Thank you for your answers, that resolves it. I have a little dilema now regarding DARK LIGHTS DLL. The light on the ground looks cubic after rendering, it goes through the base of the object in the photo attached, and the shadows are not rendered as supposed to. Have any ideas? Here is all the code for adding lights and render also.

Thank You!



Alex Matei CEO
www.alexmatei.com
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 7th Apr 2015 22:37
Could you post code that shows the problem please? That snippet just compiles, runs and exits without doing anything.



Powered by Free Banners
MateiSoft Romania
12
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 7th Apr 2015 23:29
Well,

I found the problem. It was because the ground so big it didn't rendered the shadows. Here is the demo with all the stuff working maybe somebody will this useful!

Alex Matei CEO
www.alexmatei.com
MateiSoft Romania
12
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 8th Apr 2015 00:18
Btw,

Any ideas on how can we improve the speed of the light rendering maintaining the high quality result?

Thank You!

Alex Matei CEO
www.alexmatei.com

Login to post a reply

Server time is: 2026-07-05 18:59:41
Your offset time is: 2026-07-05 18:59:41